使用parted命令为磁盘扩容
4、现在磁盘和分区的大小已经扩容了,但是当我们使用df命令查看时,分区的容量还是5T,因此我们还需要刷新文件系统的大小。3、在虚拟机中扩容磁盘后,需要重新启动虚拟机。重启虚拟机后我接下来将为/dev/sdc1分区进行扩容。2、在虚拟机管理界面中将sdc磁盘扩容至7T。
·
1、查看现有磁盘大小:
root@inboc-nfs:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 16G 0 16G 0% /dev
tmpfs 3.2G 1.2M 3.2G 1% /run
/dev/sda4 195G 4.7G 191G 3% /
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sdc1 5.0T 4.8T 228G 96% /mnt
/dev/sdb1 10T 2.8T 7.3T 28% /srv
/dev/sda2 1014M 180M 835M 18% /boot
tmpfs 3.2G 0 3.2G 0% /run/user/0
2、在虚拟机管理界面中将sdc磁盘扩容至7T
3、在虚拟机中扩容磁盘后,需要重新启动虚拟机。重启虚拟机后我接下来将为/dev/sdc1分区进行扩容
root@inboc-nfs:~# parted /dev/sdc
GNU Parted 3.2
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Warning: Not all of the space available to /dev/sdc appears to be used, you can fix the GPT to use all of the space (an extra 4294967296 blocks) or continue with the current setting?
Fix/Ignore? ^C
Model: VMware Virtual disk (scsi)
Disk /dev/sdc: 7697GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 5498GB 5498GB xfs Linux filesystem
(parted) resizepart 1
Warning: Partition /dev/sdc1 is being used. Are you sure you want to continue?
Yes/No? yes
End? [7397GB]? 7697GB
(parted) p
Model: VMware Virtual disk (scsi)
Disk /dev/sdc: 7697GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 7697GB 7697GB xfs Linux filesystem
4、现在磁盘和分区的大小已经扩容了,但是当我们使用df命令查看时,分区的容量还是5T,因此我们还需要刷新文件系统的大小
root@inboc-nfs:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 16G 0 16G 0% /dev
tmpfs 3.2G 1.2M 3.2G 1% /run
/dev/sda4 195G 4.7G 191G 3% /
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sdc1 5.0T 4.8T 228G 96% /mnt
/dev/sdb1 10T 2.8T 7.3T 28% /srv
/dev/sda2 1014M 180M 835M 18% /boot
tmpfs 3.2G 0 3.2G 0% /run/user/0
root@inboc-nfs:~# xfs_growfs /dev/sdc1
meta-data=/dev/sdc1 isize=512 agcount=5, agsize=268435455 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1 spinodes=0 rmapbt=0
= reflink=0
data = bsize=4096 blocks=1342177019, imaxpct=5
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=521728, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 1342177019 to 1879047931
root@inboc-nfs:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 16G 0 16G 0% /dev
tmpfs 3.2G 1.2M 3.2G 1% /run
/dev/sda4 195G 4.7G 191G 3% /
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sdc1 7.0T 4.8T 2.3T 69% /mnt
/dev/sdb1 10T 2.8T 7.3T 28% /srv
/dev/sda2 1014M 180M 835M 18% /boot
tmpfs 3.2G 0 3.2G 0% /run/user/0
更多推荐
已为社区贡献10条内容
所有评论(0)