The time now is Tue 18 Jun 2013, 02:17
All times are UTC - 4 |
| Author |
Message |
Uten
Joined: 29 Jan 2008 Posts: 15
|
Posted: Thu 03 May 2012, 12:45 Post subject:
Mounting two or more 2fs files. (Solved, sort of) |
|
Hello,
I wonder if anyone have experimented with mounting two 2fs files at the same time?
Say, I would have the regular 2fs file mounted and then one on top of that to cover my personal stuff like the folders ~/mail, ~/my-documents and ~/web-server.
My understanding of 2fs files are that they are similar to sfs files. We can mount several sfs files and their folder/file structure is transparently placed on top of the previous one. The big difference is that a 2fs file is writable whereas the sfs files are not.
Are there technical challenges to implement my scenario?
Which files should I look at to implement something like this.?
As a side-note I'm already using a separate encrypted img file mounted on my my-documents folder. But it would be so much better if I could cover all my personal folders with one file.
Best reaards
Uten
Last edited by Uten on Fri 04 May 2012, 14:27; edited 1 time in total
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6196 Location: Auckland, New Zealand
|
Posted: Fri 04 May 2012, 05:53 Post subject:
|
|
Only the top layer in a unioned system can be writeable. As you obviously know, you can mount an extra .2fs to any given folder. Or you could just move the other folder into the .img file that contains your my-documents, and create symlinks to them.
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
Uten
Joined: 29 Jan 2008 Posts: 15
|
Posted: Fri 04 May 2012, 07:08 Post subject:
|
|
| disciple wrote: | | Only the top layer in a unioned system can be writeable. |
I think that is a misunderstanding, or only true (a feature if you like), to the way puppylinux uses unionfs. It could also be the case for the system used in the 1.x branche of puppy.
From what I read at http://unionfs.filesystems.org/ and http://en.wikipedia.org/wiki/UnionFS it should be possible to have several read-write layers stacked upon each other. (I have to verify this in regards of loop mounted file images ).
Reading indicates that your claim is true to puppylinux (by design) but not to a unioned system in general.
howpuppyworks.html points me to /sbin/init. I think quite a bit of the code has been moved to /etc/rc.d/rc.update. I'm trying to figure out how works, and how it fits in the puzzle.
I could also go the easy route and use symlinks as you pointed out, but what is the fun in that
|
|
Back to top
|
|
 |
RetroTechGuy

Joined: 15 Dec 2009 Posts: 2303 Location: USA
|
Posted: Fri 04 May 2012, 11:37 Post subject:
|
|
| Uten wrote: | | disciple wrote: | | Only the top layer in a unioned system can be writeable. |
I think that is a misunderstanding, or only true (a feature if you like), to the way puppylinux uses unionfs. It could also be the case for the system used in the 1.x branche of puppy. |
Well, I don't know what is "supposed to happen", but I regularly open .2fs files, to copy, modify, or purge the contents (typically when migrating from one version OS to another).
The only restriction that I've found is that they cannot have the same name (even though in different paths). If the .2fs is corrupted, I think it is restricted to read-only, but unmount the file system, then "fsck /mnt/home/oldjunk/broken.2fs" will scan and repair the file system, and it will mount read-write on the next mount.
Clicking on the file once mounts the file system. Clicking the file a second time umounts the file system.
Edit: Oh, rereading, I see that you just want to chose different mount points. That too can be done (the .2fs files just think that they are independent ext2 partitions).
I solved the email issue by storing it in /mnt/home (I use thunderbird, and just dragged a symlink in as .thunderbird)
_________________ Wellminded Search
Add swapfile
|
|
Back to top
|
|
 |
Uten
Joined: 29 Jan 2008 Posts: 15
|
Posted: Fri 04 May 2012, 14:26 Post subject:
|
|
Thanks for the suggestions.
What I want is the transparent behavior unionfs is designed to handle.
This is my test system:
| Quote: | sh-4.1# cat /etc/DISTRO_SPECS
#One or more words that identify this distribution:
DISTRO_NAME='Lucid '
#A three-digit numeric value, version number of this distribution:
DISTRO_VERSION=528
#A two-digit numeric value, minor-version number of this distribution:
DISTRO_MINOR_VERSION=00
#The distro whose binary packages were used to build this distribution:
DISTRO_BINARY_COMPAT='ubuntu'
#Prefix for some filenames: exs: lupusave.2fs, lupu-528.sfs
DISTRO_FILE_PREFIX='lupu'
#The version of the distro whose binary packages were used to build this distro:
DISTRO_COMPAT_VERSION='lucid'
#the kernel pet package used:
DISTRO_KERNEL_PET='linux_kernel-2.6.33.2-tickless_smp_patched-L3.pet'
#16-byte alpha-numeric ID-string appended to vmlinuz, lupu_528.sfs, zl528332.sfs and devx.sfs:
DISTRO_IDSTRING='l528120404231153'
#Puppy default filenames...
#Note, the 'SFS' files below are what the 'init' script in initrd.gz searches for,
#for the partition, path and actual files loaded, see PUPSFS and ZDRV in /etc/rc.d/PUPSTATE
DISTRO_PUPPYSFS='lupu_528.sfs'
DISTRO_ZDRVSFS='zl528332.sfs'
sh-4.1#
|
This is a mock up. To implement it against /root needs a bit more consideration as there is a lot more going on in that folder than I thought.
First make a img file. In this case it is created on the disk, not in the save file.
| Quote: | | #>dd if=/dev/urandom of=/mnt/home/myroot.img bs=1M count=5 |
Then make a file system on it (use ext2 if you want encryption) and mount
Notice! You should probably not use /tmp on a production system. this is for a demo.
| Quote: |
mkfs.ext2 /mnt/home/myroot.img
mkdir /tmp/myroot
mount -o loop /mnt/home/myroot.img /tmp/myroot
|
Make a test folder with some stuff in
| Quote: |
mkdir -p /tmp/mystuff/my-app
touch /tmp/mystuff/README.txt
|
Then merge the folder and the image. Content in the mount point (folder) will not be visible.
| Quote: |
mkdir /tmp/dirs
mount -t aufs -o br=/tmp/dir1=rw:/tmp/myroot=rw:/tmp/mystuff=rw none /tmp/dirs
|
Check that you find what you expect
I have written this down from the top of my head so be aware of and kind to typos. As I want my img (2fs) files to be encrypted I did all my testing with that, but it complicates the creation of an img file slightly. I will experiment a bit with replacing /root later this weekend.
Best regards
Uten
|
|
Back to top
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|