sdisklabel
8
sdisklabel

# sdisklabel

Create/modify disklabels on Linux/Alpha systems

       sdisklabel
         device
         print
           zero
           sum

       sdisklabel
         device
         size
         partsize

       sdisklabel
         device
         partnum
         offset
         size
         parttype

## COPYRIGHT

sdisklabel is Copyright (C) by Red Hat Inc. The author of this man page tried to track down the original author, but was unable to do so. A final Bugzilla entry with RedHat yielded the following reply: I can't track down a Bob Manson (and I cannot find any record of his association with Red Hat in the aboot sources), but any work he did on behalf of Red Hat would be property of Red Hat, and you can consider all our changes to be release under the GPL the same as the rest of the aboot package.

## DESCRIPTIONS

sdisklabel can be used to create partitions (called disklabels) on Linux/Alpha systems. You must use disklabels instead of the DOS type partitioning scheme on any hard disk which you want to boot from via SRM or which you want to share with HP Tru64. If you instead are booting from milo then you must not use disklabels on your boot hard disk.

Even if you are using disklabels, it is recommended to use fdisk(8) instead of sdisklabel.

sdisklabel also assumes you have a SCSI disk with 512-byte sectors, though it should work fine on an IDE drive as well. All sizes are specified on the command line in sectors.

There are 8 partitions in total which are numbered from 0 to 7. They correspond to BSD disklabels A to H. Partitions have to be added sequentially, as sdisklabel won't let you leave empty partitions unlike many BSD disklabel programs. If you want this (or if you want overlapping disk labels) use fdisk(8) instead.

First off, if you have an invalid disk label (you've never run sdisklabel on this disk before) you have to issue

`sdisklabel `/dev/sda zero``

(`/dev/sda` is the device you're partitioning, substitute as appropriate).

This zeros out your disk label. Only do this if you really want to zero your disk label. It just does it; it doesn't ask, or warn, or anything.

The program also probably printed out the size of your disk in kb. If it was wrong, you now get to use the "`size xxx`" option along with the rest of these commands. The size isn't critical, it's just used to try and make sure you don't go past the end of the disk.

Next, add your first partition. This doesn't start from 0, as you have to leave room for the boot loader and other stuff. 256K (or 512 sectors) will be enough.

Let's pretend that you want to make a 250000 kb partition starting from sector offset 512:

`sdisklabel `/dev/sda 0 512 500000 8 print``

The last number is the filesystem type, and is currently 8 for ext2fs filesystems. (A different number would be used to specify an Tru64 partition, for example).

If all was successful, the program should print out the partition (the last keyword, "print", specifies that it should print the partition after modifying it with the previous command), and you should see something like

>     ----------------------------------------------------------
>     I think your disk is 528870K total size.
>     If I'm wrong, override the size with the 'size num' option

>     partition 0: type 8, starts sector 512, size 500000
>     ----------------------------------------------------------

You can then add the next partition, which would be partition 1. To add a second partition that is 200000 kb long, you'd run

`sdisklabel `/dev/sda 1 512256 400000 8 print``

And both partitions would then be printed out.

If for some reason the size got determined incorrectly, you'd do instead

`sdisklabel `/dev/sda size 528870 0 512 400000 8 print``

The size option should come immediately after the device name, and the size is the total # of sectors on the drive.

## BUGS

sdisklabel does not check for all errors, so use with care.

## NOTES

If you want to share the disk with HP Tru64 (OSF/1) it is recommended to use the Tru64 partitioning tools to prepare the disk.

To actually boot from the freshly labeled disk you also need to install a boot strap as well, see aboot(8) and swriteboot(8) for details.

The print command may be placed before or after any other command.

In case you do want to leave empty partitions or create labels which extend beyond the end of the disk (e.g., when you know sdisklabel is reporting a wrong size) then use can use the `force` switch on the command line.

## AUTHOR

This man page was written by Helge Kreutzmann debian@helgefjell.de for the Debian GNU/Linux project but may be used by others. It is heavily based on the `README` provided along with the sdisklabel source.

## SEE ALSO

fdisk(8), aboot(8), swriteboot(8)