Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (4) </ 1 2 3 [4] >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: unionfs examples, using unionfs for a variety of things< Next Oldest | Next Newest >
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: April 29 2006,20:11 QUOTE

I am going to look into this as it relates to UCI type extensions and how much integration into core is possible given the size limitation.
I know I could make it work like dsl-n. But size constraints will prevent that level.


Edited by roberts on April 29 2006,20:12
Back to top
Profile PM WEB 
clacker Offline





Group: Members
Posts: 570
Joined: June 2004
Posted: April 30 2006,22:15 QUOTE

I tried making a version of mkwriteable for unionfs but I ran into a few snags.  Most of the directories were easy to handle: I created two new directories in /ramdisk for each one, the first using the base name (for the new mount point) and the second with  "_holder" added to the name (for the writeable area).  Then I used the /KNOPPIX/whatever directory in the unions.

for example, for the bin directory I might do:

Code Sample
mkdir /ramdisk/bin
mkdir /ramdisk/bin_holder
mount -t unionfs -o dirs=/ramdisk/bin_holder=rw:/KNOPPIX/bin=ro unionfs /ramdisk/bin
ln -sf /ramdisk/bin /


Then I tried to streamline this for all of the directories I needed.  The /etc and /var directories were harder, and require some care at shutdown.  For /etc I had to make a copy of the existing /etc directory and copy the /etc/mtab into it.  For whatever reason I wasn't able to overwrite the link from /var -> /ramdisk/var.  I don't know why that happened either but I did work around it.

Code Sample
#!/bin/bash


#first handle the easy directories
for i in bin boot lib sbin usr
do
    mkdir /ramdisk/$i
    mkdir /ramdisk/${i}_holder
    mount -t unionfs -o dirs=/ramdisk/${i}_holder=rw:/KNOPPIX/$i=ro unionfs /ramdisk/$i
    ln -sf /ramdisk/$i /
done

# Then take care of /etc by making a copy of it
mkdir /ramdisk/etc_holder
mkdir /ramdisk/etc
cp -rp /etc /ramdisk/etc_copy
mount -t unionfs -o dirs=/ramdisk/etc_holder=rw:/ramdisk/etc_copy=ro unionfs /ramdisk/etc
# copy mtab or their may be problems since there is another entry in the current one
cp /etc/mtab /ramdisk/etc/mtab
rm -rf /etc
ln -sf /ramdisk/etc /

# to undo the above section you need the following:
#      rm /etc
#      cp -r /ramdisk/etc_copy /etc
#      umount /ramdisk/etc

# now handle the /var directory
mkdir /ramdisk/var
mkdir /ramdisk/var_holder
mv /ramdisk/var /ramdisk/var_old
mount -t unionfs -o dirs=/ramdisk/var_holder=rw:/KNOPPIX/var=ro:/ramdisk/var_old=ro unionfs /ramdisk/var

# to undo the above section you need the following:
# umount /ramdisk/var
# rm -r /ramdisk/var
# mv /ramdisk/var_old /ramdisk/var


It's a lot like mkwriteable, using links to unionfs mounted directories in the /ramdisk directory.  Once you have the /ramdisk/bin mounted, you can use unionctl to meld more /opt/whatever/bin directories with it.

Is there a file that gets run at shutdown, before anything is unmounted automatically?  If so I could add the lines I nned to unmount the /ramdisk/etc and /ramdisk/var direstories.  The other directories work fine.

I didn't think it was as easy as mounting / as a union as read/write because /ramdisk is under / and there would be a nasty loop with the writeable part of the mount then.
Back to top
Profile PM 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: April 30 2006,23:12 QUOTE

Given the fact that DSL targers low(er) ram, old(er) machines.
My interest is more in the area of easily deploying uci type extenions. Using unionfs to avoid the library and binary pathing issues.  Also trying to achieve that mkwriteable is not necessary. That only mountpoints are used in the union.  This would be a watershed for our target base of less capable machines. For example, I just made an abiword.uuci.
I could certainly make dsl like dsl-n and have the entire fs writeable via a boot option in linuxrc. But then it would be easily overrun on trying to install every conceivable type of extension or package. I am not sure of proceeding in that direction.
Of course anyone can always write code to do what they want. Just wanted to share my thoughts and direction in this area.
Back to top
Profile PM WEB 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: April 30 2006,23:18 QUOTE

Quote
Is there a file that gets run at shutdown, before anything is unmounted automatically?  If so I could add the lines I nned to unmount the /ramdisk/etc and /ramdisk/var direstories.  The other directories work fine.


There are two levels of such a file.

/usr/local/bin/exitcheck is when just before X is stopped.
This will allow X type messages and prompts to still function before shutdown of X

/opt/powerdown.sh is the system wide power down script.
This is where I clean up dynamic icons and menus,unmount uci's etc.
Back to top
Profile PM WEB 
meo Offline





Group: Members
Posts: 552
Joined: April 2004
Posted: May 18 2006,22:41 QUOTE

Hello clacker!

Very nice work! Thanks for explaining some of the use of unionfs.dsl as well. It might come in handy for me since I'm making remasters quite frequently. Thanks again!

Have fun all you guys,
regards meo


--------------
"Live and let live"   Treat others the way you want to be treated because that's what you should expect from them.

"All that is very well," answered Candide, "but let us cultivate our garden." - Francois-Marie Arouet Voltaire
Back to top
Profile PM 
19 replies since April 17 2006,02:50 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (4) </ 1 2 3 [4] >/
reply to topic new topic new poll
Quick Reply: unionfs examples

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code