Problem bootin from ext4

Hi!

I’m migrating my OpenSuse 11.3 (which was update from 11.2, 11.1 … ) to a new hard drive. My partitions were reiserfs and in the migration I’m “converting” them to ext4, the conversion process is simple and it works fine for all of them except the root one:

  1. I create a new partition on the new hard disk (bigger than the original one)
  2. I format it with ext4
  3. I copy all the data with cp -a from the original partition to the new one

I already have all the partitions migrated to the second disk, then I have tried to do it with the root partition:
-I’ve booted with a system rescue CD and I’ve done !9 2) and 3) with no problems.
-I’ve edited and changed al entries in fstab and grub conf (menu.lst) to point the new partitions
-I’ve reinstalled grub and it seemed It will be no problems booting, but

It begins booting, the grub menu appears, It begins booting the kernel, but suddenly:

waiting for /dev/root to appear: OK
fsck.reiserfs -a /dev/sda2

mount -o ro,ad,user_xattr -t reiserfs /dev/root /root

and it fails, because sda2 is not reiserfs, but why does it try to mount it as reiserfs if I’m not saying anywhere it is reiserfs?

this is my fstab:

#/dev/disk/by-id/ata-ST3160211AS_6PT0V05Y-part2 /       reiserfs        acl,user_xattr 1 1 
 
/dev/disk/by-id/ata-WDC_WD5000AADS-00S9B0_WD-WCAV91599607-part2 /       ext4    acl,user_xattr 1 1 
/dev/disk/by-id/ata-WDC_WD5000AADS-00S9B0_WD-WCAV91599607-part1 swap    swap    defaults 0 0 
/dev/disk/by-id/ata-WDC_WD5000AADS-00S9B0_WD-WCAV91599607-part3 /home   ext4    defaults 1 0 

/dev/disk/by-id/ata-ST3500630A_9QG94AT1-part1   /mnt/backup     auto    noauto,defaults,users,exec 


proc    /proc   proc    defaults 0 0 
sysfs   /sys    sysfs   noauto 0 0 


/dev/fd0        /media/floppy   auto    noauto,user,sync 0 0 
/dev/sr1        /media/dvd      auto    noauto,ro,user,exec,iocharset=utf8 0 0 
/dev/sr0        /media/dvdram   auto    noauto,ro,user,exec,iocharset=utf8 0 0 


devpts  /dev/pts        devpts  mode=0620,gid=5 0 0 

none /proc/bus/usb usbfs devgid=113,devmode=664 0 0

and this is my /boot/grub/menu.lst

# Modified by YaST2. Last modification on jue feb 10 15:51:15 CET 2011                                                                                                                                          
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader                                                                                                                                                    
# Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader                                                                                                                             
                                                                                                                                                                                                                
default 0                                                                                                                                                                                                       
timeout 20
gfxmenu (hd0,1)/boot/message
##YaST - activate

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 11.3 - 2.6.34.7-0.7
    root (hd0,1)
    kernel /boot/vmlinuz-2.6.34.7-0.7-desktop root=/dev/disk/by-id/ata-WDC_WD5000AADS-00S9B0_WD-WCAV91599607-part2 repair=1 resume=/dev/disk/by-id/ata-WDC_WD5000AADS-00S9B0_WD-WCAV91599607-part1 splash=silent showopts vga=0x31a
    initrd /boot/initrd-2.6.34.7-0.7-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.3 - 2.6.34.7-0.7 (desktop)
    root (hd0,1)
    kernel /boot/vmlinuz-2.6.34.7-0.7-desktop root=/dev/disk/by-id/ata-WDC_WD5000AADS-00S9B0_WD-WCAV91599607-part2 showopts ide=nodma apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 x11failsafe vga=0x31a
    initrd /boot/initrd-2.6.34.7-0.7-desktop

###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 11.3 - 2.6.34.7-0.7
    root (hd0,1)
    kernel /boot/vmlinuz-2.6.34.7-0.7-default root=/dev/disk/by-id/ata-WDC_WD5000AADS-00S9B0_WD-WCAV91599607-part2 repair=1 resume=/dev/disk/by-id/ata-WDC_WD5000AADS-00S9B0_WD-WCAV91599607-part1 splash=silent showopts vga=0x31a
    initrd /boot/initrd-2.6.34.7-0.7-default

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.3 - 2.6.34.7-0.7 (default)
    root (hd0,1)
    kernel /boot/vmlinuz-2.6.34.7-0.7-default root=/dev/disk/by-id/ata-WDC_WD5000AADS-00S9B0_WD-WCAV91599607-part2 showopts ide=nodma apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 x11failsafe vga=0x31a
    initrd /boot/initrd-2.6.34.7-0.7-default

