首页 > 系统服务 > 详细

Linux 系统盘扩容

时间:2020-12-15 15:09:08      阅读:29      评论:0      收藏:0      [点我收藏+]

通过esxi 调整磁盘大小,由20G升级为200G

技术分享图片

查看磁盘和分区大小

root@localhost:/home/maoxian# fdisk -l
Disk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: E39886EF-370D-49F9-A1A5-C3B8152CF3A6

Device     Start      End  Sectors Size Type
/dev/sda1   2048     4095     2048   1M BIOS boot
/dev/sda2   4096 41940991 41936896  20G Linux filesystem
root@localhost:/home/maoxian# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            7.9G     0  7.9G   0% /dev
tmpfs           1.6G  892K  1.6G   1% /run
/dev/sda2        20G  7.1G   12G  39% /
tmpfs           7.9G     0  7.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           7.9G     0  7.9G   0% /sys/fs/cgroup
tmpfs           1.6G     0  1.6G   0% /run/user/1000

扩容对应的分区,这里为 /dev/sda 的第 2 个分区

root@localhost:/home/maoxian# growpart /dev/sda 2
CHANGED: partition=2 start=4096 old: size=41936896 end=41940992 new: size=419426271,end=419430367
root@localhost:/home/maoxian# resize2fs /dev/sda2
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/sda2 is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 25
The filesystem on /dev/sda2 is now 52428283 (4k) blocks long.

再次查看分区大小

root@localhost:/home/maoxian# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            7.9G     0  7.9G   0% /dev
tmpfs           1.6G  892K  1.6G   1% /run
/dev/sda2       197G  7.1G  182G   4% /
tmpfs           7.9G     0  7.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           7.9G     0  7.9G   0% /sys/fs/cgroup
tmpfs           1.6G     0  1.6G   0% /run/user/1000
root@localhost:/home/maoxian# fdisk -l
Disk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: E39886EF-370D-49F9-A1A5-C3B8152CF3A6

Device     Start       End   Sectors  Size Type
/dev/sda1   2048      4095      2048    1M BIOS boot
/dev/sda2   4096 419430366 419426271  200G Linux filesystem

Linux 系统盘扩容

原文:https://www.cnblogs.com/imaoxian/p/14137956.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!