大网数据广告活动
服务器运维问答

Resize Centos 7 Root partition set up as xfs file system.

· 52CE 我爱测

I am trying to resize the root partition folder from 50GB to 750GB. I have already increase the size of the drive. If I do an fdisk on /dev/sda and delete partition 2 and then recreate it the /dev/sda2 is resized correctly showin…

问题原文

原帖链接 · Tim R · CC BY-SA 3.0

I am trying to resize the root partition folder from 50GB to 750GB. I have already increase the size of the drive. If I do an fdisk on /dev/sda and delete partition 2 and then recreate it the /dev/sda2 is resized correctly showing 999GB. When I then try to do a vgextend it gives an error saying, "can't open dev sda2 exclusively. mounted filesystem?" How can I increase the size of the root LVM partition? I attached screenshots of the different outputs for reference.

If I run: lvextend -l +100%FREE /dev/centos/root It tells me it expanding from 50Gb to 50Gb.

df -h output

df -T output

lsblk output

lvdisplay output

pvdisplay output

vgdisplay output

pvs vgs & lvs output

已采纳解答

原帖链接 · Satanicpuppy · CC BY-SA 3.0

You're doing two different methods of resizing the drive.

If your drive was just a filesystem sitting on a partition, you could extend the drive, delete the partition, recreate the larger partition, and then just extend the filesystem with xfs_growfs. That's how it was done in the old days, before LVM.

You're using logical volumes though, which means you have defined physical devices, volume groups, logical volumes, etc. The easiest way to extend that would have been to create a new partition, create a new physical device from that, add it to the volume group, then do the lvextend/xfs_growfs. Here is a more thorough how-to for that.

You're kind of split down the middle here, but it's fixable. You need to pvresize to fix the size of the physical volume: it's not showing the full size of the 750GB you've allocated to it. That should increase the free space in your volume group, and then you can extend the volume.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-04-26)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。