File System Access Utilities in Userland (fs-utils)



About (top)

The aim of this project is to have a set of utilities to access and modify a file system image without having to mount it (you do not have to be root, you just need read/write access to the image).

It started as a GSoC 2008 project.

It relies on the ukfs library and the rump framework, so as to use the file systems source code from the kernel instead of duplicating it. By doing so, it benefits from the widely tested sources from the kernel. As mentioned by Antti Kantee, the kernel sources can also benefit from the testing and slightly different usage patterns provided by this project.

These programs have been, of course, released under the 2-clause BSD license.

Supported File Systems (top)

  • block device based file systems: cd9660, efs, ext2, hfs, ffs, fat, lfs, ntfs, sysvbfs, udf
  • memory based file systems: tmpfs
  • network based file systems: nfs
  • fuse/refuse based file systems: e.g. sshfs, ntfs-3g

Installing (top)

fs-utils is now in pkgsrc (pkgsrc/filesystems/fs-utils). It requires a userland build from the source from September 3rd (20080903) or newer. There is no need to add specific options in the kernel.

The latest version of the source code is available on the NetBSD cvs repository in the othersrc module.

You can get it with :

$ export CVS_RSH=ssh
$ export CVSROOT=anoncvs@anoncvs.NetBSD.org:/cvsroot
$ cvs co -PA othersrc

Then install with (it will be installed in /usr/local) :

$ cd othersrc/lib
$ make includes ; make ; make install
$ cd ..
$ make ; make install

Usage examples (top)

$ fsu_ls ~/rump_ffs.img -l
drwxr-xr-x  2   stacktic wsrc   512     Jul  2 12:57 CVS
-rw-r--r--  1   stacktic wsrc   112     Aug  6  2007 Makefile
-rw-r--r--  1   stacktic wsrc   527     May 31 21:28 Makefile.rump
-rw-r--r--  1   stacktic wsrc   1034    Aug 16  2007 README.dirs
-rw-r--r--  1   stacktic wsrc   453     Sep 10  2007 TODO
drwxr-xr-x  5   stacktic wsrc   512     Jul  2 12:54 fs
drwxr-xr-x  4   stacktic wsrc   512     Jul  2 12:54 include
drwxr-xr-x  5   stacktic wsrc   512     Jul  2 13:21 librump
$ fsu_ls ~/rump_ffs.img -lS fs/lib/libukfs
fs/lib/libukfs:
-rw-r--r--  1   stacktic wsrc   10614   Jul  4 19:24 ukfs.c
-rw-r--r--  1   stacktic wsrc   3991    Jul  4 19:24 ukfs.h
drwxr-xr-x  2   stacktic wsrc   512     Jul  2 12:54 CVS
-rw-r--r--  1   stacktic wsrc   275     Sep  2  2007 Makefile
lrwxr-xr-x  1   stacktic wsrc   32      Jul  2 13:21 obj -> /usr/obj/sys/rump/fs/lib/libukfs
$ fsu_cp ~/rump_ffs.img -v Makefile Makefile2
Makefile -> Makefile2
$ fsu_ls ~/rump_ffs.img -l Makefile2
-rw-r--r--  1   stacktic wsrc   112     Jul  5 12:01 Makefile2
$ fsu_rm ~/rump_ffs.img Makefile2
$ fsu_ls ~/rump_ffs.img -l Makefile2
fsu_ls: Makefile2: No such file or directory
$ fsu_chown ~/rump_ffs.img root:wheel TODO
$ fsu_ls ~/rump_ffs.img -l TODO
-rw-r--r--  1   root wheel      453     Sep 10  2007 TODO
$ fsu_chmod ~/rump_ffs.img -Rvh 664 /
/
/CVS
/CVS/Root
/CVS/Repository
...
$ fsu_ls ~/rump_ffs.img -l
drw-rw-r--  2   stacktic wsrc   512     Jul  2 12:57 CVS
-rw-rw-r--  1   stacktic wsrc   112     Aug  6  2007 Makefile
-rw-rw-r--  1   stacktic wsrc   527     May 31 21:28 Makefile.rump
-rw-rw-r--  1   stacktic wsrc   1034    Aug 16  2007 README.dirs
-rw-rw-r--  1   root wheel      453     Sep 10  2007 TODO
drw-rw-r--  5   stacktic wsrc   512     Jul  2 12:54 fs
drw-rw-r--  4   stacktic wsrc   512     Jul  2 12:54 include
drw-rw-r--  5   stacktic wsrc   512     Jul  2 13:21 librump

Publication (top)

Further Information (top)

You can browse the source code history online.