I’ve booted it also with SuperGrub2 disk and the same thing happened, so I think it’s not a grub problem but I don’t wknow why it tried to mount the root partition as reiserfs.

Any ideas?

regards

It has been suggested to use the dd command to copy a partition. You would need to boot from a LiveCD to perform this task. the Partition copy would then be:

dd if=/dev/sda1 of=/dev/sdb1

You would use the correct designations for sda1, the source and sdb1, the destination. Don’t forget to modify the names of the drives in your /boot/grub/device.map file, /boot/grub/menu.lst and /etc/fstab files as changing the the drive changes its disk by-id name or switch to using the /dev/sd?? format.

Thank You,

I can’t use dd because it will copy the entire filesystem “as is” I mean the reiserfs filesystem, and I’m “converting” it from reiserfs to ext4. The cp -a command works very well copying filesystems from one partition to another (or another disk) even if the partition is the root partition, I’ve done it several times and It never failed before, even changing the filesystem type, for example I remeber migrating from am ext2 root partition to a reiserfs one using this method. The other advantage of cp -a over dd is that you can change use different sizes of partitions.

Don’t forget to modify the names of the drives in your /boot/grub/device.map file, /boot/grub/menu.lst and /etc/fstab files as changing the the drive changes its disk by-id name or switch to using the /dev/sd?? format.

Yes, I did. I’ve changed the three of them. That’s why I don’t understand why The kernel tries to mount the partition as reiserfs if It’s ext4 and it’s specified as ext4 in fstab

regards

Hi,

I wonder if you don’t have to remake your initrd, too?

HTH

Lenwolf

On 2011-02-14 12:36, fperal wrote:

> 1) I create a new partition on the new hard disk (bigger than the
> original one)
> 2) I format it with ext4
> 3) I copy all the data with cp -a from the original partition to the
> new one

Correct.

Use labels if you can, fstab and grub.

> It begins booting, the grub menu appears, It begins booting the kernel,
> but suddenly:
>
>
> waiting for /dev/root to appear: OK
> fsck.reiserfs -a /dev/sda2
> …

Ah! You need to remake initrd as well. Contrary to what many thought (me),
it contains way more than modules.

Do you know how to do that? I feel you do, but if not, I’ll explain
(basically, boot with another linux, then chroot, mkinitrd).


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

> I wonder if you don’t have to remake your initrd, too?

Yes, run into the same problem when upgrading from ext3 to ext4. The initrd
must contain the kernel modules to access the file system (if they are not
compiled into the kernel).

I would suggest the following:

  1. Boot LiveCD
  2. Chroot into the orginial system
  3. Run mkinitrd

For step 2. do:
mount /dev/xy /mnt/ (/dev/xy is your root partition)
mount -t proc none /mnt/proc
mount -o bind /dev /mnt/dev
chroot /mnt /bin/bash
su - (to set correct enviroment variables)

Yes, it was what I was missing.
I’ve done mkinitrd, from the system booted from the reiserfs partition, even with ext4 specified in the INITRD_MODULES variable in /etc/sysconfig/kernel, but I think It records that you are booting from a reiserfs and in the next boot it tries to mount the root partition as reiserfs.

making the initrd as you suggest works fine (necessary mounting proc /dev because if not /dev is empty in the chrooted environment )

I had to add too ext4 jdb2 and cdr16 to the INITRD_MODULES variable in /etc/sysconfig/kernel

thank you very much
regards

On 2011-02-14 23:36, fperal wrote:

> Yes, it was what I was missing.
> I’ve done mkinitrd, from the system booted from the reiserfs partition,
> even with ext4 specified in the INITRD_MODULES variable in
> /etc/sysconfig/kernel, but I think It records that you are booting from
> a reiserfs and in the next boot it tries to mount the root partition as
> reiserfs.

Indeed it does, I told you.

The initrd file is a cpio archive. Open it and see what it contains… The
problem is not only the modules, there is much more in there.

Look, one of mine:

/initrd/config/mount.sh:

“$rootdev” ] || rootdev=’/dev/disk/by-id/ata-ST350…-part7’
“$rootfsck” ] || rootfsck=’/sbin/fsck.ext3’


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)