Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SCRIPT] (un)mount cromfs images, compressed fs, fuse
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message

Joined: 08 Mar 2006
Posts: 282
Location: Dijon > Berlin > Tokyo > Nürnberg > München

PostPosted: Sun Mar 11, 2007 12:18 pm    Post subject: [SCRIPT] (un)mount cromfs images, compressed fs, fuse Reply with quote

I use cromfs to archive finished projects and I wanted to be able to browse them easily with Nautilus (but this script is in no way gnome-specific). I also wanted to be able to unmount them as easily because I am a clean person.

First, install cromfs (from gentoo bug #146694 and try it, it is a read-only fs with an excellent compression ratio. It is very slow at packing (similar to 7z) but since I use it for archiving, I just do it once and do not care about that. It, however, mounts the fs fast and is not memory hungry or CPU hungry anymore when browsing the archive or extracting parts of its contents. That is exactly what it has been designed for!
# (c) Mathias Laurin, Modified BSD License, 2006-03-19, Sydney
# Chose whether to mount or unmount a cromfs archive
# and do it! Can be adapted very easily to other fs.
# Usage: <archive.cromfs>
# for Cromfs: Compressed ROM filesystem for Linux (user-space)
# Requires fuse and cromfs

UMNT_CMD="fusermount -u"

fct_umount() {
   # Unmount

   # Clean
   rmdir "$MNT_DIR"

fct_mount() {
   # Mount

main() {
    # Test extension
    [ ! "${IMG##*.}" = "cromfs" ] && exit 20

    # Make mount point
    [ ! -e "$MNT_DIR" ] && mkdir "$MNT_DIR"

    # Test mount or unmount by checking the contents of the mount point
    if [ "x$(ls -A "$MNT_DIR")" = "x" ]


Then associate the cromfs extension with this script in your fav file browser. Click on the archive to mount it, click it again to unmount, the script decides which to do. The archive will be mounted in a directory with the same name as the cromfs image minus the extension.

If you prefer another type of archive (userspace or not) e.g.: cramfs, squashfs... you just need to change the MNT_CMD and maybe UMNT_CMD as you see fits; have the arguments in there too.

Compress portage tree
Elog viewer
Autodetect swap
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

Jump to:  
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