Difference between revisions of "Logical Volume Management in Linux"

From Observer GigaFlow Support | VIAVI Solutions Inc.
Jump to: navigation, search
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
[[Category:Linux]]
 +
[[Category:Installation]]
 +
There are 3 steps to this.
 +
Create a partition
 +
Use fdisk to create your partitions. Use fdisk /dev/DISKID to do this. DISKS is generally something like sdb
 
  fdisk /dev/sdb
 
  fdisk /dev/sdb
df -h
+
Press "p" to print the partitions, there will be none on an empty disk
pvdisplay
+
 
fdisk /dev/sdb
+
Press "n" to create a new partition
 +
 
 +
Create a primary partition on partition number 1 for a new disk. Accept defaults to use full disk for first and last cylinders.
 +
 
 +
Press "t" to change the type of the partition to 8e (Linux LVM)
 +
 
 +
Press "p" to double check the new parition and then press "w" to write the changes
 +
 
 +
Format partition
 +
 
 +
Create LVM disk pool
 
  pvcreate /dev/sdb1
 
  pvcreate /dev/sdb1
 
  vgcreate vgpool /dev/sdb1
 
  vgcreate vgpool /dev/sdb1
 
  lvcreate -l 100%FREE -n lvstuff vgpool
 
  lvcreate -l 100%FREE -n lvstuff vgpool
 
  mkfs -t xfs /dev/vgpool/lvstuff
 
  mkfs -t xfs /dev/vgpool/lvstuff
df -h
 
mount -t xfs /dev/vgpool/lvstuff /mnt/data
 
 
  mkdir /mnt/data
 
  mkdir /mnt/data
 
  mount -t xfs /dev/vgpool/lvstuff /mnt/data
 
  mount -t xfs /dev/vgpool/lvstuff /mnt/data
 +
 +
Now check that the disk shows up and you can get to it
 
  df -h
 
  df -h
 
  cd /mnt/data/
 
  cd /mnt/data/
 +
 +
 +
You can use "pvdisplay" command to display the physical volumes now on the system

Latest revision as of 11:56, 23 November 2018

There are 3 steps to this. Create a partition Use fdisk to create your partitions. Use fdisk /dev/DISKID to do this. DISKS is generally something like sdb

fdisk /dev/sdb

Press "p" to print the partitions, there will be none on an empty disk

Press "n" to create a new partition

Create a primary partition on partition number 1 for a new disk. Accept defaults to use full disk for first and last cylinders.

Press "t" to change the type of the partition to 8e (Linux LVM)

Press "p" to double check the new parition and then press "w" to write the changes

Format partition

Create LVM disk pool

pvcreate /dev/sdb1
vgcreate vgpool /dev/sdb1
lvcreate -l 100%FREE -n lvstuff vgpool
mkfs -t xfs /dev/vgpool/lvstuff
mkdir /mnt/data
mount -t xfs /dev/vgpool/lvstuff /mnt/data

Now check that the disk shows up and you can get to it

df -h
cd /mnt/data/


You can use "pvdisplay" command to display the physical volumes now on the system