Centos:How to add newly created logical volume into fstab

When you create a Logical volume , you need to add it into /etc/fstab file for it to stay as mounted when server reboot.
suppose you have create a logical volume like bellow

  --- Logical volume ---
  LV Name                /dev/POSREP-DB/DB
  VG Name                POSREP-DB
  LV UUID                0IEKZw-tEoI-jJWt-OGXT-F0B7-hEic-hCbteW
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                1.17 GB
  Current LE             300
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

now you’ll need to set the label for this directory with the following command:

# e2label /dev/POSREP-DB/DB  DB

Now add this one into /etc/fstab

LABEL=DB                /DB                     ext3    defaults        0 1

at last, create a directory with bellow command

mkdir /DB

now if you reboot the server , the logical volument will be mounted automatically in /DB directory.

Leave a Reply

Your email address will not be published. Required fields are marked *