ECS Linux服务器xfs磁盘扩
ECS Linux服务器xfs磁盘使用阿里云官方提供的磁盘扩容方法扩容会有报错:
[[email protected] ~]# e2fsck /dev/xvdb1
e2fsck 1.42.9 (28-Dec-2013)
ext2fs_open2: Bad magic number in super-block
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/xvdb1
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193
可以看到报错是超级块不可用。
超级块不可用有两种可能性:
1. 超级块损坏,导致不可用。
2. 不同的文件系统,使用ext文件系统去检查xfs的文件系统,超级块不能识别。
此处是由于第二中原因导致的,查看分区的文件系统的方法:
[[email protected] ~]# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/xvda1 ext4 20510332 1660744 17784680 9% /
devtmpfs devtmpfs 934320 0 934320 0% /dev
tmpfs tmpfs 942004 0 942004 0% /dev/shm
tmpfs tmpfs 942004 8508 933496 1% /run
tmpfs tmpfs 942004 0 942004 0% /sys/fs/cgroup
/dev/xvdb1 xfs 10474496 33088 10441408 1% /mnt
可以看到/dev/xvdb1是xfs的文件系统。
对xfs的文件系统扩容方法如下:
1. 不需要卸载已经挂载的磁盘,否则扩容会报错。
[[email protected] ~]# xfs_growfs /dev/xvdb1
xfs_growfs: /dev/xvdb1 is not a mounted XFS filesystem
2. 可以在分区挂载的情况扩容xfs的文件系统:
[[email protected] ~]# xfs_growfs /dev/xvdb1
meta-data=/dev/xvdb1 isize=256 agcount=4, agsize=327616 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0
data = bsize=4096 blocks=1310464, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 1310464 to 2621184
可以看到blocks 的数量从131046扩容到了2621184,实现了扩容。
扩容前/dev/xvdb1是5G的容量:
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 20G 1.5G 18G 9% /
devtmpfs 913M 0 913M 0% /dev
tmpfs 920M 0 920M 0% /dev/shm
tmpfs 920M 8.3M 912M 1% /run
tmpfs 920M 0 920M 0% /sys/fs/cgroup
/dev/xvdb1 5.0G 33M 5.0G 1% /mnt
扩容后的/dev/xvdb1的容量为10G:
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 20G 1.5G 18G 9% /
devtmpfs 913M 0 913M 0% /dev
tmpfs 920M 0 920M 0% /dev/shm
tmpfs 920M 8.3M 912M 1% /run
tmpfs 920M 0 920M 0% /sys/fs/cgroup
/dev/xvdb1 10G 33M 10G 1% /mnt
原文地址:https://www.cnblogs.com/gaoyuechen/p/10193741.html