Resize CentOS Linux Hard Drive partition (CentOS 6.3 tuning LVS disk size)

Source: Internet
Author: User

To view current disk information:

[Email protected] ~]# df-h

file system capacity has been used with available percent mount points
/dev/mapper/volgroup-lv_root
154G 7.9G 139G 6%/
tmpfs 1.9G 100K 1.9G 1%/dev/shm
/dev/sda1 485M 69M 391M 15%/boot
/dev/mapper/volgroup-lv_home

299G 984M 283G 1%/Home

Reduce the Volgroup-lv_home to 20G and add the remaining space to the Volgroup-lv_root

Uninstall/Home First:

[Email protected] ~]# Umount/home
[Email protected] ~]# e2fsck-f/dev/mapper/volgroup-lv_home
E2fsck 1.41.12 (17-may-2010)
First step: Check Inode, block, and size
Step Two: Check the directory structure
3rd Step: Check the directory connectivity
Pass 4:checking Reference counts
5th Step: Check Cluster summary information
/dev/mapper/volgroup-lv_home:21/19857408 files (0.0% non-contiguous), 1498180/79429632 blocks

Note: e2fsck to check for disk correctness

[[email protected] ~]# resize2fs-p/dev/mapper/volgroup-lv_home 20G

RESIZE2FS 1.41.12 (17-may-2010)
resizing the filesystem on/dev/mapper/volgroup-lv_home to 5242880 (4k) blocks.
begin pass 2 (max = 32778)
relocating blocks              xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
begin Pass 3 (max = 2424)
begin pass 4 (max = ten)
the filesystem on/dev/mapper/volgroup-lv_home is now 5242880 blocks long.

note: resize2fs to reset the disk size, just re-specify the size, do not affect the results, you need the following lvreduce mate


[[email protected] ~]# mount/home
[
[[email protected] ~]# lvreduce-l 20g/dev/mapper/volgroup-lv_home
  WARNING: Reducing active and open logical volume to 20.00 gib
  This May DESTROY YOUR DATA (filesystem etc.)
do you really want to reduce lv_home? [y/n]: y
  reducing Logical Volume Lv_home to 20.00 gib
  Logical Volume Lv_home successfully resized

Note: lvreduce-l 20G means to set the current file system to 20G, if lvreduce-l 20G refers to the reduction of 20G from the current file system

[Email protected] ~]# df-h
File system capacity has been used with available percent mount points
/dev/mapper/volgroup-lv_root
154G 7.9G 139G 6%/
Tmpfs 1.9G 100K 1.9G 1%/DEV/SHM
/DEV/SDA1 485M 69M 391M 15%/boot
/dev/mapper/volgroup-lv_home
20G 962M 18G 6%/Home (description succeeded)


[Email protected] ~]# Vgdisplay
---Volume Group---
VG Name VolGroup
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 7
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 46660/182.27 GiB
Free Pe/size 72449/283.00 GiB
VG UUID Gpa8xs-znck-mgqj-2vn9-tftq-6you-6atje9

Note: Vgdisplay to display metadata information for an LVM volume group


[Email protected] ~]# lvextend-l +283g/dev/mapper/volgroup-lv_root
Extending logical Volume Lv_root to 439.39 GiB
Logical Volume Lv_root successfully resized

Note: lvextend-l +283g adds 238G to the file system


[Email protected] ~]# resize2fs-p/dev/mapper/volgroup-lv_root
RESIZE2FS 1.41.12 (17-may-2010)
Filesystem at/dev/mapper/volgroup-lv_root is mounted on/; On-line resizing required
Old desc_blocks = ten, new_desc_blocks = 28
Performing an on-line resize of/dev/mapper/volgroup-lv_root to 115183616 (4k) blocks.
The filesystem on/dev/mapper/volgroup-lv_root is now 115183616 blocks long.


Check the results of the adjustment:

[email protected] ~]# df-h
file system capacity has been used with available percent mount points
/dev/mapper/volgroup-lv_root
433G 7.9G 403G 2%/
tmpfs 1.9G 100K 1.9G 1%/dev/shm
/dev/sda1 485M 69M 391M 15%/boot
/dev/mapper/volgroup-lv_home
20G 962M 18G 6% /Home


Resize CentOS Linux hard Drive partition (CentOS 6.3 tuning LVS disk size)

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.