[Novalug] lvm management question

Brandon Saxe brandon20va@yahoo.com
Thu Oct 10 10:03:47 EDT 2013


"the only disk which is a volume group is the backup disk"

Actually, a disk is a block device, which can also be a PV. You can make any block device usable as a PV. This can be a whole, raw disk (e.g. /dev/sda) or some partition (e.g. /dev/sda1). You can actually use loopback devices as PV as well. Very interesting stuff the device mapper is!

A VG is comprised of PVs, which are block devices that have been pvcreate'd.

A LV is yet another block device (more of a logical block device, again via device mapper) that can be formatted for use as a file system. It wouldn't surprise me if you could nest LVM PVs inside LVs, not that you would want to do that.

RAID is a whole other story. It, too works on block devices if I recall correctly.

Now, how you mix RAID and LVM is up to you. It all depends on your use cases/goals.

Also, how you organize your VGs depends on your use cases. For example, in virtual machines where I can resize disks online (VMware ESXi), I have two disks only: 1 for the OS and 1 for data. I let the OS do its normal thing with OS, which is typically partition it up, and do a VG and LV for common stuff. The OS disk is thin provisioned and is sized to the max needed for a complete OS install with all the optional packages. Disk 2 is a raw PV. I do a VG with Disk 2. Then I splice LVs out of it with LVs for /opt, /var, /srv, etc as needed. What's nice about using the raw disk as a PV is that when I resize the disk in VMware and then subsequently tell the kernel to rescan the scsi bus, the new disk size is automatically detected and the new space is passed all the way through to the VG. From there, I can vgextend and lvextend as I wish. All whilst online.

So that's one example. Another example I have where I am using it is on my cell phone. I have a Linux phone, the Nokia N9 (64GB version). One thing I do on there is run an Ubuntu chroot on loopback files (I run vnc server and use the desktop from a Nexus 7 over blutooth PAN). The N9 storage for user files is formatted fat32 by default. This is so one can connect to any system via USB mass storage for file transfer. The issue here is that the max size of a file image on fat32 is 4GB. This means my Ubuntu chroot is limited to 4GB. Using LVM, however, I can carve up any number size of image files. These could be 4GB chunks or even smaller. I have the initial image at 4GB. Let's say I want to grow 250MB at a time. I can use dd to make 250MB files on demand, then loopback mount them. I can then pvcreate them and then add them to a volume group for the chroot. Voila! A growable chroot on a fat32 partition! No need to muck around with trying to reformat the
 phone itself and risk screwing it up.

There's tons of ways to slice stuff up with LVM. It's great.


On Thursday, October 10, 2013 3:26 AM, Mark Smith <mark@winksmith.com> wrote:

i'm sure someone at NOVALUG is be knowledgeable about volume group
managment and would be interesting in giving somem advice!

i have a whole bunch of data i'm storing at home.  historically, i
have been keeping it mostly on separate disks, one per logical area.
these are:

    media    0.75TB - photo's, movies, etc.
    systems    0.75TB - saves of old OS
    data    0.50TB - day to day stuff
    backup    5.00TB - in-house backup of all the above

the only disk which is a volume group is the backup disk and that's
only to build a bigger disk out of smaller ones.

i was just doing some maintenance, growing or moving disks around and
it occurs to me i should probably just use volumes.  i started thinking
a bit about the relationship between VG's, PV's, and LV's.

i was initially going to create a VG for media for instance, but it was
only going to have one PV and one LV.

1. i could make one VG out of all of my disks and then create LV's
   for each.

2. i could make two VG's out of all of my disks, one for backup and one
   for all the others in an attempt to isolate them somewhat for backup
   purposes.

3. i could create all separate VG's for each of the disks above.

as a note, the disk sizes are relatively different though: 1x500GB,
2x750GB, 4x1000GB, 1x2000GB which puts a rub into some RAID requirements.
i suppose splitting up disks into 250GB slices could solve that, but
it doesn't seem like that'd help in the case of a failure as the entire
spindle goes south, not just a partition.

advice?

-- 
Hei konā mai
Mark Smith
mark@winksmith.com
_______________________________________________
Novalug mailing list
Novalug@calypso.tux.org
http://calypso.tux.org/mailman/listinfo/novalug



More information about the Novalug mailing list