Jump to content

How to boot from squashfs file ?


milanp

Recommended Posts

Hello,
I have a fully working customized Armbian on OrangePi PC Plus.
There are two partitions, one for the rootfs, second mounted as /home
I want to convert the root partition to squashfs, and use the squashfs file to boot from.
I already converted the root partition to squashfs file, I can mount squashfs file, and the contents are correct.
I even tried to mount it via fstab and it works.
I searched everywhere, obviosly not enough, but I cannot find a way to boot directly from the squashfs file.
The idea is to have only squashfs file and rw partition for /home
Please, can somebody help me, or point me to the right instructions ?
 

Link to comment
Share on other sites

Armbian & Khadas are rewarding contributors

4 часа назад, milanp сказал:

The idea is to have only squashfs file and rw partition for /home

Quite interesting!
If you try to explain your ultimate goal and the reasons that led you to this decision, perhaps I can give you some advice.

Link to comment
Share on other sites

I intend to use opipc's as appliances,with a simple cordova application which is started  upon boot. 
The app uses web services to communicate with the backend, very small database locally.
I had very positive experience with openelec/librelec kodi distributions where all the os+app were in squashfs.
During more than 5-6 years of usage, I never had corrupted filesystem on those systems.
Because of ro access to the squashfs, there's less posibility of corruption of rootfs.
I tested several times to cut of power on the opipcplus, and managed to corrupt the system, so it will not boot.
With squashfs, the rootfs should be more resilient. 
The data corruption of the local db is handled by the cordova app.
Meanwhile I think I found a solution, I should put a script to mount the squashfs in the initrd scripts folder(unpack,recreate initrd with my script inside).
All the tmp,proc... folders should be mounted on persistent storage (I intend to use ext4, on a separate partition).
The /usr/bin+/usr/sbin folder should contain all the needed libraries + executables.
It seems that the script should go in scripts/init-bottom.
This is what I researched today, by learning about the boot chain of linux.
Unfortunatelly, I will be away in the next days, with no time to try.

Edited by milanp
Link to comment
Share on other sites

02.09.2024 в 19:40, milanp сказал:

Because of ro access to the squashfs, there's less posibility of corruption of rootfs.

It's hard to argue with that.
But the squashfs file system is basically an opportunity to use a compressed root file system to save space.

 

If we set the task as ensuring fault tolerance of the root file system, then we need to perform a whole set of measures.
And mounting the root file system with the read-only flag is one of the points.

 

By the way, u-boot is able to work with the squashfs file system.
I thought your question was about that.

 

With respect.

Link to comment
Share on other sites

@robertoj and @going

Many thanks for the replies.

Yesterday I managed to mount squashfs in initramfs, mount the persistent partition in initramfs +  to create overlay for the  squashfs.

I could not create overlay in intitramfs until I installed overlayroot.

@robertoj, I saw that option yesterday,I did not have time to play with it.

Let's see how this works. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines