Create a
physical volume in Linux using LVM
PURPOSE: All documents are provided on this Blog just for educational purposes only. Please make sure that you run it in your test environment before to move on to production environment.
Step 1:
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x33399fd3.
Command (m for help): p
Disk /dev/sdd: 1099.5 GB, 1099511627776 bytes, 2147483648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x33399fd3
Device Boot Start End Blocks Id System
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-2147483647, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2147483647, default 2147483647):
Using default value 2147483647
Partition 1 of type Linux and of size 1024 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Step
2:
LVM
pvdisplay
pvs
vgcreate vg_db /dev/sdb1
lvcreate --name lv_db -l 100%FREE vg_db
mkfs.xfs /dev/mapper/vg_db-lv_db
mkdir /oracle
mount /dev/mapper/vg_db-lv_db /oracle
Add the entry in the fstab file.
vi /etc/fstab
vi /etc/fstab
dev/mapper/vg_db-lv_db / oracle xfs defaults 0 0