learnitprofession.com Provide technical solutions in Linux, Windows, VMware, macOS and Many More.
Reduce Logical Volume Size on Debian
Get link
Facebook
Twitter
Pinterest
Email
Other Apps
Reduce Logical Volume Size on Debian/CentOS/RedHat
Reduce the logical volume size is not a good practice in terms of data therefore if you want to reduce the logical volume size must take the backup of data. Here we are reducing the size of logical volume "home" in Debian 9.8, you can also use this process on CentOS and RedHat.
To Check the complete details of Debian version, type the below mention command.
cat /etc/os-release
To check how many users available in home directory first use command "cd" to enter in the directory "home" then use command "ls" to list the available users in directory "home".
cd /home
ls
In the above image you can see that only user "debian9" is available in directory "home".
For switch from user "root" to user "debian9", type the below mention command.
su debian9
Create a text file from user "debian9" by use of command "touch", this is because check the data will available after the reduce size of logical volume "home".
Note: Default directory of every Linux users is "home".
touch book
To check the size of logical volume "home", other logical volumes and fixed volumes. Type the below mention command.
df -hT
Note: In the above image you can see that Here volume group is "NEWLVMGROUP".
To check the size of logical volumes only, type the below mention command.
lvs
Here we are reducing the size of logical volume "home". To reduce the size of logical volume "home" first unmount it. For unmount the logical volume "home", type the below mention command.
umount -v /home
In the above image you can see logical volume "home" has unmount. Type the below mention command to verify.
df -hT
To check the file system error of logical volume "home", type the below mention command. After unmount it is necessary to check file system error of logical volume "home".
e2fsck -ff /dev/NEWLVMGROUP/home
In the above image you can see that logical volume "home" file system have no error after unmount.
Here we are reducing size of logical volume "home" from 4.6GB to 3GB.
First resize logical volume "home", type the below mention command.
resize2fs /dev/NEWLVMGROUP/home 3G
Second reduce the size of Logical volume "home" 1.66GB because as per calculation 4.6GB-3GB=1.66GB, type the below mention command for reducing the size of logical volume "home".
lvreduce -L -1.66G /dev/NEWLVMGROUP/home
After reduce the size of logical volume "home", resize logical volume "home". The purpose of use this command to check the file system error in logical volume "home", If error occur it means some mistakes has perform during the process.
resize2fs /dev/NEWLVMGROUP/home
After complete the process mount the logical volume "home".
mount /dev/NEWLVMGROUP/home /home
To check logical volume "home" has successfully mounted, type the below mention command.
df -hT
To check the size of logical volume "home", type the below mention command.
Comments
Post a Comment