It is confusing that a logical volume can contain either a partitioned drive or a single file-system with no partition table. Doing an fdisk -lu will determine which.
A partition can contain several file-systems, such as boot and a "nested" LVM partition. The link at the bottom gives examples of how to access this.
. Create and mount a LV
/usr/sbin/lvcreate -L 20G -n jessica VolGroup00
/sbin/mkfs -j /dev/VolGroup00/jessica -L jessica #format jessica as ext3
mkfs.ext4 -L ext4volname /dev/vg/newvol # or ext4
mount /dev/VolGroup00/jessica /home/jessica/backup
. Move a file-based VM into an LVM based one
/usr/sbin/lvcreate -L 10G -n vm_amf VolGroup00 #create the LV
dd if=/home/xen/domains/xen2.example.com/disk.img of=/dev/VolGroup00/vm_amf
/sbin/e2fsck -f /dev/VolGroup00/vm_amf
/sbin/resize2fs /dev/VolGroup00/vm_amf
/usr/sbin/lvcreate -L 1G -n vm_amf_sw VolGroup00 #create the LV swap file
/sbin/mkswap /dev/VolGroup00/vm_amf_sw
#edit /etc/xen/amf.cfg :
disk = [ 'phy:/dev/VolGroup00/vm_amf,hda1,w', 'phy:/dev/VolGroup00/vm_amf_sw,hda2,w' ]
/usr/sbin/xm create -c /etc/xen/amf.cfg #start up the machine
#change host name
vi /etc/hosts # change the
echo amf.isnew.org > /etc/hostname
/etc/init.d/hostname.sh start
#test with:
hostname
hostname -f
#Mount LVM disks within a VM from the host system
kpartx -av /dev/VolGroup00/nameOfImage #create mapping
#this will give you the mappings available
#ls -l /dev/mapper/ #will give you their names
mount /dev/mapper/nameofmappingp1 mountpoint #probably ends in p1
#do stuff
umount mountpoint #must do this before removing mapping
kpartx -dv /dev/VolGroup00/nameOfImage #remove mapping
#To mount LVM disks within another LV (as long as the volume groups have different names):
#follow the above approach to map the LV, but don't mount it (it won't mount anyway)
vgscan #then run this command to re-scan
vgchange -ay VolGroup00 #activate (don't forget to de-activate etc. in reverse order)
kpartx ... # may not be necessary
#rename a logical volume:
vgchange -a n /dev/VolGroup00 #de-activate volume
vgrename /dev/VolGroup00 /dev/VolGroup0
vgchange -ay VolGroup0 #re-activate volume
A very useful tutorial is at: http://www.linuxtopia.org/HowToGuides/fedora_core_6_xen_quickstart/fedor...
lv can be deleted with lvremove
Mount LVM from Ubuntu Live CD
apt-get install lvm2
fdisk -lu
pvscan
vgscan
vgchange -a y
lvscan
mount /dev/VolGroup00/LogVol00 /mnt
For explanation, see http://linuxwave.blogspot.com/2007/11/mounting-lvm-disk-using-ubuntu-liv...
#resizing--Here is a good guide: http://www.tcpdump.com/kb/os/linux/lvm-resizing-guide/expand.html