Unionfs With Sd Card Possible?


illusionx

Still Fresh
Joined
Jun 4, 2010
Messages
23
Location
Netherlands
Not really sure where to ask this question but I guess here is as good as anywhere.

Is it possible, and if so how, to mount one of the SD cards or an image file on same SD in a union with the NAND and let it have priority over the NAND

Working example, Knoppix does/did this with it's live CD's so you could use the system on an existing PC by booting from the CD but because you had the writable file on your USB stick/HDD you could even update the OS and because the new files had priority over the CD based ones.

That all said I'm guessing just running the whole rootFS from the SD card is probably the easier solution.
 
Linux n00b here, but this is what dflemstr wrote:
dflemstr said:
Just make an ext2 partition on one SD card, then edit your /etc/fstab file to add an union mount over your root (or /usr:/var:/etc or something) et voilà, "the NAND is extended by the SD card" so that everything you write to it gets stored on the SD card. And, when you remove the SD card, you will be on factory settings again.
 
Last edited by a moderator:
mali said:
Linux n00b here, but this is what dflemstr wrote:
dflemstr said:
Just make an ext2 partition on one SD card, then edit your /etc/fstab file to add an union mount over your root (or /usr:/var:/etc or something) et voilà, "the NAND is extended by the SD card" so that everything you write to it gets stored on the SD card. And, when you remove the SD card, you will be on factory settings again.


Woop, exactly what I was looking for thanks mali.

I think I just imagined it being more complex than that :)
 
Last edited by a moderator:
Oops, I didn't actually realise this forum existed or I'd have posted my guides in here.

I've effectively written a guide doing exactly that here: http://www.gp32x.de/board/index.php?/topic/54064-advanced-filesystem-hackery/
So in answer to your question, yes, it's very possible.
 
Last edited by a moderator:
Stuckie said:
Oops, I didn't actually realise this forum existed or I'd have posted my guides in here.

I've effectively written a guide doing exactly that here: http://www.gp32x.de/board/index.php?/topic/54064-advanced-filesystem-hackery/
So in answer to your question, yes, it's very possible.

Yeah I'd gotten about as far as your guide by myself after I'd given up being lazy about looking at it. The big issue I hit trying to do it my own way was 'special device rootfs does not exist' it's impossible to do anything with the rootfs because it doesn't really exist in the way it seems to under a full desktop Linux install.

Something else I did differently too was rather than format my SD card I did a dd if=/dev/zero of=file-fs.ext2 bs=100MB count=6 on the card and then a mke2fs on the file and just mounted that using the loopback as my writable partition.

At least it's keeping me entertained :D
 
Last edited by a moderator:
I don't have my Pandora yet, so I don't know how easy it is to configure the bootloader, or failing that, initrd scripts, to mount the root filesystem from somewhere other than the NAND.

Is it possible to just copy the NAND contents to the SDCard preserving permissions, and configure the bootloader to boot from it instead of the NAND? Seems like an easier solution than union mounts.

The only problem I can see with this is that apps may expect being able to write to the root of the sdcard as they expect it to have user write permissions, but obviously / would be root-controlled and the only area with user permissions would be in /home/username.
 
I already did that copy :) I just don't know how to boot it. There was some talk of a boot.txt (or autoboot.txt I think this forces the boot from SD) that contains the raw commands that you want U-Boot to run on the SD card. However I now need to learn more about U-Boot.

my first attempt

mmcinit
setenv bootargs console=tty1 root=/dev/mmcblk0p1 rw rootfstype=ext2 vram=6272K omapfb.vram=0:3000K
ext2load mmc 1:1 0x82021000 /boot/uImage

failed miserably :( but thats just ripping off stuff I read on the net, so more learning needed :D
 
Mounting your root dir as a unionfs is not as simple as editing your fstab. It has to be done very early in the boot process and therefore requires a modified firmware.

I am working on this, but for various reasons I couldn't finish it this weekend. If anybody manages to get aufs root running before me, please give me a shout. I need it for this: http://pandorawiki.org/Package_Management
 
Back
Top