Disk Initialisation – SMI Label vx EFI Label
Whenever we detect a new disk in Solaris operating system, the first operation we perform is “Disk label” using the format command. The purpose of this post is to explain the background information of Solaris default disk labeling and also discuss the EFI disk labeling introduced from Solaris 9 and later Versions.
Default Solaris Disk label , i.e. VTOC ( Volume to Content Table) aka SMI(Sun Microsystems, Inc) label, contains the information such as logical partitioning, disk geometry and other access characteristics.
In Sparc Hardware – Disk Label ( or VTOC) resides in the first sector ( 512 bytes) of the disk or logical unit. If we run the format command , first time after a disk was recognized in the operating system, the format command will look at this first sector and complain about “Missing Label” in case of missing VTOC table.
# prtvtoc /dev/rdsk/c0t1d0s2
* /dev/rdsk/c0t1d0s2 (volume “gurkulDisk”) partition map
* 512 bytes/sector
* 133 sectors/track
* 27 tracks/cylinder
* 3591 sectors/cylinder
* 4926 cylinders
* 4924 accessible cylinders
* 1: unmountable
* 10: read-only
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
0 2 00 0 7788879 7788878
1 3 01 7788879 2100735 9889613
2 5 00 0 17682084 17682083
7 8 00 9889614 7792470 17682083
Every time we label a disk there will be backup label that will be created on the same disk.
The backup label, or rather, labels, are stored in the last “reserved cylinder” or “alt” cylinder, but in some very old disks they were put in cylinder 2. There are always 2 “alt” cylinders , the last one houses the defect list and the backup labels. The defect list is store in the first 5 even sector, while the backup labels are replicated in the first 5 odd sectors.
Since the “alt” cylinders cannot be part of any partitions, they are not accessible directly through device file interface (i.e. you would hit EOF before you can reach the alt cylinders). The format utility or extended ansi library functions like write_vtoc() calls the device driver through ioctl() directly to access those areas.
When doing “format -> label”, both the primary label (on block 0) and the backups are written, and the backup labels are read back immediately to verify all copies are consistent. If not, you will get a warning of either:
Warning: no backup labels
Warning: some backup labels incorrect
The “format -> backup” command iterate through each of the 5 backup labels and locate the first one that looks good and matchess the geometry (disk type) stored in the backup with the selected disk. If different, something is seriously wrong, and it prompts user if he wants to continue, as an alert the backup is may not be the correct one. If a good backup is found, then the values will be restored, both the primary and backup labels are re-written.
EFI ( Extensible Firmware Interface) Label:
Some quick points about EFI:
- EFI labels are only supported by 64 bit solaris 9 U 04/03 or later. And able to support the disks larger than 1TB.
- EFI disks will have total 7 slices ( 0 to 6 usable and slice to as overlap) , similar to SMI disks
- ZFS by default used EFI label
- Size of EFI lable is 34 sectors and In EFI disk no partition can start at sector-0(zero)
- to initialize a disk with EFI label we should use
format -e < disk >
Limitations with EFI labeled disks:
- We can boot from EFI labeled disks.
- When we move EFI labeled disks to either with older versions of operating systems or older volume manager products ( like VxVM) , operating system will log the errors ” corrupt label – wrong magic number”