I am trying do create a script to remove all slices from a disk with Solaris disk labels.
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#
However the slice gets deleted if I run like:
bash-3.2# fmthard -d 0:00:0x00:256:0 /dev/rdsk/c0t2d0s2
The question are:
- why the first sector can not be 0, ant it must be greater or equal than 34?
- is it possible to create an empty vtoc?
Best Answer
The limitation is caused by the fact that the disk label is an EFI Disk Label aka GPT and not SMI aka VTOC.
See also System Administration Guide: Devices and File Systems - EFI Disk Label
The
fmthard
error was generated by vwrite64(int fd, struct dk_gpt *efi, char *devname) function which is a wrapper to efi_write(3EXT) syscall.To change the disklabel type from EFI GPT to Solaris SMI and destroy all data on the disk:
From SMI to GPT:
The EFI/GTP disk label was created by ZFS
zpool
command when using the whole disk in a ZFS pool. See Solaris ZFS Administration Guide: Components of a ZFS Storage Pool: Using Disks in a ZFS Storage Pool