You are not logged in.

#1 2011-10-16 12:18:35

Vi0L0
Member
From: Poland
Registered: 2009-06-24
Posts: 1,349
Website

[SOLVED] moving root / from btrfs partition to ext4 one

I'm trying to move / from btrfs partition into other ext4 partition placed on same raid0 disk  (yeah my kernel is compiled with dmraid and btrfs hooks + /boot [ext2] is placed on other disk) and after:
- doing cp -rp /* from btrfs to ext4 with livecd;
- editing grub/menu.lst;
- editing etc/fstab and etc/mtab (just in case ;P) of ext4 part;
- rebooting;
im getting error:

mount: mounting /dev/disk/by-uuid/<ext4-partition-uuid> on /new_root failed: No such device
Failed to mount real root device.

and then it's sending me into [ramfs #] console, where after doing `ls /dev/disk/by-uuid/` i can see that <ext4-partition-uuid> exists...

I remember i saw such error earlier when i was moving / from one disk into the one im using now (raid0), from btrfs to btrfs, and then i put `dmraid` into mkinitcpio hooks and it was fixed, but now i dunno what to do...

Last edited by Vi0L0 (2011-10-16 16:06:18)

Offline

#2 2011-10-16 14:33:02

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] moving root / from btrfs partition to ext4 one

'No such device' is very different from 'No such file or directory'. In particular, mount(2) states that ENODEV is returned when the filesystem isn't recognized. Sounds like you forgot to add 'ext4' to MODULES or 'filesystems' to HOOKS in your mkinitcpio.conf.

Offline

#3 2011-10-16 15:03:32

Vi0L0
Member
From: Poland
Registered: 2009-06-24
Posts: 1,349
Website

Re: [SOLVED] moving root / from btrfs partition to ext4 one

Yeah, i also thought that there's some problem with ext4 recognition, but both mentioned by you entries were and are present.
BTW fallback kernel spits same error message

Offline

#4 2011-10-16 15:14:48

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] moving root / from btrfs partition to ext4 one

From the ramfs, make sure ext4 is loaded and try to mount the partition manually. If ext4 isn't loaded, then there's a failure on a lower level.

Offline

#5 2011-10-16 15:18:43

Vi0L0
Member
From: Poland
Registered: 2009-06-24
Posts: 1,349
Website

Re: [SOLVED] moving root / from btrfs partition to ext4 one

wow, i thought same thing, and just did that smile
and yeah - i can `modprobe btrfs` but not `modprobe ext4` in ramfs, i will create some additional ext4 hook and then check.
Guess i will win with this now, if yes - i will mark this as solved, if not -continue

Thank you Sir falconindy


Edit: SOLVED by creating additional ext4 hook (still i don't know why filesystems hook did not work), more details:
- basing on `btrfs` hook i created 2 files:

$ cat /lib/initcpio/install/ext4 
#!/bin/bash

build() {
    MODULES="$(all_modules ext4)"
}

help() {
    cat <<HELPEOF
This hook is needed to support ext4 volumes spread over multiple devices.
HELPEOF
}
$ cat /lib/initcpio/hooks/ext4 
# vim: set ft=sh:

run_hook ()
{
    modprobe ext4
}

Last edited by Vi0L0 (2011-10-16 16:05:54)

Offline

#6 2011-10-16 18:12:55

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] moving root / from btrfs partition to ext4 one

Seems a bit overkill, and you haven't really solved the problem -- just worked around it. I'd be curious to know what's included on the generated initramfs with the filesystem hook in place (and not your additional hook).

Offline

#7 2011-10-16 18:39:00

Vi0L0
Member
From: Poland
Registered: 2009-06-24
Posts: 1,349
Website

Re: [SOLVED] moving root / from btrfs partition to ext4 one

Sorry i'm busy that's why i was happy with workaround, but i can look at it if you would like to help me...

Umm... ok so i checked it from where i am now - / partition on ext4, no btrfs partition mounted, no `btrfs` in mkinitcpio.conf, although i `modprobe btrfs`, let's look at the created initramfs file: `bsdtar -x -f initramfs-linux.img` + `grep -r` for btrfs - no kernel module.
Let's add `btrfs` into mkinitcpio.conf - same unpacking and greping - btrfs module is there smile


At the beginig i was wrong - i was using / partition on btrfs without `btrfs` mkinitcpio.conf and it was working fine...



But ok before making any conclusion, let me switch into older / on btrfs and see what's initramfs is it creating... BRB

Offline

#8 2011-10-16 18:44:54

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] moving root / from btrfs partition to ext4 one

I was under the impression that you were moving away from btrfs... wouldn't ext4 be the more appropriate thing to be looking for the initramfs?

FYI: there's `lsinitcpio' for poking around images.

Offline

#9 2011-10-16 18:57:47

Vi0L0
Member
From: Poland
Registered: 2009-06-24
Posts: 1,349
Website

Re: [SOLVED] moving root / from btrfs partition to ext4 one

falconindy wrote:

I was under the impression that you were moving away from btrfs... wouldn't ext4 be the more appropriate thing to be looking for the initramfs?

i firstly grep for ext4, but it was there no matter if ext4 hook was or wasn't in mkinitcpio.conf...

Anyway i now switched to / on btrfs and did create initramfs without my ext4 hook (also without btrfs hook) - btrfs is present, ext4 is not.
I got ext4 in MODULES=, and ext4 partitions mounted (ie. my /home was and is on ext4)

Conclusion: looks like without additional hook mkinitcpio is not adding fs modules that it should to add - i mean i though that it should to add ext4 if ext4 module is loaded and used, but now - even if filesystems hook is present - it's not doing such thing.
I don't know is that intentional, but if i will look at it from the btrfs-to-ext4-switcher point of view it does look like a bug.


falconindy wrote:

FYI: there's `lsinitcpio' for poking around images.

thanks, will check that later

Last edited by Vi0L0 (2011-10-16 18:58:02)

Offline

#10 2011-10-16 19:03:18

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] moving root / from btrfs partition to ext4 one

You'll need to post your mkinitcpio.conf and the contents of the image that go with that config for me to make any sense of this. I think you're misunderstanding the role of mkinitcpio as opposed to udev and modprobe...

Offline

#11 2011-10-16 19:09:46

Vi0L0
Member
From: Poland
Registered: 2009-06-24
Posts: 1,349
Website

Re: [SOLVED] moving root / from btrfs partition to ext4 one

aaah... i rly missunderstood smile
first of all - my ext4 was in MODULES, but in rc.conf, not mkinitcpio.conf, ooops! sorry! hmm
i'm kinda tired today...

but anyway doesn't `filesystems` in HOOKS serve such simple thing like adding all loaded fs modules into initramfs?
EDIT: in mkinitcpio.conf's comments i found:

# 'filesystems' is _required_ unless you specify your fs modules in MODULES

so i guess it should to add this ext4 module into initramfs even if ext4 is not in mkinitcpio.conf's MODULES or am i rly rly missing something?

BTW: from / on btrfs here's my:
- /etc/mkinitcpio.conf:

MODULES=""
BINARIES=""
FILES=""
HOOKS="base udev autodetect pata scsi sata dmraid filesystems usbinput consolefont"

- lsinitcpio initramfs-linux.img: http://hpaste.org/52699
+

# lsmod | grep ext
ext2                   61004  1
ext4                  257609  1
mbcache                 5521  2 ext2,ext4
jbd2                   52164  1 ext4
crc16                   1257  1 ext4

Last edited by Vi0L0 (2011-10-16 19:25:45)

Offline

#12 2011-10-16 20:28:32

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] moving root / from btrfs partition to ext4 one

The image that boots the btrfs root is not at all interesting to me. It works.

Where is lsmod coming from? Surely that's after you've booted, which is completely irrelevant to the situation.

I maintain that the problem is that the ext4 modules do not exist on the initramfs you're creating.

Offline

#13 2011-10-16 21:53:45

Vi0L0
Member
From: Poland
Registered: 2009-06-24
Posts: 1,349
Website

Re: [SOLVED] moving root / from btrfs partition to ext4 one

falconindy wrote:

The image that boots the btrfs root is not at all interesting to me. It works.

Where is lsmod coming from? Surely that's after you've booted, which is completely irrelevant to the situation.

I should be more specific, yes it comes from booted system. And as i told before - i can not list ext4 in [ramfs #].
But why i put it here is that i want to know:

Vi0L0 wrote:

anyway doesn't `filesystems` in HOOKS serve such simple thing like adding all loaded fs modules into initramfs?
EDIT: in mkinitcpio.conf's comments i found:

# 'filesystems' is _required_ unless you specify your fs modules in MODULES

so i guess it should to add this ext4 module into initramfs even if ext4 is not in mkinitcpio.conf's MODULES or am i rly rly missing something?

Looks like even you, falconindy, thought that `filesystems` hook should to work:

falconindy wrote:

Sounds like you forgot to add 'ext4' to MODULES or 'filesystems' to HOOKS in your mkinitcpio.conf.

If it's able to add only 1 filesystem - then why is it called `filesystems`?



falconindy wrote:

I maintain that the problem is that the ext4 modules do not exist on the initramfs you're creating.

Yes, indeed. If i will add it to mkinitcpio's MODULES then there's no problem.

Anyway i think that we can close this topic.

Offline

#14 2011-10-16 22:06:15

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] moving root / from btrfs partition to ext4 one

Vi0L0 wrote:

If it's able to add only 1 filesystem - then why is it called `filesystems`?

Because you're looking at it in the context of the autodetect hook, which will prune all filesystems down to the one used by the current root device. There's no way of telling mkinitcpio that your root isn't really the current root other than by explicitly providing the module for the FS. If you were to boot onto the ext4 root and recreate the initramfs with the autodetect and filesystems hook, it would correctly add ext4 instead of btrfs.

Offline

#15 2011-10-16 22:17:53

Vi0L0
Member
From: Poland
Registered: 2009-06-24
Posts: 1,349
Website

Re: [SOLVED] moving root / from btrfs partition to ext4 one

Ok. And yes - it is correctly adding ext4 instead of btrfs.
Thank you falconindy one more time. You teached me a lot of new things, good luck Sir

Last edited by Vi0L0 (2011-10-16 22:18:15)

Offline

#16 2018-11-07 22:59:03

Magnesium
Member
Registered: 2016-11-08
Posts: 19

Re: [SOLVED] moving root / from btrfs partition to ext4 one

what I made:
- saved root files with cp -aRv to a temporary location
- inserted the archlinux install usb drive
- created a new ext4 partition to be the new root
- copied the old files to the new ext4 partition
- mounted the partitions and swaps
- generated new fstab since its a new root and UUID (genfstab -U)
- chrooted
- grub-mkconfig -o /boot/grub/grub.cfg
- mkinitcpio - p linux

I think that was all. Hope not to messed up with files permissions.

Offline

#17 2018-11-08 00:06:12

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,786
Website

Re: [SOLVED] moving root / from btrfs partition to ext4 one


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Online

Board footer

Powered by FluxBB