squashfs rootfs

Moderators: mdrjr, odroid

squashfs rootfs

Unread postby frares » Wed Nov 15, 2017 2:39 am

Hi.

I would like to build a read-only squashfs for my root filesystem, and using unionfs, mount read-write partitions from an external USB drive on top of the read only squashfs.

Besides including squashfs to the kernel, what else should I do to make the kernel see the squashfs partition at boot?

Thank you!
frares
 
Posts: 11
Joined: Thu May 18, 2017 3:10 am
languages_spoken: english, portuguese
ODROIDs: XU4

Re: squashfs rootfs

Unread postby frares » Wed Nov 15, 2017 2:55 am

By the way, I'm using a XU-4 with a Gentoo distro, updated kernel from git.
frares
 
Posts: 11
Joined: Thu May 18, 2017 3:10 am
languages_spoken: english, portuguese
ODROIDs: XU4

Re: squashfs rootfs

Unread postby tobetter » Wed Nov 15, 2017 1:52 pm

I haven't test this, probably the squashfs driver should be builtin in kernel and you would change kernel parameter to assign the root file system with UUID of your USB stick. You would read 'boot.ini' that contains many boot configuration.
tobetter
 
Posts: 2081
Joined: Mon Feb 25, 2013 10:55 am
Location: Kitchener, ON, Canada
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1

Re: squashfs rootfs

Unread postby frares » Thu Nov 16, 2017 10:44 pm

Thanks tobetter,

I have made some progress, but still no access to squashfs root partition.

I did not made myself clear enough: the USB disk is used only during file intensive R/W tasks, such as package builds (Gentoo distro builds all packages from source code). The development system uses the same partitioning as the Ubuntu image, with some directories mounted in that USB disk. The root file system of the production equipment filesystem will have to work in a squashfs partition in the same SD card as the kernel boot partition. Through "unionfs", some writable layers (some in tmpfs, some in another partition in the same SD card) are bound to that read-only squashfs root partition. So, in the same SD card, I have 3 partitions, a vfat containing the kernel, a squashfs containing the root file system, and a ext4 partition containing the writable /var directory that will be bound to read-only counterparts in the squashfs root partition. This scheme already works in a x86-64 system, with the difference it resides on DOM SATA flash;

So, this is (part of) the /etc/fstab:

Code: Select all
/dev/mmcblk1p1  /boot           vfat            noauto,noatime                                            1 2
/dev/mmcblk1p2  /               squashfs        noatime,ro                                                0 1
/dev/mmcblk1p3  /.var.rw        ext4            noatime,defaults                                          0 2
union           /var            unionfs         default_permissions,allow_other,use_ino,nonempty,suid,cow,dirs=/.var.rw=rw:/.var.ro=ro  0 0
tmpfs           /.etc.rw        tmpfs           defaults,mode=755                                         0 0
union           /etc            unionfs         default_permissions,allow_other,use_ino,nonempty,suid,cow,dirs=/.etc.rw=rw:/.etc.ro=ro  0 0
tmpfs           /.home.rw       tmpfs           defaults                                                  0 0
union           /home           unionfs         default_permissions,allow_other,use_ino,nonempty,suid,cow,dirs=/.home.rw=rw:/.home.ro=ro  0 0
tmpfs           /tmp            tmpfs           defaults                                                  0 0


And the root file system listing:

Code: Select all
 # ls -a
.  ..  bin  boot  dev  etc  .etc.ro  .etc.rw  home  .home.ro  .home.rw  lib  media  opt  proc  root  run  sbin  sys  tmp  usr  var  .var.ro  .var.rw


The boot itself rolls out as expected, but AFAIK, when it tries to revert to the final root file system, it says that the device /dev/mmcblk1p2 (where the root file system is) does not exist. A bit later, it presents a shell, where I was able to "ls /dev/mmcblk1p2" with success.

Any hints?

Thank you!
frares
frares
 
Posts: 11
Joined: Thu May 18, 2017 3:10 am
languages_spoken: english, portuguese
ODROIDs: XU4

Re: squashfs rootfs - SOLVED

Unread postby frares » Fri Nov 17, 2017 3:41 am

SORRY!

squashfs was built as a module!

Now everything just works as expected.

Thank you all!!
frares
 
Posts: 11
Joined: Thu May 18, 2017 3:10 am
languages_spoken: english, portuguese
ODROIDs: XU4

Re: squashfs rootfs

Unread postby odroid » Fri Nov 17, 2017 9:48 am

Thank you for sharing the test result.
We will try to make squashfs / unionfs as a built-in driver in Kernel 4.14.
User avatar
odroid
Site Admin
 
Posts: 25040
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID


Return to Other OS

Who is online

Users browsing this forum: No registered users and 6 guests