My x86-64 home server box has 4TB of raw storage capacity, recently doubled from 2TB. That could have been more trouble than it was worth, as we start hitting limits.
There are several problems.
- There is no way to manage more than 2 TB of space with the normal MS-DOS partition table. The GUID partition table scheme can do it, and Linux can use it.
- The machine's (Dell PowerEdge 2900) BIOS can only boot from an MSDOS-labelled disk. update: A future version of grub may work around this, relying on the fact that GPT boot table has a MBR-like fake boot sector too.
- 2TB of the raw disk space has already been partitioned and a good fraction filled. Backing up and restoring everything was not an alluring option. I want to migrate in-place!
- The whole 4TB of raw space has been already assigned to the sole RAID5 array (including a hot spare disk - 3TB usable). There was no room to make a new small virtual disk just to boot from and use the msdos disk label.
My solution has several parts.
- USB. Arrange to boot off a "small" 1GB flash drive. (We keep an image of that usb drive on the hard drive for a backup.) It is mounted under /boot as usual, and is kept up-to-date by grub automatically. /boot/grub/device.map may need to list the USB drive's BIOS name - probably (hd0), and the disk controller's BIOS may need to be turned off, to make sure the USB drive wins the boot-y-lympics. Check that the initrd image still includes the disk controller's driver, as that's where the root partition etc. will be. (Alternatives would have included booting off of a floppy or a bootable CD, but neither would be automatically maintained as the machine undergoes kernel upgrades.)
- Gather information about old partition table. Record the current bounds of all the existing partitions, measured in sectors: Make a backup of the old table, in case things go wrong.
# sfdisk -uS -l /dev/sda Disk /dev/sda: 364407 cylinders, 255 heads, 63 sectors/track Units = sectors of 512 bytes, counting from 0 Device Boot Start End #sectors Id System /dev/sda1 * 63 208844 208782 83 Linux /dev/sda2 208845 80324999 80116155 83 Linux /dev/sda3 80325000 2766441194 2686116195 83 Linux /dev/sda4 2766441195 2927091194 160650000 f W95 Ext'd (LBA) /dev/sda5 2766441258 2927091194 160649937 82 Linux swap / Solaris # dd if=/dev/sda count=1 of=/boot/SDA-MBR-BACKUP
Of these, the first three (type 83) partitions are valuable. Take careful note of the "Start" and "End" columns.
- Boot to single-user. Or boot from a livecd, or installation cd, or whatever can give you GNU Parted.
- Write new disk label:
# parted /dev/sda (parted) unit s (parted) mklabel gpt ... contemplate warnings, then approve ... (parted) mkpart primary ext3 63 208844 (parted) mkpart primary ext3 208845 80324999 (parted) mkpart primary ext3 80325000 2766441194 (parted) quit
Double-check those numbers, then reboot.
- Get some confidence in the preserved filesystem data. Run fsck; use the machine as if nothing happened.
Finally, you can extend the partitions (resize2fs), add new ones, with the machine running, and the full storage available to play with.