免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 6246 | 回复: 7
打印 上一主题 下一主题

关于EFI Disk label [复制链接]

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-06-29 01:44 |只看该作者 |倒序浏览
Solaris 9后,为支持容量大于1 TB的存储设备,在磁盘管理上新引入了EFI(Extensible Firmware Interface)类型的disk label。它与传统的 VTOC(Volume Table of Contents)label 方式有很大不同。我们可以使用 format –e 命令后,再用 label 命令中就可以看到选择 label 的类型菜单。传统的 VTOC label 在 format>label 中被称为 SMI。

与 VTOC Label相比,EFI Label 的主要差异表现为:

  可支持容量大于1 TB的磁盘(包括磁盘阵列等逻辑盘).
  分区方式改变,可使用的分区为 slices 0–6,其中的 2 分区也是一个普通的可用分区了.
  一个分区时不可与其他分区片或label片 (backup label)重叠。EFI label 占用 34 个扇区(sector),因此其它分区的起始扇区必定是从 sector 34开始。也就是说,不再存在从 sector 0开始的分区。
  EFI label 不保存磁盘的柱面(cylinder)、磁头(head)、扇区(sector)信息。所以使用EFI label 时,都以扇区号进行操作,分区大小用“块”(block)来表示。
  磁盘信息原来保存在备用柱面区域中(alternate cylinders area, 磁盘的最后两个柱面),EFI label 则保存在 slice 8 中。
  使用 format 工具修改 partition 时,凡大小为零的分区,都被自动赋予“unassigned”标签(tag);凡大小不为零的分区,则都赋予缺省标签“usr”。分区分好后,可使用partition>change 菜单来修改容量不为零的分区标签(但不可改为“unassigned”标签)。

EFI Label 有一些限制。因此,应该根据下面的限制来考虑,是否应该在应用环境中采用大于1TB的磁盘(及逻辑磁盘)。如果不希望受到 EFI label 带来的局限,那么则不应使用大于1TB的盘(如是阵列逻辑盘,则应将逻辑盘容量划小)。EFI Label的局限主要有:
  当前的 SCSI 驱动(ssd)仅支持最多 2 TB 容量。如果需要大于 2 TB 的容量,应采用 Solaris Volume Manager 之类的存储管理工具来创建大容量设备。
  某些 Layered software products,虽然声称可以支持 EFI-labeled 磁盘,但在实用中可能无法正确访问 EFI label 盘。
  早期 Solaris 版本无法识别 EFI label。
  EFI label 不支持 IDE 盘。
  EFI label 盘不可做启动盘。
  Solaris Management Console 的 Disk Manager 工具不能管理 EFI label 盘,只能使用 format 工具来对 EFI label 盘进行分区,然后再用 Solaris Management Console 的 Enhanced Storage 工具来管理 EFI label 盘上的卷(volume)或磁盘包(disk set)。
  EFI 中不可使用重叠分区,因此原来的2分区不再代表全盘。此时,全盘表示方法为 cxtydz.
  EFI label 的盘或分区的容量信息中不再出现柱面、磁头等参数,而采用扇区或块为单位。
  对 EFI label盘,format 工具中的部分选项/子命令不再可用:
  - save 选项不被支持,因为 EFI label 盘不再需要用到 format.dat 中的记录。
  - backup 选项不可用,因为磁盘驱动找到 primary label 后即可将它写回到盘上(执行步骤与VOTC方式全然不同了)

下面看看EFI label的实用例子。

例1、EFI label 盘的全盘复制
在原来的VTOC方式中,2分区 (s2) 代表全盘,因此工程师们都习惯使用 dd 来进行全盘复制:

dd if=/dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t2d0s2 bs=128k

对EFI label 盘的复制则不同了。一是EFI label 没有 s2,二是EFI label 盘上的有一个UUID(Universally Unique Identifer),直接复制会导致两盘的UUID重复,某些软件产品读到重复UUID时会发生数据问题,因此需要在复制后重新生成UUID。
看例子:
1. 全盘数据克隆先:
    # dd if=/dev/rdsk/c0t0d0 of=/dev/rdsk/c0t2d0 bs=128k
2. 将源盘的 prtvtoc 输出定向到 fmthard 命令,以生成目标盘的新 label:
    # prtvtoc /dev/rdsk/c0t0d0 | fmthard -s - /dev/rdsk/c0t2d0

例2、创建 EFI 或 SMI label
对于小于1TB的盘,既可以使用VTOC label,也可以使用 EFI label。如果使用常规的不带参数的 format 命令,如原盘已 label,那么将不会改变原来的 label 类型;如未 label,则会提示进行 label,采用常规的VTOC类型。如果需要选择指定 label 类型,或需要改变原有的 label 类型,则可以使用 format -e 参数。
我们熟知的常规 format>label 命令的提示是这样的:

# format
Searching for disks...done
……
format> lable
Ready to label disk, continue?

带 -e 参数的format>label 命令则是这样:

# format -e
Searching for disks...done
……
format> label
[0] SMI Label
[1] EFI Label
Specify Label type[0]: 0
Ready to label disk, continue?

