Monday, March 30, 2009

lvm2 on Orange JeOS (Extending the root partition)

So after messing with Orange JeOS a bit, I kept bumping my head on the fact the there just wasn’t a whole lot of disk space to play with.  Both the core version and the esx version of Orange JeOS used lvm2 and limit the root partition to around 2GB…that doesn’t leave a whole lot of space for logs.  I’m still learning about lvm2 so I figured this was a good opportunity to figure it all out. So…the quick and dirty is that I was unable to resize the Physical Volume (PV) that Orange JeOS was on without breaking it.  I tried doing it from a live cd with the lvm2 tools and all but it turned out to be a real hassle. So instead, I created another partition on the disk to fill the remaining space, created a 2nd PV, added it to the Volume Group, extended out the existing Logical Volume to include it and then resized my partition.  (Um…yeah…pretty meaty work…)  Here’s the play by play:

  1. Load Orange JeOS (whatever flavor or however you want)
  2. Log in as root (default password is qwerty)
  3. Verify you current disk and partition sizes with “df”
  4. Boot from Qparted Live CD
  5. Create an ext3 partition on the remaining disk space
  6. Boot back into Orange JeOS and login as root
  7. Do a “pvcreate /dev/hda3” replacing hda3 with the partition name you created in the last step. This creates the new lvm2 Physical Volume.
  8. Do a “vgextend /dev/VolGroup00 /dev/hda3” replacing both the volume group name (VolGroup00 is the default in Orange JeOS with yours) and the partition name you used above
  9. Do a “lvextend –L +4G /dev/VolGroup00/LogVol00” to extend the logical volume.  As before replace the pieces you need to. I increased the size by 4GB above because that was the size of my new physical volume.
  10. Finally run a “resize2fs /dev/VolGroup00/LogVol00” to extend the file system out to use the new space. I’m on ext3 but ext2 should work as well. If you picked something else as your filesystem your mileage may vary.

That’s pretty much it. From here I was able to see the new space in a “df” from the command line.  I’m sure there were other options (including a way to partition the rest of the disk from inside Orange JeOS) but that’s how I did it.

There’s a pretty good reference to lvm2 on line here.

1 comment:

andyclark said...

Rolfsa, you can also do this by modifying the appliance kickstart prior to building the Orange JeOS ISO with the builder script.

But if using the supplied ISO, this is a good way to go.

Thanks for the clean examples.

Andy