Creating LVM Partition on a newly added HDD Drive
Creating LVM Partition on a newly added
HDD
We are going to follow the step-by-step procedures
mentioned in the picture.
Step 1: Insert physical internal HDD into the server.
#fdisk -l ( use this command to list the added HDDs)
Make sure that added HDD is replicating in the server.
#fdisk /dev/sdb ( use this path to enter into the sdb HDD)
ü once get into the
path à let’s do the partition on the dev/sdb HDD
ü (click on the below
link to get the step-by-step config details for the disk partition)
ü https://cloudtinesh.blogspot.com/2023/01/how-to-partition-and-mount-file-system.html)
Step 2: Creating Partition to the newly added HDD
ü As mentioned in the above chart we
have created the partition in the name of
/dev/sdb1.
ü While creating itself we have to
check whether the system format is in Linux LVM or some other format.
ü If its system is in some other format
needs to change the format as a Linux LVM.
Hence kindly
follow the below steps to convert Linux LVM format :
# m (Enter the command for the help)
# t (Enter the option to change
a Partition’s system id)
# t ( Once the option is entered you
get the output like Selected Partition
1)
Here u can see yellow marked;
enter L (command to list all Hex-codes)
# 8e (option to select Linux LVM format)
Now format has been changed to Linux LVM
# w (Enter the command to save the above
changes)
Step 3:
Creating Physical Volume:
# pvcreate /dev/sdb1 (enter this command to create a physical volume on the /dev/sdb1
partition)
Once create u will get the messages like below one.
#pvdispaly (Enter the command to display Physical Volume just now you created)
Now u have created PV on dev/sdb1.
Step 4:Creating Volume Group
# vgcreate example_vg (need to provide volume group name) /dev/sdb1
(partitioned path)
#vgdisplay example_vg (vg name) which you given
Step 5 : Creating Logical Volume
#lvcreate -n example_lv - -size 3.6TB example_vg
(Enter a command to create a logical
volume(similar kind of name which you have given before for the vg to identify easily)
--size needs to provide based on
your HDD and vg group name )
Once the above config is done you can see the message like
LV is created.
#lvdisplay (Enter a command to
verify you have created the LV)
(Here itself you can verify the LV
Path, LV Name, and VG Name)
#mkfs.xfs /dev/example_vg/example_lv (enter a command to create a file system). While creating a file system you
need to provide a volume group name and logical volume name(which you created in the server)
Till now we have
followed the step-by-step configuration
and configured LVM on HDD
Step 6: mounting File System to Mount
point
Before mounting the file system, we need to create a
directory
Note: In my server, I have created a directory named
popular_backup under /home
#mount /dev/pop_vg/pop_lv /home/popular_backup
(Enter the command with the /dev/vg
name/lv name(which you gave and mount point)
Before mounting the
file system on the mount point
After
mounting the file system on the mount point
Once the file system is mounted in the mounting point.
Note: you should update the mounting details in the fstab directory like the below snap.
Otherwise
when you reboot the server-mounted point will be unmounted to avoid this need updated in fstab file.
#vi /etc/fstab
/dev/pop_vg/pop_lv /home/popular_callrecord_backup xfs defaults 0 0
Comments
Post a Comment