/home on LVM
July 17, 2007 12:13 PM   Subscribe

How do I place my /home directory on an LVM on Ubuntu?

Hello all

I'm trying to set up a backup FTP server using ubuntu server 7.04, and I want to put /home on an LVM so that I can add new hard drives to expand the storage available for backups later, but still have them backed up to the same directory.

At the moment, I have 2x 20 GB hard drives just for testing.

How do I do this?

I have played around with guided partitioning with LVM, manual too, but all I seem to be able to do is put the whole filesystem (apart from /boot) on an LVM on my first hard drive and I can't add my second hard drive to it!
posted by edbyford to Computers & Internet (3 answers total) 3 users marked this as a favorite
I'm running home, root & var on separate LVM volumes on my home server.

I don't want to be elitest, but if you are asking such fundamental and basic questions without making reference to things like physical volumes, logical volumes and volume groups, I don't think you should do it, not yet.

However, the approach I'd probably take is to get the system running in a normal configuration, with some empty partitions available to play with. Once you have a running system, start with the empty partitions, create a volume group, add the partitions as physical volumes, and create a logical volume. Go single user, mount the LVM volume somewhere, copy over home, mount the new volume on the home directory. Go multiuser again. See how everything works. Also try making some changes: expand logical volumes, bring new physical volumes on line, migrate storage, take physical volumes off line.

Then, once you've experimented and know how you really want to configure it, reinstall and reconfigure.

Oh, you'll probably want to use RAID1 or 5 devices for your physical volumes, because each spindle reduces the overall reliability of the storage pool.

I assume you've read the LVM HOWTO. There is also EVMS, which is supposed to unify linux disk storage management.
posted by Good Brain at 3:34 PM on July 17, 2007

but still have them backed up to the same directory.

... not quite sure what you're getting at here. Are you trying to say that you'd like these hypothetical future disks to be part of the volume you create now? If so, that's easy:

(.. i am not responsible if you blow up the wrong partition. make sure you know what you're doing, or something)

given two dedicated disks:
fdisk /dev/hdx where x is the first 'scrap' disk you want to use
delete any partitions on it (d)
create one new partition the entire size of the disk
change the partition type to Linux LVM

pvcreate /dev/hdx1, which creates the LVM 'physical volume'

fdisk /dev/hdy1 where y is the second 'scrap' disk...
do the same as above

pvcreate /dev/hdy1

vgcreate geckisthebest (or whatever volume group name you care for) /dev/hdx1 /dev/hdy1

lvcreate -nhome geckisthebest

this should create a logical volume the size of both drives in /dev/geckisthebest/home. Make a new filesystem on it, mount it on /home, and eventually put it in /etc/fstab when you're ready. Make sure the partition type above is LVM, or else you probably won't see your volume when you reboot your machine.

But really, read the howto, it's very simple.
posted by Geckwoistmeinauto at 5:03 PM on July 17, 2007

.. oh, and when you decide to add the future disks:

create an LVM partition on the new disk
pvcreate /dev/hdz1
vgextend geckisthebest /dev/hdz1
lvextend /dev/geckisthebest/home
posted by Geckwoistmeinauto at 5:05 PM on July 17, 2007

« Older How can we recycle a used futon? (in Toronto)   |   ...I don't really mind that I can't see. Newer »
This thread is closed to new comments.