Add New Logical Volume

From LUG
Revision as of 12:46, 3 January 2018 by Dawes001 (talk | contribs) (Created page with "First, you must have a block device available to you. In this example we will use /dev/mapper/data01, but equally well this could be /dev/sdb or /dev/mmcblk0p1. First, conver...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

First, you must have a block device available to you. In this example we will use /dev/mapper/data01, but equally well this could be /dev/sdb or /dev/mmcblk0p1.

First, convert it into a Physical Volume:

# pvcreate /dev/mapper/data01

Next, we will create a new Volume Group called Vdata to contain this PV:

# vgcreate Vdata01 /dev/mapper/data01

Lastly, we will create a simple Logical Volume in this VG called Ldata. It will be the maximum available size.

# lvcreate -n Ldata01 -l 100%FREE Vdata01

Excellent. Format this to your preferred filesystem (here, ext4):

# mkfs.ext4 /dev/Vdata01/Ldata01

Then create a mountpoint for this filesystem:

# mkdir /databases/data01

Set the correct permissions at the mount point:

# chown oracle:dba /databases/data01

# chmod 770 /databases/data01

# chmod +s /databases/data01

Edit /etc/fstab So that the filesystem will be mounted on boot:

# vi /etc/fstab

/dev/Vdata01/Ldata01 /databases/data01 ext4 defaults 1 2

Then you can test (and mount) this with:

# mount -a