Linux reduced file system size LVM
(1) Operating system: centos6.7 i686
(2) VMware Workstation version 12
(3) Experimental hard disk size 5G
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/93/4C/wKioL1kJ5V3TVDr2AAAXmG3iAuY048.png "title=" 11. PNG "alt=" Wkiol1kj5v3tvdr2aaaxmg3iauy048.png "/>
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/93/4D/wKiom1kJ5szy6vmbAABIK_QIvYM445.png "title=" 11. PNG "alt=" Wkiom1kj5szy6vmbaabik_qivym445.png "/>
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/93/4C/wKioL1kJ5z_Q6mX-AAANM_x6f0g985.png "title=" 11. PNG "alt=" Wkiol1kj5z_q6mx-aaanm_x6f0g985.png "/>
(1) The main steps are as follows:
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/93/4E/wKiom1kJ596TSeZBAAAy81HzfBY629.png "title=" 11. PNG "alt=" Wkiom1kj596tsezbaaay81hzfby629.png "/>
(2) Formatting:
#mkfs. EXT4/DEV/VG_WTF/LV_WTF
(3) Mount:
#mkdir/WTF #建立挂载目录
#mount/DEV/VG_WTF/LV_WTF/WTF
(4) Check the current disk usage as follows:
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/93/4C/wKioL1kJ6VnRkQZRAAArVYaOPHA541.png "title=" 11. PNG "alt=" Wkiol1kj6vnrkqzraaarvyaopha541.png "/>
Note: It is recommended to write the new file system to the/etc/fstab configuration file!
(1) Uninstalling/WTF
Command: #umount/WTF
(2) resizing the partition
[Email protected] ~]# resize2fs-p/DEV/VG_WTF/LV_WTF 2G
If prompted: "Please run ' e2fsck-f/dev/vg_wtf/lv_wtf ' first." The
[Email protected] ~]# e2fsck-f/DEV/VG_WTF/LV_WTF
As follows:
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/93/4D/wKioL1kJ66eARAI0AAAwFJT39mk348.png "title=" 11. PNG "alt=" Wkiol1kj66earai0aaawfjt39mk348.png "/>
[Email protected] ~]# resize2fs-p/DEV/VG_WTF/LV_WTF 2G
As follows:
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/93/4D/wKioL1kJ7BLyNOVrAAAuVUto9Vw126.png "title=" 11. PNG "alt=" Wkiol1kj7blynovraaauvuto9vw126.png "/>
(3) Mount the/WTF to view disk usage
[Email protected] ~]# MOUNT/DEV/VG_WTF/LV_WTF/WTF
[Email protected] ~]# df-h
As follows:
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/93/4E/wKiom1kJ7RjzW6F8AAAkGuYB-2Y818.png "title=" 11. PNG "alt=" Wkiom1kj7rjzw6f8aaakguyb-2y818.png "/>
However, when using VGS to view the remaining capacity, the display is still 0, as follows:
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/93/4D/wKioL1kJ7cCzk3KDAAANAxMWBE8289.png "title=" 11. PNG "alt=" Wkiol1kj7cczk3kdaaanaxmwbe8289.png "/>
(4) Set free space
Use the Lvreduce directive to reduce the amount of space that LVM logical volumes occupy. Data already on the logical volume may be deleted, so before the operation
Confirmation must be made. Remember to enter "Y"!
[Email protected] ~]# lvreduce-l 2G/DEV/VG_WTF/LV_WTF
As follows:
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/93/4F/wKiom1kJ7uXiOv-9AAAu9Mgo6ts815.png "title=" 11. PNG "alt=" Wkiom1kj7uxiov-9aaau9mgo6ts815.png "/>
Note:
1) lvreduce-l 20G means to set the current file system to 20G if lvreduce-l 20G refers to reducing 20G from the current file system.
2) Use Lvreduce to reduce the size of the logical volume, smaller than the size of the file, or the data will be lost.
(5) View VGS remaining capacity again
[Email protected] ~]# VGS
As follows:
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/93/4F/wKiom1kJ76ehc4hSAAAQ5u6dIGg997.png "title=" 11. PNG "alt=" Wkiom1kj76ehc4hsaaaq5u6digg997.png "/>
This article is from the "Hand of the Paladin Control" blog, please make sure to keep this source http://wutengfei.blog.51cto.com/10942117/1921780
Linux reduced file system size LVM