centos追加扩容整块磁盘容量
- 原磁盘/dev/vdb有100G,整块直接挂载到了/data目录下
- 后来追加了200G到/dev/vdb上
[root@i-QxxV9WFa3-2 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sr0 11:0 1 386K 0 rom vda 253:0 0 100G 0 disk └─vda1 253:1 0 100G 0 part / vdb 253:16 0 300G 0 disk /data [root@i-QxxV9WFa3-2 ~]# df -TH Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 4.1G 0 4.1G 0% /dev tmpfs tmpfs 4.1G 8.2k 4.1G 1% /dev/shm tmpfs tmpfs 4.1G 413M 3.7G 11% /run tmpfs tmpfs 4.1G 0 4.1G 0% /sys/fs/cgroup /dev/vda1 xfs 108G 4.4G 104G 5% / tmpfs tmpfs 818M 0 818M 0% /run/user/0 /dev/vdb ext4 106G 105G 0 100% /data
- 扩容步骤
#先解除挂载 umount /data #检查磁盘 e2fsck -f /dev/vdb #扩容 resize2fs /dev/vdb #重新挂载 mount /dev/vdb /data
- 结果
[root@i-QxxV9WFa3-1 ~]# umount /data [root@i-QxxV9WFa3-1 ~]# e2fsck -f /dev/vdb e2fsck 1.42.9 (28-Dec-2013) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/vdb: 2787/6553600 files (84.4% non-contiguous), 26072290/26214400 blocks [root@i-QxxV9WFa3-1 ~]# resize2fs /dev/vdb resize2fs 1.42.9 (28-Dec-2013) Resizing the filesystem on /dev/vdb to 78643200 (4k) blocks. The filesystem on /dev/vdb is now 78643200 blocks long.[root@i-QxxV9WFa3-1 ~]# mount /dev/vdb /data [root@i-QxxV9WFa3-1 ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 3.8G 0 3.8G 0% /dev tmpfs tmpfs 3.9G 8.0K 3.9G 1% /dev/shm tmpfs tmpfs 3.9G 394M 3.5G 11% /run tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vda1 xfs 100G 4.1G 96G 5% / tmpfs tmpfs 780M 0 780M 0% /run/user/0 /dev/vdb ext4 296G 98G 183G 35% /data