Kann ich SYSLINUX veranlassen, eine Root-Datei aus einer Image-Datei auf einer NTFS-Partition zu laden?

3723
Chaos_99

Mit SYSLINUX kann ich von einem FAT16-USB-Stick aus booten, indem ich ein Kernel-Image und ein erstes RAM-Disk-Image (Initrd) von dort lade.

Um mehr Speicherplatz und einen schnelleren Zugriff zu erhalten, kann ich nach dem Booten eine NTFS-Partition von einer Festplatte einhängen und dann mit dem Loopback-Gerät ein Dateisystem-Image von dort einhängen, um / home oder sogar chroot darin zu ersetzen der Startvorgang, wodurch Systemaktualisierungen unmöglich gemacht werden.

Gibt es eine Möglichkeit, SYSLINUX das fs-Image von der NTFS-Partition als root-fs bereitzustellen?

Oder kann ich das initrd-Image so ändern, dass der neue Root-Server früher in den Startvorgang eingebunden wird? Ich weiß, wie man das Image einbindet und ändert, aber ich habe die darin enthaltenen Skripts verloren und weiß nicht, wann und wie sie ausgeführt werden.

2

1 Antwort auf die Frage

2
Chaos_99

Yes, that's possible. And it even works with built-in functions. Just edit your syslinux.cfg to include the following:

LABEL linux LINUX /boot/vmlinuz APPEND root=/dev/disk/by-label/data rootfstype=ntfs loop=images/linux_root.img loopfstype=ext4 rw INITRD /boot/initrd.img 

Obviously, you have to copy your kernel image (vmlinuz) and your initial RAM-disk image (initrd.img) to the FAT partition you want to boot off with SYSLINUX. (The path is relative to the partitions root.)

The root= parameter specifies the device and partition the root file system image lies on. You can of course also use the /dev/sda1 notation or the /dev/disk/by-UUID/SOMECRYPTYCNUMBER version.

The rootfstype specifies the file system of the partition the file system image lies on. NTFS and FAT are both supported out of the box. For more exotic formats you need to edit the initrd.img to include and load the appropriate kernel modules.

loop= gives the path to the root file system image relative to the base of the partition it lies on. loopfstype= specifies its internal type. It will, obviously, be mounted at / after boot. The partition the image was loaded from will me mounted at /host automatically if this folder exists. (You won't be able to mount it anywhere else if it is NOT mounted there atomatically. But you are able to move it to another mount point with mount -m if it is.)

Don't forget to copy and overwrite the kernel and the initrd.img on the FAT partition every time those get updated by a system update or strange things may happen on boot.

Unfortunately, there is no way of including a swap-partition in the same way. You have either to use a real partition for that or try to find a way to activate one after boot from the running system.

Expect approx. 10% CPU overhead for writing into the loop-device mounted through the NTFS-wrapper.

es hängt von / init-Skript in initrd ab eri vor 10 Jahren 0
arbeitete mit den ausgelieferten Skripten der Mint-Distro-Versionen 14 und 15 Chaos_99 vor 10 Jahren 0
Ja, es funktioniert auf jeder Ubuntu-basierten Distribution. eri vor 10 Jahren 0
Ausgezeichnete Fragen und Antworten. Werde es auf jeden Fall versuchen. Ein solches Image-basiertes Root-Dateisystem ist noch korrekt beschreibbar? xpt vor 9 Jahren 0
Ja, das Root-Dateisystem ist beschreibbar. Natürlich nur innerhalb der Grenzen der festen Bildgröße. Chaos_99 vor 9 Jahren 0