云服务器磁盘扩容后不显示,腾讯云服务器磁盘扩容问题小记

操作系统:CentOS 7.2 ,文件类型:ext3

磁盘扩容前,一定要先做磁盘快照备份。

1.卸载挂载点报错:

umount /dev/vdb1

umount: /u01: target is busy.

(In some cases useful info about processes that use the device is found by lsof(8) or fuser(1))

使用fuser -k /dev/vdb1 找不到关联的进程;同时使用lsof |grep /dev/vdb1 也找不到关联的进程。

解决方法:重启服务器后停止了云镜、httpd、nfs等服务后成功卸载数据盘

使用:e2fsck -f /dev/vdb1 > aa.txt & 扫描修复磁盘,300G磁盘执行这条命令需要2个小时。

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/vdb1: 2892836/19660800 files (14.7% non-contiguous), 72828039/78642944 blocks

执行命令:resize2fs /dev/vdb1 #没有报错,但磁盘也没有扩容。

resize2fs 1.42.9 (28-Dec-2013) The filesystem is already 78642944 blocks long. Nothing to do!

执行:fdisk -l /dev/vdb1 #查看磁盘空间

Disk /dev/vdb1: 322.1 GB, 322121498624 bytes, 629143552 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

更换另一种方式:

wget -O /tmp/devresize.py https://raw.githubusercontent.com/tencentyun/tencentcloud-cbs-tools/master/devresize/devresize.py ssh -o ServerAliveInterval=60000 user@sshserver #避免ssh因长时间没有输入而断开连接

nohup python /tmp/devresize.py /dev/vdb > result.txt & #这里需要使用磁盘/dev/vdb,而不是分区/dev/vdb1。300G磁盘执行这条命令需要3个小时。

a.命令执行时间过长,出现Write failed: Broken pipe ssh连接断开的问题。连接断开后,执行就失败了。

b.在执行命令的过程中,不能断开远程服务器的连接,否则也会执行失败。如使用命令:python /tmp/devresize.py /dev/vdb > result.txt & 。在断开window远程服务器的连接后,xshell窗口中的执行任务,也会自动中断。

后续改进:把文件系统格式从ext3切换到ext4后,会缩减磁盘扩容的时间。

操作系统:CentOS 7.2 ,文件类型:ext3,把格式转换成ext4

ssh -o ServerAliveInterval=30 root@10.0.1.24

fdisk -l /dev/vdb1

service httpd stop

fuser -um -v /dev/vdb1

systemctl stop YDService

systemctl stop nfs

!umo

tune2fs -O extents,uninit_bg,dir_index /dev/vdb1

fsck -pf /dev/vdb1

mount -t ext4 /dev/vdb1 /u01

vim /etc/fstab

/dev/vdb1 /u01 ext4 defaults 0 0

df -T 只可以查看已经挂载的分区和文件系统类型。

fdisk -l 可以显示出所有挂载和未挂载的分区,但不显示文件系统类型。

file -s /dev/vdb1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值