Other Stuff

UoM::RCS::Talby


Page Contents:


Page Group:

2010:

2009: 2008:


Related Pages:





Archivemount, Tar and CIFS

Motivations

  1. 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.
  2. 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.

Download, Build

  1. Archivemount is not in many (any?) distros yet, so download the source from cybernoia.de
  2. 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
  3. 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

Prerequisites

Usage

Then using archivemount is trivial, for example

  path/to/archivemount my_stuff.tar.gz /mnt/my_stuff
  cd /mnt/my_stuff
Voila:
  1. Add, change and remove files just as if the archive is a standard filesystem;
  2. leave /mnt/my_stuff;
  3. umount /mnt/my_stuff.
The changes made to the /mnt/my_stuff "filesystem" are made to the my_stuff.tar.gz archive.

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.)

Now:

  1. copy a .tar or .tar.gz archive to your CIFS-mounted filesystem;
  2. mount said .tar[.gz] archive via archivemount /mnt/my_cifs_workaround and you get an all-singing, all-dancing Unix/Linux-permissions-respecting filesystem.
  3. 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 vdm
The 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