码迷,mamicode.com
首页 > 其他好文 > 详细

非逻辑磁盘扩容数据盘(xfs和ext2、3、4)

时间:2020-04-21 16:49:05      阅读:64      评论:0      收藏:0      [点我收藏+]

标签:setting   done   realtime   mount   max   summary   mem   cto   nis   

前言:因数据磁盘不足需要进行扩展分区,但是因为没有逻辑分区使用LVM会很复杂
Warning:扩容需要卸载数据盘,但不会影响数据(如果重要或者怕丢失的话请先备份)
思路:
1.卸载数据盘
2.fdisk扩容
3.修复磁盘
4.挂载磁盘
5.扩容磁盘
以下是xfs磁盘扩容
(1)卸载数据盘

[root@localhost ~]# umount /dev/vdc1

(2)fdisk扩容

[root@door_application ~]# fdisk /dev/vdc
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): d
Selected partition 1
Partition 1 is deleted

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): 
Using default response p
Partition number (1-4, default 1): 
First sector (2048-41943039, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): 
Using default value 41943039
Partition 1 of type Linux and of size 20 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

(3)修复磁盘

[root@door_application ~]# xfs_repair /dev/vdc1 
Phase 1 - find and verify superblock...
Phase 2 - using internal log
        - zero log...
        - scan filesystem freespace and inode maps...
        - found root inode chunk
Phase 3 - for each AG...
        - scan and clear agi unlinked lists...
        - process known inodes and perform inode discovery...
        - agno = 0
        - agno = 1
        - agno = 2
        - agno = 3
        - agno = 4
        - agno = 5
        - agno = 6
        - agno = 7
        - process newly discovered inodes...
Phase 4 - check for duplicate blocks...
        - setting up duplicate extent list...
        - check for inodes claiming duplicate blocks...
        - agno = 0
        - agno = 1
        - agno = 2
        - agno = 3
        - agno = 4
        - agno = 5
        - agno = 6
        - agno = 7
Phase 5 - rebuild AG headers and trees...
        - reset superblock...
Phase 6 - check inode connectivity...
        - resetting contents of realtime bitmap and summary inodes
        - traversing filesystem ...
        - traversal finished ...
        - moving disconnected inodes to lost+found ...
Phase 7 - verify and correct link counts...
done

(4)挂载磁盘

[root@door_application ~]# mount -a

(5)扩容磁盘

[root@door_application ~]# xfs_growfs /dev/vdc1 
meta-data=/dev/vdc1              isize=512    agcount=8, agsize=655360 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=5242624, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

关于ext4的磁盘扩容除修复和扩容磁盘的命令不一样其他都一样

e2fsck -f 磁盘名
resize2fs 磁盘名

非逻辑磁盘扩容数据盘(xfs和ext2、3、4)

标签:setting   done   realtime   mount   max   summary   mem   cto   nis   

原文地址:https://blog.51cto.com/13229718/2489077

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!