resize2fs : Bad magic value

Issues related to hardware problems
Post Reply
bjoernanger
Posts: 4
Joined: 2013/04/23 08:35:21

resize2fs : Bad magic value

Post by bjoernanger » 2014/10/21 08:47:12

Hi there,

I've a problem I don't know how to solve. I tried to extend a disk within a vm on an esx host. The VMware part I did without any problems. But now the CentOS did not do as I want it to.

This is what I did:

Code: Select all

root@confluence:~# lvs
  LV   VG     Attr       LSize  Pool Origin Data%  Move Log Cpy%Sync Convert
  root centos -wi-ao---- 13,91g
  swap centos -wi-ao----  1,60g

root@confluence:~# fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 sectors
Units = Sektoren of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b543a

   Gerät  boot.     Anfang        Ende     Blöcke   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    33554431    16264192   8e  Linux LVM

Disk /dev/mapper/centos-swap: 1719 MB, 1719664640 bytes, 3358720 sectors
Units = Sektoren of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-root: 14.9 GB, 14931722240 bytes, 29163520 sectors
Units = Sektoren of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

root@confluence:~# fdisk /dev/sda
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.


Befehl (m für Hilfe): p

Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 sectors
Units = Sektoren of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b543a

   Gerät  boot.     Anfang        Ende     Blöcke   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    33554431    16264192   8e  Linux LVM

Befehl (m für Hilfe): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   Erweiterte
Select (default p): p
Partitionsnummer (3,4, default 3): 3
Erster Sektor (33554432-62914559, Vorgabe: 33554432):
Benutze den Standardwert 33554432
Last Sektor, +Sektoren or +size{K,M,G} (33554432-62914559, Vorgabe: 62914559):
Benutze den Standardwert 62914559
Partition 3 of type Linux and of size 14 GiB is set

Befehl (m für Hilfe): t
Partitionsnummer (1-3, default 3): 3
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

Befehl (m für Hilfe): w
Die Partitionstabelle wurde verändert!

Rufe ioctl() um Partitionstabelle neu einzulesen.

WARNING: Re-reading the partition table failed with error 16: Das Gerät oder die Ressource ist belegt.
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)
Synchronisiere Platten.
root@confluence:~# shutdown -r now

++++++++++
+        +
+ REBOOT +
+        +
++++++++++

login as: root
root@192.168.X.XXX's password:
Last login: Tue Oct 21 10:01:12 2014 from XXX
root@confluence:~# fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 sectors
Units = Sektoren of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b543a

   Gerät  boot.     Anfang        Ende     Blöcke   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    33554431    16264192   8e  Linux LVM
/dev/sda3        33554432    62914559    14680064   8e  Linux LVM

Disk /dev/mapper/centos-swap: 1719 MB, 1719664640 bytes, 3358720 sectors
Units = Sektoren of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-root: 14.9 GB, 14931722240 bytes, 29163520 sectors
Units = Sektoren of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

root@confluence:~# pvcreate /dev/sda3
  Physical volume "/dev/sda3" successfully created
root@confluence:~# vgdisplay
  --- Volume group ---
  VG Name               centos
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               15,51 GiB
  PE Size               4,00 MiB
  Total PE              3970
  Alloc PE / Size       3970 / 15,51 GiB
  Free  PE / Size       0 / 0
  VG UUID               0oR6B8-HLd3-y5dx-JAJt-lvZP-ZnAd-dXn1rg

root@confluence:~# vgextend centos /dev/sda3
  Volume group "centos" successfully extended
root@confluence:~# vgdisplay centos
  --- Volume group ---
  VG Name               centos
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               29,50 GiB
  PE Size               4,00 MiB
  Total PE              7553
  Alloc PE / Size       3970 / 15,51 GiB
  Free  PE / Size       3583 / 14,00 GiB
  VG UUID               0oR6B8-HLd3-y5dx-JAJt-lvZP-ZnAd-dXn1rg

root@confluence:~# lvdisplay
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                lIa8Px-0Zv4-x9Sq-wJS9-x1jE-NY6H-eGd4Hz
  LV Write Access        read/write
  LV Creation host, time localhost, 2014-07-30 12:26:29 +0200
  LV Status              available
  # open                 2
  LV Size                1,60 GiB
  Current LE             410
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/centos/root
  LV Name                root
  VG Name                centos
  LV UUID                E5SFVV-X4J8-HW7V-OhlC-vWho-C7xx-2CNUtX
  LV Write Access        read/write
  LV Creation host, time localhost, 2014-07-30 12:26:30 +0200
  LV Status              available
  # open                 1
  LV Size                13,91 GiB
  Current LE             3560
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1

root@confluence:~# lvextend -L+14G /dev/centos/root
  Extending logical volume root to 27,91 GiB
  Insufficient free space: 3584 extents needed, but only 3583 available
root@confluence:~# lvextend -L+13G /dev/centos/root
  Extending logical volume root to 26,91 GiB
  Logical volume root successfully resized
root@confluence:~# resize2fs /dev/centos/root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Ungültige magische Zahl im Superblock beim Versuch, /dev/centos/root zu öffnen
Kann keinen gültigen Dateisystem-Superblock finden.
root@confluence:~#
The output is partly in german cause it's a german installation. But the final hint is *bad magic value*.
It seems to me, that nearly everything is done ... just one step is missing: the final resize.

Is there a way to correct this "magig value"-issue.

Or is this just the wrong way to extend the volume.
Magic Values are only used in EXT2/3/4. But my FS is LVM2. And I am always referred to the resize2fs-command. But as i read this is unable to handle LMV2 volumes. I'm really confused.

Can someone please help me.

itzme
Posts: 1
Joined: 2014/12/15 11:28:13

Re: resize2fs : Bad magic value

Post by itzme » 2014/12/15 11:32:03

I made the same experience - use 'xfs_growfs' instead, see: http://stackoverflow.com/questions/1336 ... lume-fails

User avatar
jyoung
Posts: 102
Joined: 2014/09/22 13:40:31
Location: Nashville, TN, USA

Re: resize2fs : Bad magic value

Post by jyoung » 2015/01/03 14:50:55

The next time you do this, add a "-r" to your lvextend command. That'll take care of this for you. You're trying to use a utility made for ext{2,3,4} filesystems on something that is not ext{2,3,4}. This time, use xfs_growfs.

Code: Select all

lvextend -r -l+100%FREE /dev/centos/root

Code: Select all

[jyoung@young ~]$ xfs_growfs 
Usage: xfs_growfs [options] mountpoint

Options:
	-d          grow data/metadata section
	-l          grow log section
	-r          grow realtime section
	-n          don't change anything, just show geometry
	-i          convert log from external to internal format
	-t          alternate location for mount table (/etc/mtab)
	-x          convert log from internal to external format
	-D size     grow data/metadata section to size blks
	-L size     grow/shrink log section to size blks
	-R size     grow realtime section to size blks
	-e size     set realtime extent size to size blks
	-m imaxpct  set inode max percent to imaxpct
	-V          print version information
[jyoung@young ~]$ 
-- Jeremy --

Post Reply