QuickTip: How to reinitialize several disks with an empty SMI partition table


Hi, today i was preparing a couple of arrays of disks that have been previously used in other courses. I’ve got this problem you’ll may be familiar with: several disks with different sizes, geometries, partition tables and labels (EFI, SMI). With more than 30 disks to reset manually, I know it’s gonna take me a lot of time. So I’ve decided to invest a little time to find a solution to automatize this task.

The SMI partition table it’s on the first sector of the disk, and describes its geometry and of course, the slices. The problem with disks is that they can have different geometries, and labels. When different labels exist, the partition tables can be overwritten without changing the format of the label (EFI or SMI), and this will give you problems in the future.

By reading the man page of the fmthard command, you can read the following:

Every VTOC generated by fmthard will also have partition
2, by convention, that corresponds to the whole disk. If
the input in datafile does not specify an entry for par-
tition 2, a default partition 2 entry will be created
automatically in VTOC with the tag V_BACKUP and size
equal to the full size of the disk.

So, if you creates a vtoc file without a definition for slice 2, then it’ll be automatically generated by default with the right size and geometry.

With this idea in mind, you can create a file with an empty definition just for the slice 0, and then the disk will be labeled with a SMI label and a slice 2 automatically generated. Just what I want.

This text is an example of the file needed to reset the vtoc:
* partition tag flag starting_sector size_in_sectors
0 0 00 0 0

And now, using this line, you can relabel any disks to an initialized state with a SMI label and no slices defined.

# fmthard -s /path/to/vtoc/file /dev/rdsk/c#t#d#s2

If you need to initialize a bunch of disks, you can get all the logical device names and iterate over them using a for loop like the following:

# for i in `selection of disks`
> do
> fmthard -s /path/to/vtoc/file /dev/rdsk/c#t#d#s2
> done

NOTE: After running this command, i found that EFI labeled disks returned this error:
expected one reserved partition, but found 0

This means it cannot be possible to automatically convert EFI disks into SMI disks. You need to do it manually by using the command:
# format -e c0t50020F230000FE64d1s2

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)
FacebookTwitterGoogle BookmarksLinkedInShare

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

, , , , , , ,