2016-07-02 3 views
4

私は最後の行のエラー上記と同じことを行うことができません方法xfsファイルシステムでオンラインでルートパーティションのサイズを変更するには?

[[email protected] ~]# resize2fs /dev/root_vg/root 
resize2fs 1.42.9 (28-Dec-2013) 
resize2fs: Bad magic number in super-block while trying to open /dev/root_vg/root 
Couldn't find valid filesystem superblock. 

の下に使用して、ルートパーティションを拡張しようとしています。

答えて

0
Environment : 

    [[email protected] ~]# uname -a 
    Linux oel7.localdomain 3.8.13-55.1.6.el7uek.x86_64 #2 SMP Wed Feb 11 14:18:22 PST 2015 x86_64 x86_64 x86_64 GNU/Linux 

Steps : 

    1) [[email protected] ~]# df -h 
    Filesystem       Size Used Avail Use% Mounted on 
    /dev/mapper/root_vg-root   5.0G 4.5G 548M 90%/

    2) 

PV /dev/sda2 VG root_vg  lvm2 [6.00 GiB/0 free] 

    as here it shows that there is no space left on root_vg volume group, so first i need to extend VG 

    3) [[email protected] ~]# vgextend root_vg /dev/sdb5 

     Volume group "root_vg" successfully extended 

    4) [[email protected] ~]# pvscan 

     PV /dev/sda2 VG root_vg  lvm2 [6.00 GiB/0 free] 
     PV /dev/sdb5 VG root_vg  lvm2 [2.00 GiB/2.00 GiB free] 

    5) Now extend the logical volume 

    [[email protected] ~]# lvextend -L +1G /dev/root_vg/root 
     Size of logical volume root_vg/root changed from 5.00 GiB (1280 extents) to 6.00 GiB (1536 extents). 
     Logical volume root successfully resized 

    6) [[email protected] ~]# resize2fs /dev/root_vg/root 

    resize2fs 1.42.9 (28-Dec-2013) 
    resize2fs: Bad magic number in super-block while trying to open /dev/root_vg/root 
    Couldn't find valid filesystem superblock. 

    as root partition is not a ext* partiton so , you resize2fs will not work for you. 

    7) to check the filesystem type of a partition 

    [[email protected] ~]# df -Th 
    Filesystem      Type  Size Used Avail Use% Mounted on 
    /dev/mapper/root_vg-root   xfs  6.0G 4.5G 1.6G 75%/
    devtmpfs       devtmpfs 481M  0 481M 0% /dev 
    tmpfs        tmpfs  491M 80K 491M 1% /dev/shm 
    tmpfs        tmpfs  491M 7.1M 484M 2% /run 
    tmpfs        tmpfs  491M  0 491M 0% /sys/fs/cgroup 
    /dev/mapper/data_vg-home   xfs  3.5G 2.9G 620M 83% /home 
    /dev/sda1       xfs  497M 132M 365M 27% /boot 
    /dev/mapper/data_vg01-data_lv001 ext3  4.0G 2.4G 1.5G 62% /sybase 
    /dev/mapper/data_vg02-backup_lv01 ext3  4.0G 806M 3.0G 22% /backup 

    above command shows that root is an xfs filesystem , so we are sure that we need to use xfs_growfs command to resize the partition. 

    8) [[email protected] ~]# xfs_growfs /dev/root_vg/root 

    meta-data=/dev/mapper/root_vg-root isize=256 agcount=4, agsize=327680 blks 
      =      sectsz=512 attr=2, projid32bit=1 
      =      crc=0  finobt=0 
    data  =      bsize=4096 blocks=1310720, 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 1310720 to 1572864 

    [[email protected] ~]# df -Th 
    Filesystem      Type  Size Used Avail Use% Mounted on 
    /dev/mapper/root_vg-root   xfs  6.0G 4.5G 1.6G 75%/

オンラインでルートパーティションが正常に拡張されたことをお祝いします。

HTH

8

あなたはxfs_growfs代わりにresize2fsのを使用する必要があり、この場合には、XFSファイルシステムに取り組んでいます。 2つのコマンドは、このタスクを実行するために必要とされる:

# growpart /dev/sda 1 

growpartは全体のsdaディスクにsda1にパーティションを拡張するために使用されます。

# xfs_growfs -d /dev/sda1 

xfs_growfsは、変更のサイズを変更して適用するために使用されます。

# df -h 

NB:https://gist.github.com/OmarTrigui/7d6ec92c8f2ef83ba15b80e30fb6a5be

:あなたは、このスクリプトを確認することができます
関連する問題