Centos:将未经过处理的空间添加到root

时间:2017-08-11 13:54:06

标签: centos space partitioning

我的主分区安装在/是14GB。 相同的驱动器具有额外的47 GB的免费未分区空间。 如何将空间添加到根分区?

非常感谢你的帮助。

df -h输出:

[root@dev-dla /]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 14G 13G 968M 94% / devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 1.9G 8.5M 1.9G 1% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/sdb1 99G 9.2G 85G 10% /data /dev/sda1 497M 255M 243M 52% /boot tmpfs 380M 0 380M 0% /run/user/1294246044

lsblk输出:

[root@dev-dla /]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 60G 0 disk ├─sda1 8:1 0 500M 0 part /boot └─sda2 8:2 0 15.5G 0 part ├─centos-root 253:0 0 13.9G 0 lvm / └─centos-swap 253:1 0 1.6G 0 lvm [SWAP] sdb 8:16 0 100G 0 disk └─sdb1 8:17 0 100G 0 part /data sr0 11:0 1 1024M 0 rom parted print free output:

(parted) print free Model: VMware Virtual disk (scsi) Disk /dev/sda: 64.4GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 32.3kB 1049kB 1016kB Free Space 1 1049kB 525MB 524MB primary xfs boot 2 525MB 17.2GB 16.7GB primary lvm 17.2GB 64.4GB 47.2GB Free Space

1 个答案:

答案 0 :(得分:1)

自己找到答案。花了一会儿。解决方案如下:

创建分区: [$]# fdisk /dev/sda Command (m for help): n Partition type: p primary (2 primary, 0 extended, 2 free) e extended Select (default p): p Partition number (3,4, default 3): 3 First sector (33554432-125829119, default 33554432): Using default value 33554432 Last sector, +sectors or +size{K,M,G} (33554432-125829119, default 125829119): Using default value 125829119 Partition 3 of type Linux and of size 44 GiB is set Command (m for help): w The partition table has been altered!

初始化分区: [$]# pvcreate /dev/sda3

扩展音量: [$]# vgextend centos /dev/sda3

扩展分区: [$]# lvextend /dev/centos/root /dev/sda3

调整分区大小: [$]# xfs_growfs /dev/centos/root