Archivemount, Tar and CIFS
- Using (mounting) CIFS filesystems on Unix-like systems is easy (e.g., CIFS Stuff); the CIFS Unix extentions may help. But it's all a pain in the butt: file permissions simply do not map in any sensible way between CIFS and Unix/Linux; and there are no s-links.
- Changing the contents of a .tar archive, or .tar.gz file requires a knowledge of arcane flags and a knowledge of the contents of the archive — positively stone-age. Why can't I just mount via the loopback device, like an iso and use all the file-management tools I know and love to browse and play?
Both of these issues are addressed — essentially solved — via Archivemount which, quoting Wikipedia: is a FUSE based file system for Unix variants, including Linux. Its purpose is to mount archives (i.e. .tar, .tar.gz, etc.) to a mount point where it can be read from or written to as with any other file system. This makes accessing the contents of the archive, which may be compressed, transparent to other programs.
- Archivemount is not in many (any?) distros yet, so download the source from cybernoia.de
- I found that I needed a few libraries and devel packages:
apt-get install libfuse-dev apt-get install fuse-utils apt-get install libarchive-dev
- The configure/make/install cycle is standard:
tar xvzf archivemount-0.6.0.tar.gz cd archivemount-0.6.0 ./configure make
Usage: Mounting a .tar or .tar.gz Archive
- Add users to the fuse group (and have them logout and login again if necessary).
Then using archivemount is trivial, for example
path/to/archivemount my_stuff.tar.gz /mnt/my_stuff cd /mnt/my_stuffVoila:
- Add, change and remove files just as if the archive is a standard filesystem;
- leave /mnt/my_stuff;
- umount /mnt/my_stuff.
CIFS Permissions Workaround
Mount your CIFS filesystem in the usual way — with the permissions in their normal SNAFU state, as CIFS does not understand Unix/Linux permissions, at all. (UoM staff and students: mounting your P-Drive is described in the appendix, below.)
- copy a .tar or .tar.gz archive to your CIFS-mounted filesystem;
- mount said .tar[.gz] archive via archivemount /mnt/my_cifs_workaround and you get an all-singing, all-dancing Unix/Linux-permissions-respecting filesystem.
- When finished, unmount the archive; then unmount the CIFS filesystem.
Appendix: Mounting Your P-Drive and UoM
Find out the location of your P-drive:
ldapsearch -x -w "" -H ldap://ldap.manchester.ac.uk -s sub -b "c=uk" "cn=mpciish2" | grep vdmThe location will be something like vdm02-g1.ds.man.ac.uk.
Mounting as root is easy — supply your username. . .
mount -t cifs //vdm02-g1.ds.man.ac.uk/HOME /mnt/pdrive -o username=mpciish2. . . and your password when prompted. Alternatively, put an entry in /etc/fstab to enable unprivileged users to mount their own P-drives:
//vdm02-g1.ds.man.ac.uk/HOME /mnt/pdrive cifs user,noauto,username=mpciish2 0 0