In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Adjust the disk size under Linux and expand the partition capacity online. The premise is that LVM does not add new LV (alas, obsessive-compulsive disorder occurs again). It is mainly used to:
After the partition of mounting SAN increases the capacity of LUN, the capacity of system partition increases correspondingly after the disk capacity of virtual machine increases.
Assume that the disk to be adjusted is / dev/sda, install centos with lvm, and adopt the default partition of the system.
PV:/dev/sda3VG:/dev/centos-testLV:/dev/centos-test/root and / dev/centos-test/swap
If the LUN is mounted remotely, please mount the umount partition first.
STEP1 scan disk changes # partprobeSTEP2 uses parted to adjust partition capacity
Run parted to enter partition management mode
# parted
Use print all to view the adjusted hard disk size (for example, the adjusted maximum capacity is 21.5GB)
(parted) print all...Disk / dev/sda: 21.5 GB.
Because the physical disk has changed, follow the prompts to perform the 'fix' operation.
Resizepart resizing
(parted) resizepartPartition number? 3 # Select the partition number (Number) here, that is, Flags is the Number of the lvm tag, and here is 3End? [15GB] 21.5GB # enter the new end position here, such as 21.5GB. (parted) quitSTEP3 resize the LVM physical volume # pvresize / dev/sda3
/ dev/sda3 is the physical volume corresponding to the volume group that needs to be expanded
STEP4 resizes LVM logical volumes # lvresize-l + 100%FREE / dev/centos-test/root
Description:
-l: it is adjusted according to the PE block, especially when partitioning by capacity, all idle PE can be used as much as possible.
100%FREE: use all the remaining free space
/ dev/centos-test/root: is a logical volume created and can be viewed using lvdisplay.
STEP5 resize the file system # resize2fs / dev/centos-test/root
The following command is recommended for the xfs file system
# xfs_growfs / dev/centos-test/root add that the command for LVM to resize logical volumes for ext2/ext3/ext4 file systems is resize2fs (both increase and decrease are supported)
Lvextend-L 120g / dev/mapper/centos-home / / increased to 120g
Lvextend-L + 20g / dev/mapper/centos-home / / add 20g
Lvreduce-L 50G / dev/mapper/centos-home / / reduced to 50G
Lvreduce-L-8G / dev/mapper/centos-home / / minus 8G
Resize2fs / dev/mapper/centos-home / / perform adjustments
The tuning command for the xfs file system is xfs_growfs (only growing is supported)
Lvextend-L 120g / dev/mapper/centos-home / / increased to 120g
Lvextend-L + 20g / dev/mapper/centos-home / / add 20g
Xfs_growfs / dev/mapper/centos-home / / perform adjustments
Note: if you want to reduce the xfs partition, you can only mount the logical partition by reformatting it through the mkfs.xfs command after the reduction, so that the original data on the logical partition will be lost.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.