Create volume group in Linux

1. If creating the volume group from scratch, verify which disk to use to create the volume group. (note: Assuming that disk has already been added)

# fdisk -l

Disk /dev/sdb doesn’t contain a valid partition table.

2. Create the partition inside the added disk and verify.

# cfdisk /dev/sdb
# fdisk -l

3. Create the physical volume with pvcreate and verify using pvdisplay

# pvcreate /dev/sdb1
# pvdisplay /dev/sdb1

4. Create the volume group using vgcreate and verify with vgdisplay.

# vgcreate new_vg /dev/sdb1
# vgdisplay

If adding disk with more than one partition

# vgcreate new_vg /dev/sdb1 /dev/sdb2
# vgdisplay

Advertisements

Extend filesystem in Linux

Verify free space in volume group.

# vgdisplay appvg

Extend the filesystem with 50Gb of space

# lvextend -L +50G /dev/mapper/appvg-backup

Resize the filesystem to expand the actual size online and verify.

# resize2fs /dev/mapper/appvg-backup
# df -kh /dev/mapper/appvg-backup

Create filesystem in Linux

1. Create the logical volume (devdba) with 2Gb size in volume group appvg.
# lvcreate -n devdba -L 2G appvg

2. Create the filesystem
# mkfs.ext3 /dev/appvg/devdba

3. Modify the fstab
# vi /etc/fstab

add this in /etc/fstab

/dev/appvg/devdba      /opt/devdba            ext3    defaults        1 2

4. Create the mount point and mount.
# mkdir /opt/devdba ; mount /opt/devdba

5. Modify ownership.
# chown oracle:dba /opt/devdba