Linux Red Hat Redimensionar VM resize2fs - Não foi possível encontrar o superbloco de sistema de arquivos válido

1

Estou tentando aumentar o tamanho de uma máquina virtual Red Hat Linux em 10Gig. Isso é apenas em um servidor de teste que criei e que estou tentando descobrir.

Eu aumentei a VM em 10 GB com esse comando [root @ imagens rh01] # qemu-img redimensionar TestServer.img + 10G Imagem redimensionada.

Então eu segui este link link para terminar

Eu tenho todo o caminho onde o último comando é resize2fs e eu recebo este erro

    [root@TestServer bmac]# resize2fs /dev/vda2
    resize2fs 1.41.12 (17-May-2010)
    resize2fs: Device or resource busy while trying to open /dev/vda2
    Couldn't find valid filesystem superblock.

Aqui estão todos os passos que dei:

    [root@rh01 admin]# virt-df -h /home/admin/images/TestServer.img 
    Filesystem                                Size       Used  Available  Use%
    TestServer.img:/dev/sda1                  484M        63M       396M   14%
    TestServer.img:/dev/vg_template/lv_root    40G       4.0G        34G   10%
    [root@rh01 admin]# virt-list-partitions -lh /home/admin/images/TestServer.img 
  /dev/sda1 ext4 500.0M
  /dev/sda2 pv 48.3G
    [root@rh01 admin]# cd images/
    [root@rh01 images]# qemu-img resize TestServer.img +10G
    Image resized.
    [root@rh01 images]# virt-df -h /home/admin/images/TestServer.img
    Filesystem                                Size       Used  Available  Use%
    TestServer.img:/dev/sda1                  484M        63M       396M   14%
TestServer.img:/dev/vg_template/lv_root    40G       4.0G        34G   10%
[root@rh01 images]# virt-list-partitions -lh /home/admin/images/TestServer.img 
/dev/sda1 ext4 500.0M
/dev/sda2 pv 48.3G

[root@rh01 images]# ls -l TestServer.img 
-rw-------. 1 root root 63166218240 May  1 08:55 TestServer.img

[root@rh01 images]# df
Filesystem                          1K-blocks       Used  Available Use% Mounted on
/dev/mapper/vg_rh01-lv_root 51606140    7845612   41139088      17% /
tmpfs                               99166276        296   99165980      1% /dev/shm
/dev/sda1                           495844      92445     377799        20% /boot
/dev/mapper/vg_rh01-lv_home 3305120248  494277716 2642952000  16% /home

[root@rh01 images]# df -B 4k
Filesystem            4K-blocks       Used Available Use% Mounted on
/dev/mapper/vg_rh01-lv_root
                       12901535    1961403  10284772  17% /
tmpfs                  24791569         74  24791495   1% /dev/shm
/dev/sda1                123961      23112     94450  20% /boot
/dev/mapper/vg_rh01-lv_home
                      826280062  123569429 660738000  16% /home

[root@rh01 images]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_rh01-lv_root
                       50G  7.5G   40G  17% /
tmpfs                  95G  296K   95G   1% /dev/shm
/dev/sda1             485M   91M  369M  20% /boot
/dev/mapper/vg_rh01-lv_home
                      3.1T  472G  2.5T  16% /home



Boot VM and Login 
[bmac@TestServer ~]$ su
Password: 
[root@TestServer bmac]# cd
[root@TestServer ~]# fdisk /dev/vda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/vda: 63.2 GB, 63166218240 bytes
16 heads, 63 sectors/track, 122392 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000cd4ad

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *           3        1018      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2            1018      101588    50686976   8e  Linux LVM
Partition 2 does not end on cylinder boundary.

Command (m for help): d
Partition number (1-4): 2

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1-122392, default 1): 1018
Last cylinder, +cylinders or +size{K,M,G} (1018-122392, default 122392): 122392

Command (m for help): p

Disk /dev/vda: 63.2 GB, 63166218240 bytes
16 heads, 63 sectors/track, 122392 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000cd4ad

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *           3        1018      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2            1018      122392    61172544   83  Linux

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

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

[bmac@TestServer ~]$ su
Password: 
[root@TestServer bmac]# df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_template-lv_root
                       40G  4.0G   34G  11% /

[root@TestServer bmac]# resize2fs /dev/vda2
resize2fs 1.41.12 (17-May-2010)
resize2fs: Device or resource busy while trying to open /dev/vda2
Couldn't find valid filesystem superblock.
[root@TestServer bmac]# resize4fs /dev/vda2
bash: resize4fs: command not found

    [root@TestServer bmackenzie]# resize2fs /dev/mapper/vg_template-lv_root 
    resize2fs 1.41.12 (17-May-2010)
    The filesystem is already 10622976 blocks long.  Nothing to do!

[root@TestServer bmac]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_template-lv_root
                       40G  4.0G   34G  11% /
tmpfs                 3.9G   80K  3.9G   1% /dev/shm
/dev/vda1             485M   64M  397M  14% /boot

Obrigado pela informação MadHatter. aqui estão os passos exatos que eu realizei que funcionaram para mim no caso de alguém estar procurando por isso

    [root@TestServer bmac]# pvresize /dev/vda2
    Physical volume "/dev/vda2" changed
    1 physical volume(s) resized / 0 physical volume(s) not resized

    [root@TestServer bmac]# lvextend /dev/mapper/vg_template-lv_root -L +10G
    Extending logical volume lv_root to 50.52 GiB
    Logical volume lv_root successfully resized

    [root@TestServer bmackenzie]# resize2fs /dev/mapper/vg_template-lv_root
    resize2fs 1.41.12 (17-May-2010)
    Filesystem at /dev/mapper/vg_template-lv_root is mounted on /; on-line resizing required
    old desc_blocks = 3, new_desc_blocks = 4
    Performing an on-line resize of /dev/mapper/vg_template-lv_root to 13244416 (4k) blocks.
    The filesystem on /dev/mapper/vg_template-lv_root is now 13244416 blocks long.
    
por user218378 02.05.2014 / 13:43

1 resposta

3

Há um monte de etapas que você precisa fazer, se a memória funcionar.

Primeiramente, você precisará usar pvresize para expandir o PV existente para o novo topo de partição.

Em seguida, você precisará usar lvresize ou lvextend para redimensionar o (s) volume (s) de LV existente (s) no PV ampliado.

Em seguida, você pode usar resize2fs para redimensionar o (s) sistema (s) de arquivos para o (s) novo (s) volume (s) ampliado (s).

    
por 02.05.2014 / 15:51