resize2fs: Bad magic number in super-block while trying to open

后端 未结 10 1319
温柔的废话
温柔的废话 2020-12-22 14:45

I am trying to resize a logical volume on CentOS7 but am running into the following error:

resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in supe         


        
相关标签:
10条回答
  • 2020-12-22 15:26

    os: rhel7

    After gparted, # xfs_growfs /dev/mapper/rhel-root did the trick on a living system.

    $ df -h
    Filesystem             Size  Used Avail Use% Mounted on
    /dev/mapper/rhel-root   47G   47G   20M 100% /
    devtmpfs               1.9G     0  1.9G   0% /dev
    tmpfs                  1.9G     0  1.9G   0% /dev/shm
    tmpfs                  1.9G  9.3M  1.9G   1% /run
    tmpfs                  1.9G     0  1.9G   0% /sys/fs/cgroup
    /dev/sda1             1014M  205M  810M  21% /boot
    tmpfs                  379M  8.0K  379M   1% /run/user/42
    tmpfs                  379M     0  379M   0% /run/user/1000
    
    
    # lvresize -l +100%FREE /dev/mapper/rhel-root
      Size of logical volume rhel/root changed from <47.00 GiB (12031 extents) to <77.00 GiB (19711 extents).
      Logical volume rhel/root successfully resized.
    
    
    # xfs_growfs /dev/mapper/rhel-root
    meta-data=/dev/mapper/rhel-root  isize=512    agcount=7, agsize=1900032 blks
             =                       sectsz=512   attr=2, projid32bit=1
             =                       crc=1        finobt=0 spinodes=0
    data     =                       bsize=4096   blocks=12319744, imaxpct=25
             =                       sunit=0      swidth=0 blks
    naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
    log      =internal               bsize=4096   blocks=3711, version=2
             =                       sectsz=512   sunit=0 blks, lazy-count=1
    realtime =none                   extsz=4096   blocks=0, rtextents=0
    data blocks changed from 12319744 to 20184064
    
    
    # df -h
    Filesystem             Size  Used Avail Use% Mounted on
    /dev/mapper/rhel-root   77G   47G   31G  62% /
    devtmpfs               1.9G     0  1.9G   0% /dev
    tmpfs                  1.9G     0  1.9G   0% /dev/shm
    tmpfs                  1.9G  9.3M  1.9G   1% /run
    tmpfs                  1.9G     0  1.9G   0% /sys/fs/cgroup
    /dev/sda1             1014M  205M  810M  21% /boot
    tmpfs                  379M  8.0K  379M   1% /run/user/42
    tmpfs                  379M     0  379M   0% /run/user/1000
    
    0 讨论(0)
  • After a bit of trial and error... as mentioned in the possible answers, it turned out to require xfs_growfs rather than resize2fs.

    CentOS 7,

    fdisk /dev/xvda
    

    Create new primary partition, set type as linux lvm.

    n
    p
    3
    t
    8e
    w
    

    Create a new primary volume and extend the volume group to the new volume.

    partprobe
    pvcreate /dev/xvda3
    vgextend /dev/centos /dev/xvda3
    

    Check the physical volume for free space, extend the logical volume with the free space.

    vgdisplay -v
    lvextend -l+288 /dev/centos/root
    

    Finally perform an online resize to resize the logical volume, then check the available space.

    xfs_growfs /dev/centos/root
    df -h
    
    0 讨论(0)
  • 2020-12-22 15:34

    CentOS7 + VM

    Ive made it with:

    1. Gparted-live extend the volume
    2. pvresize -v /dev/sda2
    3. lvresize -r -l+100%FREE centos/root
    0 讨论(0)
  • 2020-12-22 15:35

    On Centos 7, in answer to the original question where resize2fs fails with "bad magic number" try using fsadm as follows:

    fsadm resize /dev/the-device-name-returned-by-df
    

    Then:

    df 
    

    ... to confirm the size changes have worked.

    0 讨论(0)
提交回复
热议问题