阿里云服务器数据盘扩容
由于阿里云上的数据磁盘容量不够使用,所以需要对其进行扩容,这里记录了阿里云服务器实例重启以后的步骤。
具体参考:https://help.aliyun.com/document_detail/25452.html?spm=5176.doc35095.2.5.kgnduH
取消挂载 umount /dev/xvdb1
如果报device 被占用 ,先fuser -m /dev/xvdb1查看占用的进程id,然后在kill掉占用进程,最后再umount
使用fdisk工具进行分区
步骤一
fdisk -l 罗列一下分区信息并记录一下即将扩容磁盘的最终容量、起始扇区位置
例子:
Disk /dev/xvda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00078f9c
Device Boot Start End Blocks Id System /dev/xvda1 * 1 2611 20970496 83 Linux
Disk /dev/xvdb: 44.0 GB, 44023414784 bytes 255 heads, 63 sectors/track, 5352 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xbe48559a
Device Boot Start End Blocks Id System /dev/xvdb1 1 2741 22017051 83 Linux
步骤二
fdisk /dev/xvdb
输入 d 来删除原有的分区
输入 n 来新建分区(随后出现等待,输入p回车即可)
输入 分区数,默认1即可
输入起始扇区 (上面的/dev/xvdb 的Start值)
输入结束扇区(默认回车即可)
输入 wq 保存
步骤三
检查文件系统
e2fsck -f /dev/xvdb1
变更文件系统大小
resize2fs /dev/xvdb1
步骤四
扩容完毕的磁盘挂载回原有的挂载点
mount /dev/xvdb1 /weisi
用 df -TH 指令可以查看到磁盘的信息。
[root@iZ253vpzh2zZ mnt]# df -TH
Filesystem Type Size Used Avail Use% Mounted on
/dev/xvda1 ext4 22G 12G 8.8G 57% / tmpfs
tmpfs 984M 0 984M 0% /dev/shm
/dev/xvdb1 ext4 23G 21G 461M 98% /weisi

浙公网安备 33010602011771号