[linux-lvm] lvm partition on ramdisk
Stuart D. Gathman
stuart at bmsi.com
Mon May 12 20:10:56 UTC 2008
On Mon, 12 May 2008, Larry Dickson wrote:
> I'm trying to set up a logical volume over a 256MB ramdisk and a 1TB raid
> array partition. My ramdisk (set up in grub.conf with ramdisk_size=262144
> ramdisk_blocksize=4096) fails to make a type 8e partition either in fdisk or
> sfdisk. The error in fdisk is
You can't and don't need to set a partition type for a ramdisk. It
already is a partition.
> Can anyone give me some guidance here? Is it choking on the 4K blocksize? I
> wanted that for efficiency, as suggested by MrMichaelWill on his blog,
> but his base case seems to be a file system mounted directly on the
> unpartitioned device, and I need LVM.
No, just as you can make a disk device like /dev/sda a PV without any
partition table, you don't need a partition table for a ramdisk.
HOWEVER: you REALLY REALLY don't want to mix volatile and non-volatile
PVs in the same volume group. When you reboot, and the ramdisk PV is
missing, the volume group won't activate automatically. Furthermore,
you could accidentally end up with real data on the ramdisk - and it goes
bye bye on reboot.
Let me guess - you wanted to use the ramdisk for a snapshot? Yes, some
other people have tried that (see the thread here a week or so ago). You will
be very unhappy when the system reboots and the ramdisk is missing.
The real way to put snapshots on a ramdisk is a "temporary snapshot" -
a feature which could in theory be done via device-mapper, but needs
If your root fs is not on the VG you are adding the ramdisk to, you
could probably get away with it. Add the ramdisk, snapshot, make your
backup, delete snapshot, reduce ramdisk from VG. If the system crashes
while the ramdisk is still in the VG metadata, then you'll need to manually
recover the VG to activate - but hopefully that will be rare.
There is also an option you could add to initrd to activate a VG even
with missing PVs. But that makes all LVs read-only until the VG is repaired.
Stuart D. Gathman <stuart at bmsi.com>
Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.
More information about the linux-lvm