Archive for the tag 'LVM'

SBDavid

LVM - Initializing Physical Volumes

Initializing Physical Volumes

Use the pvcreate command to initialize a block device to be used as a physical volume.

Initialization is analogous to formatting a file system.

The following command initializes /dev/sdd1, /dev/sde1, and /dev/sdf1 for use as LVM physical volumes.

pvcreate /dev/sdd1 /dev/sde1 /dev/sdf1

To initialize partitions rather than whole disks: run the pvcreate command on the partition.

The following example initializes the partition /dev/hdb1 as an LVM physical volume for later use as part of an LVM logical volume.

pvcreate /dev/hdb1

pvcreate initializes PhysicalVolume for later use by the Logical Volume Manager (LVM). Each PhysicalVolume can be a disk partition, whole disk, meta device, or loopback file. For DOS disk partitions, the partition id should be set to 0×8e using fdisk(8), cfdisk(8), or a equivalent. For whole disk devices only the partition table must be erased, which will effectively destroy all data on that disk. This can be done by zeroing the first sector with:

dd if=/dev/zero of=PhysicalVolume bs=512 count=1

Continue with vgcreate(8) to create a new volume group on PhysicalVolume, or vgextend(8) to add PhysicalVolume to an existing volume group.

Example

Initialize partition #4 on the third SCSI disk and the entire fifth SCSI disk for later use by LVM:

pvcreate /dev/sdc4 /dev/sde

See Also

lvm(8), vgcreate(8), vgextend(8), lvcreate(8), cfdisk(8), fdisk(8), losetup(8), mdadd(8), vgcfgrestore(8), vgconvert(8)

Referenced By

pvchange(8), pvck(8), pvdisplay(8), pvremove(8), pvscan(8), vgchange(8), vgdisplay(8)

SBDavid

How to mount a linux LVM volume

How to mount a linux LVM volume

You can check the disk that is using the LVM volume by using the command fdisk -l

# fdisk -l

You can run the command “pvs” to get the volume group.

# pvs

You can run lvdisplay /dev/”volume group”
This will display the list of logical volumes in the volume group

#lvdisplay /dev/VolGroup00

The volume group here is VolGroup00

# Mount the partition

mount /dev/VolGroup00/LogVol00 /home

The Logical volume here is LogVol00

SBDavid

Adding Swap Space in LVM

To extend an LVM2 swap logical volume (assuming LogVol01 is the volume you want to extend):

1.Disable swapping for the associated logical volume:

# swapoff -v LogVol01

2.Resize the LVM2 logical volume by 500 MB:

# lvm lvresize LogVol01 -L +500M

3.Format the new swap space:

# mkswap LogVol01

4.Enable swap on the extended logical volume:

# swapon -va

« Prev