Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

The limitation is caused by the fact that the disk label is an EFI Disk Label aka GPT and not SMI aka VTOC.

Partitions (or slices) cannot overlap with the primary or backup label, nor with any other partitions. The size of the EFI label is usually 34 sectors, so partitions usually start at sector 34. This feature means that no partition can start at sector zero (0).

No cylinder, head, or sector information is stored in the EFI label. Sizes are reported in blocks.

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:

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#

From SMI to 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

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.