Skip to content

Logical volumes on Linux

January 17, 2014

There are some commands that are used to create and manipulate logical volumes.

  • fdisk -c /dev/cciss/c0d1 #partition raw disk
  • parted /dev/sdb #for >= 2TB logical drives
    • mklabel gpt
    • mkpart primary 4096 6000GB
    • toggle 1 lvm
    • quit
  • mkfs /dev/sdb #format to Volume manager disk
    • Select 8e “Linux LVM”
  • pvcreate /dev/sdb /dev/sdc #create a physical volume
  • vgcreate groupname /dev/sdb #give it a group name, add as many PV’s as you need.
  • lvcreate –name lv_name -L size groupname #size is like 200M or 3G, etc.

Other useful commands

  • lvscan #brief listing
  • vgscan
  • lvdisplay #detailed listing
  • vgdisplay
  • lvextend
  • lvreduce
  • lvremove, vgremove, pvremove

A useful, nondestructive way of extending a partition is with the -r flag.

Both lvreduce and lvextend have the  -r, –resizefs option [Resize underlying filesystem together with the logical volume using fsadm(8)].

     lvextend -L50G /dev/fileserver/share
     e2fsck -f /dev/fileserver/share
     resize2fs /dev/fileserver/share

can be shortened with the just:

     lvextend -r -L50G /dev/fileserver/share

You can see some more information here:

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: