Querry size of the disk
root@lnx03 ~]# df -H
Filesystem Size Used Avail Use% Mounted on
devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs 876M 0 876M 0% /dev/shm
tmpfs 351M 8.1M 343M 3% /run
/dev/mapper/rhel_unknown-root 12G 2.7G 9.3G 23% /
/dev/nvme0n1p2 1014M 243M 772M 24% /boot
/dev/nvme0n1p1 599M 7.0M 592M 2% /boot/efi
tmpfs 176M 4.0K 176M 1% /run/user/0
/dev/mapper/project01-dockerdemo 10G 104M 9.9G 2% /demo-fs01
Check for all the physical volumes in use
pvscan
List all Hard drives on a System
lsblk
Create Physical Volume (PV) from spare disks
root@lnx03 ~]# pvcreate /dev/sda /dev/sdb /dev/sdc
Physical volume "/dev/sda" successfully created.
Physical volume "/dev/sdb" successfully created.
Physical volume "/dev/sdc" successfully created.
[root@lnx03 ~]#
Display the PVs you have created
[root@lnx03 ~]# pvs
Devices file sys_wwid eui.0a9147b659350724000c296de3efb17c PVID yHDg1nLoW8Jg3iwNtMHkj3WatmRFlfwb last seen on /dev/nvme0n1p3 not found.
PV VG Fmt Attr PSize PFree
/dev/sda project01 lvm2 a-- <5.30g 0
/dev/sdb project01 lvm2 a-- <5.10g 404.00m
/dev/sdc project01 lvm2 a-- <5.20g <5.20g
[root@lnx03 ~]#
Creating a volume group with three PV’s
vgcreate project_ansible_vg /dev/sde /dev/sdf /dev/sdg
Display the status of the volume group
[root@lnx03 ~]# vgs
Devices file sys_wwid eui.0a9147b659350724000c296de3efb17c PVID yHDg1nLoW8Jg3iwNtMHkj3WatmRFlfwb last seen on /dev/nvme0n1p3 not found.
VG #PV #LV #SN Attr VSize VFree
project01 3 1 0 wz--n- <15.59g <5.59
root@lnx03 ~]# vgdisplay -v project01
Devices file sys_wwid eui.0a9147b659350724000c296de3efb17c PVID yHDg1nLoW8Jg3iwNtMHkj3WatmRFlfwb last seen on /dev/nvme0n1p3 not found.
--- Volume group ---
VG Name project01
System ID
Format lvm2
Metadata Areas 3
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 3
Act PV 3
VG Size <15.59 GiB
PE Size 4.00 MiB
Total PE 3991
Alloc PE / Size 0 / 0
Free PE / Size 3991 / <15.59 GiB
VG UUID EWRGZq-tLd4-7xwJ-3ykG-9NMF-8rfc-YjQhQ9
--- Physical volumes ---
PV Name /dev/sda
PV UUID 22yl88-9DaG-eAaK-2OIO-3i1o-NOuP-YZmyQF
PV Status allocatable
Total PE / Free PE 1356 / 1356
PV Name /dev/sdb
PV UUID 2CRcdu-q9GK-73Cb-D1rD-ix9l-BZRu-02OqtP
PV Status allocatable
Total PE / Free PE 1305 / 1305
PV Name /dev/sdc
PV UUID i6ie94-1eg7-ygm9-kbdq-qPST-bPlg-zqjQ5t
PV Status allocatable
Total PE / Free PE 1330 / 1330
Creating logical volumes
[root@lnx03 ~]# lvcreate -L +10g -n dockerdemo project01
Logical volume "dockerdemo" created.
Display the status of the logical volume
[root@lnx03 ~]# lvs
Devices file sys_wwid eui.0a9147b659350724000c296de3efb17c PVID yHDg1nLoW8Jg3iwNtMHkj3WatmRFlfwb last seen on /dev/nvme0n1p3 not found.
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
dockerdemo project01 -wi-a----- 10.00g
root@lnx03 ~]# lvdisplay -v /dev/project01/dockerdemo
Devices file sys_wwid eui.0a9147b659350724000c296de3efb17c PVID yHDg1nLoW8Jg3iwNtMHkj3WatmRFlfwb last seen on /dev/nvme0n1p3 not found.
--- Logical volume ---
LV Path /dev/project01/dockerdemo
LV Name dockerdemo
VG Name project01
LV UUID 3W2aec-Q943-ckLt-yI5v-5xtu-BFIn-Q0X0Mf
LV Write Access read/write
LV Creation host, time lnx03, 2023-10-26 09:52:59 +0100
LV Status available
# open 0
LV Size 10.00 GiB
Current LE 2560
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2
Creating an ext4 filesystem
mkfs -t ext4 /dev/project01/dockerdemo
Creating an XFS filesystem
[root@lnx03 ~]#
[root@lnx03 ~]# mkfs.xfs /dev/project01/dockerdemo
meta-data=/dev/project01/dockerdemo isize=512 agcount=4, agsize=655360 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1 bigtime=1 inobtcount=1
data = bsize=4096 blocks=2621440, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
Mount the filesystem
root@lnx03 ~]# mkdir /demo-fs01
root@lnx03 ~]# mount /dev/project01/dockerdemo /demo-fs01/
Add an entry to fstab
[root@lnx03 ~]# tail -2 /etc/fstab
/dev/project01/dockerdemo /demo-fs01 xfs defaults 0 0
Checking if the filesystem is mounted
[root@lnx03 ~]# mount -av
/ : ignored
/boot : already mounted
/boot/efi : already mounted
none : ignored
/demo-fs01 : already mounted
[root@lnx03 ~]#
(Visited 4 times, 1 visits today)