Skip to content. | Skip to navigation

Personal tools

Navigation

You are here: Home / Wiki / How can I make my OS partition larger?

How can I make my OS partition larger?

Instructions for growing and moving an OS partition on Emulab.

How to move Linux from partition 2 to partition 1.

  1. Allocate a d710 node with a FreeBSD image having "MBR v2"; e.g. FBSD92-STD. You need a d710 because they use the Linux-based admin MFS. You want to load FreeBSD so that Emulab is all setup to boot the node from partition 1.
  2. After the node comes up, reboot it into the admin MFS (from ops):
  3. node_admin on pc533
  4. When the node comes up, login and load the desired linux image onto partition 1:
  5. sudo frisbee -s 1 -D 131 -S subboss -F emulab-ops/UBUNTU12-64-STD /dev/sda
  6. Run slicefix to fix up /etc/fstab, etc.:
  7. sudo /etc/testbed/slicefix 1 da0
  8. Install the Grub partition boot block in partition 1:
  9. sudo mount -t ext3 /dev/sda1 /mnt
    sudo mount --bind /dev /mnt/dev
    sudo chroot /mnt /usr/sbin/grub-install --force /dev/sda1
    sudo umount /mnt/dev /mnt
  10. Whack partition 2 to avoid confusion over where the rootfs is. Run blkid to ensure that only sda1 and sda3 have UUIDs.
  11. sudo dd if=/dev/zero of=/dev/sda2 bs=64k count=1
    sudo blkid /dev/sda
  12. Make sure it boots correctly. On ops do:
    node_admin off pc533
    Make sure it boots up and is happy.
  13. Save the image. Make sure you specify a whole disk image. Otherwise your MBR will not be saved and all your work will be for naught. Also be sure to tell it that partition 1 is the boot partition.

How to grow the Linux root FS once you have it in partition 1.

Assuming you have that node with your partition 1 Linux:

  1. Reboot into the MFS from ops:
    node_admin on pc533
  2. Now it gets a little complicated. You will need to delete partitions 2-4 and grow partition 1 to the desired size. The "desired size" should probably not be the entire disk. One reason is because the d710s have a 500GB disk, and other nodes such as the pc3000s and d820s have smaller disks. So an image with a 500GB FS will not load on those. Another reason is that if you create a really big FS, you will want to fill it up, and if you do that you are not going to have fun creating a custom image! Keep it reasonable.
  3. Note that the MFS only has "fdisk" to work with, so you are pretty much stuck with that. Some hints based on my limited understanding of fdisk:

    • To "grow" partition 1, you will first have to destroy it (wow, that sounds very profound). Recreate it with the same start offset but with a new size. This will not affect the contents of the partition (unless you get the new start offset wrong!)
    • Make sure that partition 1 is set as the active (boot) partition.
    • You will need a valid partition 3 of about 1GB. This is where a variety of Emulab software expects a swap partition to be.
    • Partitions 2 and 4 do not have to exist.
    • The 'u' command can be used to change units to sectors (rather than cylinders) which are much easier to work with.
    • The 'v' command can be used to verify the resulting partition table.
  4. Once you have it made, make sure you haven't thrashed the filesystem:
    sudo e2fsck -yf /dev/sda1
    and then resize it and check again:
    sudo resize2fs /dev/sda1
    sudo e2fsck -yf /dev/sda1
  5. From ops, turn off node_admin and see if it boots!
    node_admin off pc533
  6.