Maybe I'm confused, but in the OP you said "...or from the IMG file." Apologies if I misunderstood.Thanks, but that's not actually what I am after.
You do know that you can use systemd-nspawn with a directory rather than an IMG, right? sdm can do this using systemd-nspawn:I know about the kernel= line in config.txt, but always good to be reminded about the 4K/16K pagesize - it is a sticking point.
What I want to do is have the container's root FS on a folder somewhere, rather than an IMG file, so it's more about how to get from the IMG file, or an SD card, and what (if anything) I could prune from it as it won't be needed, even if I use the -b option.
Code:
pw/ssdy/work$ ls -l /ssdy/work/test/sdmtotal 64lrwxrwxrwx 1 root root 7 Jul 3 17:04 bin -> usr/bindrwxr-xr-x 3 root root 4096 Jul 3 17:14 bootdrwxr-xr-x 4 root root 4096 Jul 3 17:04 devdrwxr-xr-x 89 root root 4096 Aug 8 09:02 etcdrwxr-xr-x 3 root root 4096 Jul 3 17:05 homelrwxrwxrwx 1 root root 7 Jul 3 17:04 lib -> usr/liblrwxrwxrwx 1 root root 25 Aug 8 09:02 lib64 -> usr/lib/aarch64-linux-gnudrwx------ 2 root root 4096 Jul 3 17:13 lost+founddrwxr-xr-x 2 root root 4096 Jul 3 17:04 mediadrwxr-xr-x 2 root root 4096 Jul 3 17:04 mntdrwxr-xr-x 3 root root 4096 Jul 3 17:06 optdrwxr-xr-x 2 root root 4096 Jul 3 17:04 procdrwx------ 3 root root 4096 Aug 8 09:02 rootdrwxr-xr-x 8 root root 4096 Jul 3 17:04 runlrwxrwxrwx 1 root root 8 Jul 3 17:04 sbin -> usr/sbindrwxr-xr-x 2 root root 4096 Jul 3 17:04 srvdrwxr-xr-x 2 root root 4096 Mar 29 10:20 sysdrwxrwxrwt 2 root root 4096 Jul 3 17:04 tmpdrwxr-xr-x 11 root root 4096 Jul 3 17:04 usrdrwxr-xr-x 11 root root 4096 Jul 3 17:04 varpw/ssdy/work$ sudo sdm --explore --directory /ssdy/work/test/sdm* Enter Directory '/ssdy/work/test/sdm'# NOTE: Now running in the systemd-nspawn container using the directory treeroot@sdm:/# root@sdm:/# root@sdm:/# ls -a. .. bin boot dev etc home lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr varroot@sdm:/#
Yes, but similarly you can run out of disk space on the SD card when using a directory tree with systemd-nspawn. No difference. Just extend the IMG as needed before you use a disk-hungry operation. Of course, you're still limited by the size of the disk.If I used an IMG, while it would limit the amount of space I needed, it might also constrain what I was doing for that reason, typically running a build.
Yes, of course, as long as systemd-nspawn is not active on the container. It's just a collection of files...I am considering having a lite OS image running on the hardware directly (with systemd-container installed, then having two containers, a lite-64 build environment, and a lite-32 build environment.
Presumably, the container FS images can be backed up/restored with no ill-effects (provided they are inactive at the time!)?
Statistics: Posted by bls — Wed Sep 04, 2024 6:15 pm