Archive for September, 2008

1and1 Dedicated Root Server and resizing their partitions

Tuesday, September 23rd, 2008

I’ve got one of 1and1 root servers and it just went tits up again and required a reinstall. After going through the Server Re-Image process the server is up and running again - with the following stupid partition setup:

  • 1Gb / (on a 120Gb drive!)
  • 5Gb /var
  • 5Gb /usr
  • 109Gb /home

Now unless you run a company creating static HTML files for 100 million small businesses, this is a really stupid setup.

Here’s how you can sort it all out into something more useful. I wanted everything on just one major / partition so I could just forget about it.

  • Reboot using the Linux Rescue Mode (from the 1and1 Control Panel)
  • The default setup has just enough data on it to fit on the 1GB partition. Copy it all over as follows:
    • mkdir /mnt/root
    • mkdir /mnt/var
    • mkdir /mnt/usr
    • mount -t ext3 /dev/sda1 /mnt/root
    • mount -t xfs /dev/sda5 /mnt/usr
    • mount -t xfs /dev/sda6 /mnt/var
    • mv /mnt/var/* /mnt/root/var
    • mv /mnt/usr/* /mnt/root/usr
  • Next: modify fstab for the new setup: use VI to open /mnt/root/etc/fstab and remove the lines containing /var /usr /home
  • umount -a
  • Next: move your swap to the end of the drive and resize your main / partition to fill the space:
    • Run: “parted”
    • “resize 2 start end” where start and end are near the end of the drive
    • “resize 1 0 near-the-end”
    • If you get errors, try doing the resize in increments
  • Reboot and you’re done

All fixed