You are not logged in.

#1 2017-08-14 13:53:30

cdwijs
Member
Registered: 2010-04-24
Posts: 289

Boot from LVM PV that are in reality loopmounted files on a Vfat stick

Hi All,

I would like to install arch linux on a memory stick, but I would like to keep as much space available as Vfat. Therefore I would like to create a few 1GB big files on the Vfat filesystem. Then those files are loop-mounted, and formatted as LVM physical volumes. Then a LVM logical volume is made on them. Lastly, an ext4 filesystem is created in the logical volume. As more or less room is needed for Linux, more or less 1GB files are used on the vfat filesystem. I have done all this, and documented it here:
https://wiki.archlinux.org/index.php/Us … d_DJ_tools

During boot, I need an inird that does the following:
1) mount the vfat partition
2) loop-mount the loopback files
3) mount the LVM logical volume /some/where
4)do a pivot_root to /some/where

How do I explain this to grub?
Do I need to create a small (200-500MB) ext4 /boot partition on the stick?

Is there a simpler way to achieve Linux to co-exist on a vfat filesystem?

Cheers,
Cedric

Offline

#2 2017-08-15 10:38:53

cdwijs
Member
Registered: 2010-04-24
Posts: 289

Re: Boot from LVM PV that are in reality loopmounted files on a Vfat stick

Hi All,

I have not yet tried it myself, but there's a guy on youtube who has loopmounted a file on a NTFS filesystem. By the looks of it, he has added a loopmount hook by editing the following files:
/lib/initcpio/hooks/looproot
/lib/initcpio/install/looproot
/etc/mkinitcpio.conf

https://www.youtube.com/watch?v=T2kDniVE-EQ&t=313s

Cheers,
Cedric

Offline

#3 2017-08-15 14:22:00

cdwijs
Member
Registered: 2010-04-24
Posts: 289

Re: Boot from LVM PV that are in reality loopmounted files on a Vfat stick

After i boot from archlinux-2017.08.01-x86_64.iso, I need to issue the following commands before I can arch-chroot:
mkdir /mnt/targetstick
mount /dev/sda1 /mnt/targetstick
losetup /dev/loop1 /mnt/targetstick/ArchPV1.img
losetup /dev/loop2 /mnt/targetstick/ArchPV2.img
losetup /dev/loop3 /mnt/targetstick/ArchPV3.img
losetup /dev/loop4 /mnt/targetstick/ArchPV4.img
mkdir /mnt/target
mount /dev/mapper/ArchVG-ArchLV /mnt/target
arch-chroot /mnt/target

Now I can start messing around in /lib/initcpio

To be continued :-)
Cheers,
Cedric

Offline

#4 2017-08-15 14:45:48

cdwijs
Member
Registered: 2010-04-24
Posts: 289

Re: Boot from LVM PV that are in reality loopmounted files on a Vfat stick

the guy on youtube has made a chineese howto here:
http://m13253.blogspot.nl/2012/06/insta … pback.html
And somebody has translated it into english:
https://phoenixlzx.github.io/MinoriWiki … -loopback/

Offline

#5 2017-08-15 16:11:01

cdwijs
Member
Registered: 2010-04-24
Posts: 289

Re: Boot from LVM PV that are in reality loopmounted files on a Vfat stick

It turns out i don't know what exactly happens after the PC is booted. I am doing my tests on a virtual machine. I am able to install grub on the memory stick (/dev/sda) and boot from it. I'm also able to create the initial ramdisk, but grub cannot find my kernel.

Is grub smart enough to do all the steps to mount the stick, loopmount the PV's, and mount the LV, and finally boot the kernel and the ramdisk from there?

Or do i have to create a small ext4 partition on the memory stick where /boot lives? Can this partition also be vfat?

Cheers,
Cedric

Offline

#6 2017-08-15 19:45:43

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: Boot from LVM PV that are in reality loopmounted files on a Vfat stick

I told you on your other thread[1] that you would be making things needlessly complicated. The answer to your question is yes, most probably you need/want a separate boot partition. If it is a separate partition I don't see why it has to be vfat.

That said, you are on your own, we don't provide support for random youtube videos and blog posts.

[1] https://bbs.archlinux.org/viewtopic.php?id=228803


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

Board footer

Powered by FluxBB