When using the CentOS6.3 version Linux system, found that the root directory (/) of the space is not sufficient, and other directory space has a lot of free, so this article is mainly for the existing space to adjust. First, let's look at the space allocation of the system:
[Plain] View plaincopyprint?
01.[root@centos-78/]# df-h
02.Filesystem Size Used avail use% mounted on
03./dev/mapper/vg_centos-lv_root
50G 14G 34G 30%/
05.tmpfs 1.9G 0 1.9G 0%/dev/shm
06./DEV/SDA1 485M 37M 423M 8%/boot
07./dev/mapper/vg_centos-lv_home
404G 670M 382G 1%/home
The following detailed steps section will remove 100G of space from the Vg_centos-lv_home partition and add it to the/vg_centos-lv_root partition.
Second, detailed steps
1. Uninstall Vg_centos-lv_home partition
[Plain] View plaincopyprint?
01.[root@centos-78/]# Umount/home
At this point in the DF command to see that the/home directory has been seen, as follows:
[Plain] View plaincopyprint?
01.[root@centos-78/]# resize2fs-p/dev/mapper/vg_centos-lv_home 282G
02.RESIZE2FS 1.41.12 (17-may-2010)
03.Please Run ' e2fsck-f/dev/mapper/vg_centos-lv_home '.
This step to set the Vg_home-lv_home size did not succeed, the system prompts us to run the following command, the operation is as follows:
[Plain] View plaincopyprint?
01.[root@centos-78/]# e2fsck-f/dev/mapper/vg_centos-lv_home
02.e2fsck 1.41.12 (17-may-2010)
03.Pass 1:checking inodes, blocks, and sizes
04.Pass 2:checking directory structure
05.Pass 3:checking Directory Connectivity
06.Pass 4:checking Reference counts
07.Pass 5:checking Group summary Information
08./dev/mapper/vg_centos-lv_home:1386/26836992 files (0.9% non-contiguous), 1855856/107344896 blocks
To reset the Vg_home-lv_home size:
[Plain] View plaincopyprint?
01.[root@centos-78/]# Mount/home
02.[root@centos-78/]#
03.[root@centos-78/]# df-h
04.Filesystem Size Used avail use% mounted on
05./dev/mapper/vg_centos-lv_root
50G 14G 34G 30%/
07.tmpfs 1.9G 0 1.9G 0%/dev/shm
08./DEV/SDA1 485M 37M 423M 8%/boot
09./dev/mapper/vg_centos-lv_home
278G 663M 263G 1%/home
11.[root@centos-78/]#
3, reduce the lv_home logical partition to the specified size
[Plain] View plaincopyprint?
01.[root@centos-78/]# lvreduce-l 282g/dev/mapper/vg_centos-lv_home
Warning:reducing Active and open logical volume to 282.00 GiB
This May DESTROY YOUR DATA (filesystem etc.)
04.Do you really want to reduce lv_home? [y/n]: Y
Reducing logical volume Lv_home to 282.00 GiB
Logical Volume Lv_home successfully resized
07.[root@centos-78/]#
I think this command is to take the reduced 100G space to the system public area, can be loaded and used by other partitions.
To query the volume Group for information:
[Plain] View plaincopyprint?
01.[root@centos-78/]# Vgdisplay
---Volume Group---
, VG Name Vg_centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 5
-VG Access Read/write
-VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
ACT PV 1
VG Size 465.27 GiB
PE Size 4.00 MiB
Total PE 119109
Alloc pe/size 86472/337.78 GiB
Free Pe/size 32637/127.49 GiB
VG UUID 1k4oon-rfv9-uyf1-umyf-aerg-yags-znosd6
The free pe/size designation should be now available in the allocated space.
4, increase the size of the Vg_centos-lv_root partition
Add the available space to the Vg_centos-lv_root partition:
[Plain] View plaincopyprint?
01.[root@centos-78/]# lvextend-l +127.40g/dev/mapper/vg_centos-lv_root
Rounding up size to full physical extent 127.40 GiB
Extending logical Volume Lv_root to 177.40 GiB
Logical Volume Lv_root successfully resized
05.[root@centos-78/]#
To reset the size of the partition:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.