Hard-disk : Add storage Volume ( add storage disk )
Partition : create partition (fdisk /dev/xvdf)
physical Volume : create physical Volume (pvcreate)
Volume Group : Create Volume Group (vgcreate)
Logical Volume : create Logical Volume (lvcreate)
File System : Create File system (mkfs.xfs )
Details Steps :
Add Storage :
[root@10.1.1.1]#
[root@10.1.1.1]# fdisk -l
Disk /dev/xvda: 60 GiB, 64424509440 bytes, 125829120 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
Disklabel type: gpt
Disk identifier: 2E431796-24CD-41A3-A4CB-7987FFF67072
Device Start End Sectors Size Type
/dev/xvda1 2048 4095 2048 1M BIOS boot
/dev/xvda2 4096 125829086 125824991 60G Linux filesystem
Disk /dev/xvdf: 10 GiB, 10737418240 bytes, 20971520 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
[root@10.1.1.1]#
[root@10.1.1.1]#
[root@10.1.1.1]#
[root@10.1.1.1]#
[root@10.1.1.1]#
Create Partition
[root@10.1.1.1]#
[root@10.1.1.1]# fdisk /dev/xvdf
Welcome to fdisk (util-linux 2.32.1).
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.
Created a new DOS disklabel with disk identifier 0x5c55f684.
Command (m for help): h
h: unknown command
Command (m for help): m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition
Misc
m print this menu
u change display/entry units
x extra functionality (experts only)
Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-20971519, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-20971519, default 20971519): +1G
Created a new partition 1 of type 'Linux' and of size 1 GiB.
Command (m for help): p
Disk /dev/xvdf: 10 GiB, 10737418240 bytes, 20971520 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
Disklabel type: dos
Disk identifier: 0x5c55f684
Device Boot Start End Sectors Size Id Type
/dev/xvdf1 2048 2099199 2097152 1G 83 Linux
Command (m for help): m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition
Misc
m print this menu
u change display/entry units
x extra functionality (experts only)
Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): L
0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 84 OS/2 hidden or c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi ea Rufus alignment
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD eb BeOS fs
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ee GPT
10 OPUS 55 EZ-Drive a7 NeXTSTEP ef EFI (FAT-12/16/
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f0 Linux/PA-RISC b
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f1 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f4 SpeedStor
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ f2 DOS secondary
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fb VMware VMFS
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fc VMware VMKCORE
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fd Linux raid auto
1c Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L fe LANstep
1e Hidden W95 FAT1 80 Old Minix be Solaris boot ff BBT
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'.
Command (m for help): p
Disk /dev/xvdf: 10 GiB, 10737418240 bytes, 20971520 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
Disklabel type: dos
Disk identifier: 0x5c55f684
Device Boot Start End Sectors Size Id Type
/dev/xvdf1 2048 2099199 2097152 1G 8e Linux LVM
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[root@10.1.1.1]#
[root@10.1.1.1]#
[root@10.1.1.1]#
check partiton
[root@10.1.1.1]# fdisk -l
Disk /dev/xvda: 60 GiB, 64424509440 bytes, 125829120 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
Disklabel type: gpt
Disk identifier: 2E431796-24CD-41A3-A4CB-7987FFF67072
Device Start End Sectors Size Type
/dev/xvda1 2048 4095 2048 1M BIOS boot
/dev/xvda2 4096 125829086 125824991 60G Linux filesystem
Disk /dev/xvdf: 10 GiB, 10737418240 bytes, 20971520 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
Disklabel type: dos
Disk identifier: 0x5c55f684
Device Boot Start End Sectors Size Id Type
/dev/xvdf1 2048 2099199 2097152 1G 8e Linux LVM
[root@10.1.1.1]#
[root@10.1.1.1]#
create physcial volume
[root@10.1.1.1]#
[root@10.1.1.1]#
[root@10.1.1.1]# pvcreate /dev/xvdf1
Physical volume "/dev/xvdf1" successfully created.
[root@10.1.1.1]#
[root@10.1.1.1]#
check physcial volume
[root@10.1.1.1]#
[root@10.1.1.1]# pvdisplay
"/dev/xvdf1" is a new physical volume of "1.00 GiB"
--- NEW Physical volume ---
PV Name /dev/xvdf1
VG Name
PV Size 1.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID Ef0Zb4-DPOx-eklk-3tNa-ZeXW-9bpK-z9smGG
[root@10.1.1.1]#
create volume group
[root@10.1.1.1]#
[root@10.1.1.1]#
[root@10.1.1.1]# vgcreate oracle_bkp /dev/xvdf1
Volume group "oracle_bkp" successfully created
[root@10.1.1.1]#
[root@10.1.1.1]#
check volume group
[root@10.1.1.1]#
[root@10.1.1.1]# vgdisplay oracle_bkp
--- Volume group ---
VG Name oracle_bkp
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 1020.00 MiB
PE Size 4.00 MiB
Total PE 255
Alloc PE / Size 0 / 0
Free PE / Size 255 / 1020.00 MiB
VG UUID ww4IMh-dnI7-04NQ-tIl1-4xqX-ayfG-1cVzGz
[root@10.1.1.1]#
create logical volume
[root@10.1.1.1]#
[root@10.1.1.1]# lvcreate -n oracle_bkp_lv --size 1000M oracle_bkp
Logical volume "oracle_bkp_lv" created.
[root@10.1.1.1]#
[root@10.1.1.1]#
[root@10.1.1.1]#
check logical volume
[root@10.1.1.1]#
[root@10.1.1.1]# lvdisplay
--- Logical volume ---
LV Path /dev/oracle_bkp/oracle_bkp_lv
LV Name oracle_bkp_lv
VG Name oracle_bkp
LV UUID BpJFNR-HgXY-Puu2-hzrI-656W-FrHa-7wskbT
LV Write Access read/write
LV Creation host, time ip-172-31-19-40.ec2.internal, 2023-05-24 22:58:27 +0530
LV Status available
# open 0
LV Size 1000.00 MiB
Current LE 250
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
[root@10.1.1.1]#
format filesystem partition logical volume with xfs
[root@10.1.1.1]# mkfs.xfs /dev/oracle_bkp/oracle_bkp_lv
meta-data=/dev/oracle_bkp/oracle_bkp_lv isize=512 agcount=4, agsize=64000 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1 bigtime=0 inobtcount=0
data = bsize=4096 blocks=256000, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=1566, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@10.1.1.1]#
create directory
[root@10.1.1.1]#
[root@10.1.1.1]#
[root@10.1.1.1]# mkdir /oracle_bkp
[root@10.1.1.1]#
mount logical volume
[root@10.1.1.1]#
[root@10.1.1.1]# mount /dev/oracle_bkp/oracle_bkp_lv /oracle_bkp
[root@10.1.1.1]#
[root@10.1.1.1]#
[root@10.1.1.1]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.8G 0 3.8G 0% /dev/shm
tmpfs 3.8G 17M 3.8G 1% /run
tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup
/dev/xvda2 60G 51G 9.8G 84% /
tmpfs 770M 0 770M 0% /run/user/0
/dev/mapper/oracle_bkp-oracle_bkp_lv 994M 40M 955M 4% /oracle_bkp
[root@10.1.1.1]#
[root@10.1.1.1]#
[root@10.1.1.1]#
[root@10.1.1.1]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 60G 0 disk
├─xvda1 202:1 0 1M 0 part
└─xvda2 202:2 0 60G 0 part /
xvdf 202:80 0 10G 0 disk
└─xvdf1 202:81 0 1G 0 part
└─oracle_bkp-oracle_bkp_lv 253:0 0 1000M 0 lvm /oracle_bkp
[root@10.1.1.1]#
[root@10.1.1.1]# blkid
/dev/xvda1: PARTUUID="3e18b896-4879-4ede-8711-a58017aff81c"
/dev/xvda2: UUID="c9aa25ee-e65c-4818-9b2f-fa411d89f585" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="b3824610-751c-49f8-a4a9-068fa13d9460"
/dev/xvdf1: UUID="Ef0Zb4-DPOx-eklk-3tNa-ZeXW-9bpK-z9smGG" TYPE="LVM2_member" PARTUUID="5c55f684-01"
/dev/mapper/oracle_bkp-oracle_bkp_lv: UUID="00478051-a51a-4a23-9b63-591a04822c38" BLOCK_SIZE="512" TYPE="xfs"
[root@10.1.1.1]#
[root@10.1.1.1]#
[root@10.1.1.1]#
[root@10.1.1.1]#
[root@10.1.1.1]# pvs
PV VG Fmt Attr PSize PFree
/dev/xvdf1 oracle_bkp lvm2 a-- 1020.00m 20.00m
[root@10.1.1.1]#