Creating New Logical Volumes on a Linux Server

At our company, we use Red Hat Enterprise Linux for our ERP system. The GUI allows us to have a friendly interface to manage Logical Volumes on the drives, however when doing bulk operations, it can be very clunky and tends to hang a lot.

Surely we can do this through the Terminal, no?



## Find our VG in order to add LVs

sudo lvm vgscan

## Create the actual LVs on the VG we found before

sudo lvm lvcreate -n lv_ERPtemp --size 10G vg_ERPdb
sudo lvm lvcreate -n lv_ERParch --size 10G vg_ERPdb
sudo lvm lvcreate -n lv_ERPredoa --size 10G vg_ERPdb
sudo lvm lvcreate -n lv_ERPredob --size 10G vg_ERPdb
sudo lvm lvcreate -n lv_ERPredoc --size 10G vg_ERPdb
sudo lvm lvcreate -n lv_ERPredod --size 10G vg_ERPdb
sudo lvm lvcreate -n lv_ERPdata --size 200G vg_ERPdb

## Format our newly created LVs

sudo mkfs.ext4 /dev/vg_ERPdb/lv_ERPdata
sudo mkfs.ext4 /dev/vg_ERPdb/lv_ERPtemp
sudo mkfs.ext4 /dev/vg_ERPdb/lv_ERParch
sudo mkfs.ext4 /dev/vg_ERPdb/lv_ERPredoa
sudo mkfs.ext4 /dev/vg_ERPdb/lv_ERPredob
sudo mkfs.ext4 /dev/vg_ERPdb/lv_ERPredoc
sudo mkfs.ext4 /dev/vg_ERPdb/lv_ERPredod

## Make the mount point targets

sudo mkdir /ERPdata  
sudo mkdir /ERPtemp
sudo mkdir /ERParch  
sudo mkdir /ERPredoa
sudo mkdir /ERPredob
sudo mkdir /ERPredoc
sudo mkdir /ERPredod

## Use mount to mount the LVs for the first time

sudo mount /dev/vg_ERPdb/lv_ERPdata /ERPdata  
sudo mount /dev/vg_ERPdb/lv_ERPtemp /ERPtemp
sudo mount /dev/vg_ERPdb/lv_ERParch /ERParch  
sudo mount /dev/vg_ERPdb/lv_ERPredoa /ERPredoa
sudo mount /dev/vg_ERPdb/lv_ERPredob /ERPredob
sudo mount /dev/vg_ERPdb/lv_ERPredoc /ERPredoc
sudo mount /dev/vg_ERPdb/lv_ERPredod /ERPredod

## Now, add the LVs to /etc/fstab to mount automatically at boot
## Copy these entries into the bottom of the /etc/fstab file using nano
## sudo nano /etc/fstab

/dev/vg_ERPdb/lv_ERPdata             /ERPdata           ext4    defaults        1 2
/dev/vg_ERPdb/lv_ERPtemp             /ERPtemp           ext4    defaults        1 2
/dev/vg_ERPdb/lv_ERParch             /ERParch           ext4    defaults        1 2
/dev/vg_ERPdb/lv_ERPredoa            /ERPredoa          ext4    defaults        1 2
/dev/vg_ERPdb/lv_ERPredob            /ERPredob          ext4    defaults        1 2
/dev/vg_ERPdb/lv_ERPredoc            /ERPredoc          ext4    defaults        1 2
/dev/vg_ERPdb/lv_ERPredod            /ERPredod          ext4    defaults        1 2

Comments

Popular Posts