由于业务扩展需要,将300G硬盘扩容到2T.
xfs方法:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
$ fdisk /dev/vdb #删除之前分区 Command (m for help): d Selected partition 1 Partition 1 is deleted Command (m for help): p Command (m for help): n Select (default p): p 其余均默认 Command (m for help): wq $ mount /dev/vdb1 /data #挂载磁盘 $ df -h Filesystem Size Used Avail Use% Mounted on /dev/vdb1 300G 1.6G 299G 1% /data $ xfs_growfs /dev/vdb1 meta-data=/dev/vdb1 isize=512 agcount=4, agsize=19660736 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0 spinodes=0 data = bsize=4096 blocks=78642944, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal bsize=4096 blocks=38399, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 78642944 to 536870655 $ df -h Filesystem Size Used Avail Use% Mounted on /dev/vdb1 2.0T 1.6G 2.0T 1% /data |
备注信息:
0 1 |
resize2fs 针对文件系统ext2 ext3 ext4 xfs_growfs 针对文件系统xfs |
完整过程:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
$ df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/vdb1 xfs 300G 1.6G 299G 1% /data $ fdisk -l Disk /dev/vdb: 2199.0 GB, 2199023255552 bytes, 4294967296 sectors Device Boot Start End Blocks Id System /dev/vdb1 2048 629145599 314571776 83 Linux $ fdisk /dev/vdb Command (m for help): d Selected partition 1 Partition 1 is deleted Command (m for help): p Command (m for help): n Select (default p): p Partition number (1-4, default 1): First sector (2048-4294967295, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-4294967294, default 4294967294): Using default value 4294967294 Partition 1 of type Linux and of size 2 TiB is set Command (m for help): wq $ e2fsck -f /dev/vdb1 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/vdb1 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 <device> $ resize2fs /dev/vdb1 resize2fs 1.42.9 (28-Dec-2013) resize2fs: Bad magic number in super-block while trying to open /dev/vdb1 Couldn't find valid filesystem superblock. $ mount /dev/vdb1 /data $ df -h Filesystem Size Used Avail Use% Mounted on /dev/vdb1 300G 1.6G 299G 1% /data $ xfs_growfs /dev/vdb1 meta-data=/dev/vdb1 isize=512 agcount=4, agsize=19660736 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0 spinodes=0 data = bsize=4096 blocks=78642944, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal bsize=4096 blocks=38399, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 78642944 to 536870655 $ df -h Filesystem Size Used Avail Use% Mounted on /dev/vdb1 2.0T 1.6G 2.0T 1% /data |
参考文档:
1:https://helpcdn.aliyun.com/document_detail/25452.html
2:https://blog.csdn.net/cymm_liu/article/details/36185733
3:https://www.cnblogs.com/kevingrace/p/5825963.html
4:https://help.aliyun.com/knowledge_detail/38063.html
5:https://blog.51cto.com/daisywei/1960761
6:https://blog.csdn.net/u014774781/article/details/51038770
7:https://yq.aliyun.com/articles/280229SourceByrd's Weblog-https://note.t4x.org/basic/aliyun-disk-expansion/
SourceByrd's Weblog-https://note.t4x.org/basic/aliyun-disk-expansion/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!