Solaris磁盘标签 – 使用fmthard返回删除片段:vtoc中存在无效条目

我正在尝试创build一个脚本,使用Solaris磁盘标签从磁盘中删除所有片。

bash-3.2# prtvtoc /dev/rdsk/c0t2d0s2 * /dev/rdsk/c0t2d0s2 partition map * * Dimensions: * 512 bytes/sector * 143374738 sectors * 143374671 accessible sectors * * Flags: * 1: unmountable * 10: read-only * * Unallocated space: * First Sector Last * Sector Count Sector * 34 222 255 * * First Sector Last * Partition Tag Flags Sector Count Sector Mount Directory 0 4 00 256 143358065 143358320 8 11 00 143358321 16384 143374704 bash-3.2# fmthard -d 0:00:0x00:0:0 /dev/rdsk/c0t2d0s2 /dev/rdsk/c0t2d0s2: invalid entry exists in vtoc bash-3.2# uname -prsm SunOS 5.10 sun4v sparc bash-3.2# 

但是,如果我运行如下,切片被删除:

 bash-3.2# fmthard -d 0:00:0x00:256:0 /dev/rdsk/c0t2d0s2 

问题是:

  • 为什么第一个扇区不能是0,ant必须大于或等于34?
  • 是否有可能创build一个空的vtoc?

该限制是由于磁盘标签是EFI磁盘标签又名GPT而不是SMI又名VTOC。

分区(或切片)不能与主标签或备份标签重叠,也不能与任何其他分区重叠。 EFI标签的大小通常是34个扇区,因此分区通常从扇区34开始。此function意味着没有分区可以从扇区零(0)开始。

EFI标签中不存储柱面,头部或扇区信息。 大小以块forms报告。

另请参见“ 系统pipe理指南:设备和文件系统 – EFI磁盘标签”

fmthard错误是由vwrite64(int fd,struct dk_gpt * efi,char * devname)函数产生的,它是efi_write(3EXT)系统调用的包装。

要将disklabeltypes从EFI GPT更改为Solaris SMI并销毁磁盘上的所有数据:

 bash-3.2# format -e Searching for disks...done AVAILABLE DISK SELECTIONS: ..... 1. c0t1d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424> /pci@780/pci@0/pci@9/scsi@0/sd@1,0 ..... Specify disk (enter its number): 1 selecting c0t1d0 [disk formatted] format> label [0] SMI Label [1] EFI Label Specify Label type[1]: 0 Auto configuration via format.dat[no]? Auto configuration via generic SCSI-2[no]? format> q bash-3.2# 

从SMI到GPT:

 format> label [0] SMI Label [1] EFI Label Specify Label type[0]: 1 Warning: This disk has an SMI label. Changing to EFI label will erase all current partitions. Continue? yes format> q 

当在ZFS池中使用整个磁盘时,通过ZFS zpool命令创buildEFI / GTP磁盘标签。 请参见“ Solaris ZFSpipe理指南:ZFS存储池的组件:在ZFS存储池中使用磁盘”