unmounting unionfs

Soldato
Joined
27 Oct 2006
Posts
7,572
Location
London
Inspired by this thread (http://forums.overclockers.co.uk/showthread.php?t=17702884) I am happily using unionfs.

Only snag is that the kernel panics when trying to unmount it.

Anyone know whats the procedure for shutting it down ?

I've got this script to create the unionfs :

echo "Mounting gw disks in read-write mode"
echo "..."
mount 10.0.0.10:/disk2 /mnt/gw-disk2/
mount 10.0.0.10:/disk3 /mnt/gw-disk3/
mount 10.0.0.10:/disk4 /mnt/gw-disk4/
mount 10.0.0.10:/disk5 /mnt/gw-disk5/
mount 10.0.0.10:/disk7 /mnt/gw-disk7/
mount 10.0.0.10:/disk8-ultra-install/STORAGE /mnt/gw-disk8/
echo "Done."
echo ""
echo "Mounting b2 disks in read-write mode"
echo "..."
mount 10.0.0.233:/disk1/Storage /mnt/b2-disk1/
mount 10.0.0.233:/disk2 /mnt/b2-disk2/
echo "Creating unionfs"
echo ""
mount -t unionfs -o rw,dirs=/mnt/gw-disk2=rw null /mnt/gw-union
unionctl /mnt/gw-union --add --mode rw /mnt/gw-disk3
unionctl /mnt/gw-union --add --mode rw /mnt/gw-disk4
unionctl /mnt/gw-union --add --mode rw /mnt/gw-disk5
unionctl /mnt/gw-union --add --mode rw /mnt/gw-disk7
unionctl /mnt/gw-union --add --mode rw /mnt/gw-disk8
unionctl /mnt/gw-union --add --mode rw /mnt/b2-disk1
unionctl /mnt/gw-union --add --mode rw /mnt/b2-disk2

Am I doing something wrong ?
 
It should unmount cleanly with no special commands needed. Are you using the latest version? - there are some nasty bugs involving NFS which are fixed in the latest version. I use unionfs quite a bit for various parts of netbooting and custom livecds and haven't had a problem with unionfs 1.5pre on 2.6.19 kernel, had quite a few kernel panics on previous versions/kernels, though.

I've noticed that the ebuild for unionfs 1.5pre in Gentoo turns on -DNFS_SECURITY_HOLE when compiling the source with the "nfs" USE flag enabled ... no idea what it does, but could be something :)

If you want something thats potentially more stable, albeit rather slower, theres a unionfs-like module for FUSE. Since it runs in userspace, it doesn't clobber your kernel when it goes wrong.
 
matja said:
It should unmount cleanly with no special commands needed. Are you using the latest version? - there are some nasty bugs involving NFS which are fixed in the latest version. I use unionfs quite a bit for various parts of netbooting and custom livecds and haven't had a problem with unionfs 1.5pre on 2.6.19 kernel, had quite a few kernel panics on previous versions/kernels, though.

I've noticed that the ebuild for unionfs 1.5pre in Gentoo turns on -DNFS_SECURITY_HOLE when compiling the source with the "nfs" USE flag enabled ... no idea what it does, but could be something :)

If you want something thats potentially more stable, albeit rather slower, theres a unionfs-like module for FUSE. Since it runs in userspace, it doesn't clobber your kernel when it goes wrong.

Thanks again for helping mate.

Yes as per your post yesterday I was very sloppy and just did n apt-get install on my kubuntu 6.10 laptop - quick read of a howto and I was up n running.

yes I do believe I must be running an old version so I'll probably do it properly by building from source but u mention

" If you want something thats potentially more stable, albeit rather slower, theres a unionfs-like module for FUSE. Since it runs in userspace, it doesn't clobber your kernel when it goes wrong. "

Whats this ?? Whats the module ?
 
OK I'm doing some reading and I see what fuse is.

INTERESTING stuff... soz for being a newb I'm a 2.4 guy the 2.6 kernel suprises me everyday.

So fuse can also mount images I always wanted to be be able to double click .iso from konquerer to get an automount. So I take it fuse is the way to go then ?
 
Sorry, I can't remember the name of the FUSE module for union mounts... I used it back on 2.4 kernel when unionfs was too flaky to use. More and more things are being implemented via FUSE - the initial ports of the Sun Solaris ZFS project to Linux, NTFS-3G read/write NTFS support, etc. I'd try to get unionfs working first, as the latest version appears to be stable. If that doesn't work check out the unionfs-like module for FUSE - it'll be a bit slower but userspace drivers tend to be more stable, generally because they're easier to implement.
 
matja said:
I've never tried aufs :o I'll give it a go this afternoon :D

Good luck mate. EDIT let us know how you get on

I'm going to give version 2 of unionfs a go my dmesg shows this
[17191362.224000] Registering unionfs 1.1.4

Could all end in tears as my main kubuntu box has the bog standard kernel on it with dmraid.

Wonders if there is an easy way to export its settings for the new kernel like in the good old 2.4 days by using make oldconfig
 
gzcat /proc/config.gz > /usr/src/newkernel/.config
cd /usr/src/newkernel
make oldconfig
- should do the trick
 
From google.

> don't trust the old config. I don't think it is compiled in. It would be
> useful to have /proc/config.gz to see what the compiled in config was of
> the running kernel, but this isn't compiled in, either...

/boot/config-$(uname -r)

So all is not lost but having a look in there I noticed that I'll have to build another initrd as dmraid is in there. Ahhhhhhhhh wtf I'll try some stuff if it works it works otherwise try other options like building clean.

This is going to be messy :eek: Now do you blame me for being lazy with apt-get lol
 
matja said:
I blame you for using ubuntu :( lol

LOL Its better than using windows ! Soz mate I started using linux as a desktop seriously around 4 months back things have changed a hell of a lot since redhat 5 and 6 :)

ps the machines that I am unionfs'ing over NFS are very old redhat installs : Hardware has been upgraded but their installs have not :eek: I am just testing via my desktop machines / laptop.
 
Grrrrrrr

Buildt a kernel for the old server so that the union is local which is the way it should be but cant make a union :rolleyes:

So Whats wrong with these statements ? They only seem to mount disk3 only grrrr

# mount -t unionfs -o dirs=/disk3=rw:/disk4=rw unionfs /mnt/union
mount -t unionfs -o dirs=/disk3:/disk4 unionfs /mnt/union

All looks good with no error messages in logs :confused:

uname -a
Linux xxxx 2.6.20-mm2 #1 Tue Mar 13 16:27:18 GMT 2007 i686 unknown

dmesg | grep -i union
Registering unionfs 2.0

PS Where can I get the source from for unionfs-utils ?
 
^^^^ Just an update on that :

It did actually work but df doesn't show correct sizes... probably due to my OS being like 10 years old :rolleyes:

In addition to this from :
linux-2.6.20/Documentation/filesystems/unionfs/issues.txt

2. Modifying a Unionfs branch directly, while the union is mounted, is
currently unsupported. We have tested Unionfs under such conditions, and
fixed any bugs we found (Unionfs comes with an extensive regression test
suite). However, it may still be possible that changes made to lower
branches directly could cause cache incoherency which, in the worst case,
may case an oops. We are currently addressing this problem for Unionfs
and also generically for all stackable file systems, by handing mmap and
introducing small VFS/MM changes that would allow a file system to handle
cache coherency correctly.

Looks like I'll upgrade the OS before risking it with unionfs
 
Back
Top Bottom