上面提供了 label 类型的选择菜单。

例3、使用 format 工具,将一个 1.15 TB 的 EFI label 盘分为 3 个片区

# format
……
partition> modify
Select partitioning base:
0. Current partition table (original)
1. All Free Hog
Choose base (enter number) [0]? 1
Part        Tag        Flag        First Sector        Size        Last Sector
0        root        wm        0                0        0
1        usr        wm        0                0        0
2        unassigned wm        0                0        0
3        unassigned wm        0                0        0
4        unassigned wm        0                0        0
5        unassigned wm        0                0        0
6        usr        wm        0                0        0
8        reserved        wm        2576924638        8.00MB        2576941021
Do you wish to continue creating a new partition
table based on above table[yes]? y
Free Hog partition[6]? 4
Enter size of partition 0 [0b, 34e, 0mb, 0gb, 0tb]:
Enter size of partition 1 [0b, 34e, 0mb, 0gb, 0tb]:
Enter size of partition 2 [0b, 34e, 0mb, 0gb, 0tb]: 400gb
Enter size of partition 3 [0b, 838860834e, 0mb, 0gb, 0tb]: 400gb
Enter size of partition 5 [0b, 1677721634e, 0mb, 0gb, 0tb]:
Enter size of partition 6 [0b, 1677721634e, 0mb, 0gb, 0tb]:
Part        Tag        Flag        First Sector        Size        Last Sector
0        unassigned wm        0                0        0
1        unassigned wm        0                0        0
2        usr        wm        34                400.00GB 838860833
3        usr        wm        838860834        400.00GB 1677721633
4        usr        wm        1677721634        428.77GB 2576924637
5        unassigned wm        0                0        0
6        unassigned wm        0                0        0
8        reserved        wm        2576924638        8.00MB        2576941021
Ready to label disk, continue? yes
partition> q

例4、显示磁盘 label 信息

# prtvtoc /dev/rdsk/c0t0d0s0
* /dev/rdsk/c0t0d0s0 partition map
*
* Dimensions:
* 512 bytes/sector
* 63 sectors/track
* 15 tracks/cylinder
* 945 sectors/cylinder
* 8894 cylinders
* 8892 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
*                                 First         Sector         Last
* Partition        Tag        Flags        Sector         Count         Sector         Mount Directory
      0                 2         00         1048950         3381210         4430159         /
      1                 3         01         0         1048950         1048949
      2                 5         00         0         8402940         8402939
      7                 8         00         4430160         3972780         8402939         /export/home

这是一个VTOC label 盘。

# prtvtoc /dev/rdsk/c3t1d0s0
* /dev/rdsk/c3t1d0s0 partition map
*
* Dimensions:
* 512 bytes/sector
* 2479267840 sectors
* 2479267773 accessible sectors
*
* Flags:
* 1: unmountable
* 10: read-only
*
*                                 First         Sector         Last
* Partition        Tag        Flags        Sector         Count         Sector         Mount Directory
      0                 2         00         34         262144         262177
      1                 3         01         262178         262144         524321
      6                 4         00         524322         2478727100 2479251421
      8                 11         00         2479251422 16384 2479267805

这是一个 EFI label 盘。

评分

参与人数 1可用积分 +3 收起 理由
C.Arthur + 3 精品文章

查看全部评分

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
2 [报告]
发表于 2007-07-04 16:33 |只看该作者
补充一下:
如果是一般的SCSI内置盘,在Solaris 10下做zfs的时候,很可能无意中将盘封装成了EFI label,这时用format看,盘上没有了作为backup的s2,却多出来一个s8。

如果想恢复成原来的VTOC label:
1、可以用format -e来重新label(Solaris 9以上);
2、拔盘到Solaris 8的机器上(Sol 8 CDROM启动应也可),重新label;

数据嘛,当然没有没有了的……

论坛徽章:
0
3 [报告]
发表于 2007-07-19 14:25 |只看该作者
楼主这文章的原版在哪啊?

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
4 [报告]
发表于 2007-07-19 14:45 |只看该作者
原帖由 maike_xiao 于 2007-7-19 14:25 发表
楼主这文章的原版在哪啊?


根据自己笔记改写,并非全文翻译的。其中关于EFI的特点和部分例子数据摘抄于Solaris 10文档,System Administration Guide:
Devices and File Systems,第11章。问题的起因就是把Solaris 10下EFI盘拔到Solaris 9机器上后,找不到s2却多出s8,这才认真起来调查一番……

论坛徽章:
0
5 [报告]
发表于 2007-07-19 15:39 |只看该作者
哦,谢谢,solaris10 的书没看呢还!看来得看看了!

论坛徽章:
0
6 [报告]
发表于 2007-10-25 08:31 |只看该作者
好贴,感谢briangao把这贴链接出来

论坛徽章:
0
7 [报告]
发表于 2007-10-25 09:10 |只看该作者
好文章,谢谢分享

论坛徽章:
0
8 [报告]
发表于 2012-03-07 10:34 |只看该作者
收了,谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP