You are not logged in.

#1 2008-03-20 21:08:40

kipi18
Member
Registered: 2008-03-20
Posts: 2

Convert ext3 root to jfs

Hello all,
I would like to convert my root file system from ext3 to jfs. I made a first unsuccessful attempt. This is what I did:

- Booted my laptop with systemrescue cd and mounted my root partition (/dev/sda3).
- Copied all data from it to another partition using cp -a (except /proc and /sys).
- Unmounted the root partition.
- Created a jfs file system on it using 'mkfs.jfs /dev/sda3'.
- Mounted the root partition.
- Copied back all files to it using cp -a.
- Created empty /proc and /sys directories.
- Edited the /etc/fstab file and changed ext3 to jfs for the root file system.
- Unmounted the root partition again.
- Rebooted.

The laptop boots, but fails to mount the file system. It says the partition is of type jfs, but then I get:

kinit: Cannot open root device sda3(8,3)
kinit: init not found
Kernel panic - not syncing: Attempted to kill init!

Can anyone see what I did do wrong? My boot partition is ext2.

Regards,
Kimmo

Offline

#2 2008-03-20 22:09:29

dschauer
Member
Registered: 2008-02-28
Posts: 95

Re: Convert ext3 root to jfs

Well, proc and sys would have been empty anyways, so it would have been OK to copy them, would have saved some steps, but that is not really relevant.

Did you try the rescue (fallback) ramdisk? JFS is not built into the kernel. As far as that goes, I don't think any FS is is built into the kernel. You may need to rebuild the initrd, if you can boot with the rescue one.

Hmmm... Init not found. That makes me think the directory structure did not get replicated identically.

The procedure should have gone something like this (replace old, spare, new as need be)

# boot rescue CD and get a root prompt
mkdir /mnt/old
mkdir /mnt/new
mkdir /mnt/spare

mount /dev/sda3 /mnt/old
mount /dev/spare /mnt/spare

cp -a /mnt/old/* /mnt/spare/

umount /mnt/old
mkfs.jfs /dev/sda3

mount /dev/sda3 /mnt/new/
cp -a /mnt/spare/* /mnt/new/

umount /mnt/spare
umount /mnt/new

Offline

#3 2008-03-20 22:17:55

dschauer
Member
Registered: 2008-02-28
Posts: 95

Re: Convert ext3 root to jfs

Did you check the new filesystem after you copied it to make sure the directory structure was intact?

Last edited by dschauer (2008-03-20 23:23:02)

Offline

#4 2008-03-20 23:17:13

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: Convert ext3 root to jfs

When I was experimenting with different filesystems in the past I noticed that I needed to regenerate mkinitcpio image each time I changed root filesystem.  To do this you can boot using the install cd (use root=/dev/sd?? parameter or boot normally and then chroot into your system) and then do mkinitcpio -p kernel26 as root.  I also tend to put the root filesystem module (in my case reiserfs) in the MODULES line in /etc/mkinitcpio.conf -- that way it will be always included in the mkinitcpio image.

Last edited by fwojciec (2008-03-20 23:17:48)

Offline

#5 2008-03-20 23:18:19

kipi18
Member
Registered: 2008-03-20
Posts: 2

Re: Convert ext3 root to jfs

Got it working now...

- Added jfs to MODULES in /etc/mkinitcpio.conf (Not sure if the first two steps are required, but I could not find the module in the cpio image. So I recreated the initcpio image. May have missed the jfs module though when looking in the original image listing)
- Ran 'mkinitcpio -G /boot/kernel26.img'
- Rebooted.
- Copied the root using 'rsync -aHv' instead. (-H is probably not needed, but just to be safe)
- Formatted jfs.
- Restored files again with 'rsync -aHv'.
- Changed root fstype in /etc/fstab to jfs.
- Unmounted restored root partition.
- Rebooted.

Thank you for your suggestions and tips!

Best regards,
Kimmo

Offline

Board footer

Powered by FluxBB