Title: Unionfs: User and CommunityOriented Development of a Unification File System
1Unionfs User- and Community-Oriented Development
of a Unification File System
David Quigley, Josef Sipek, Charles P. Wright,
Erez Zadok Stony Brook University
2Quick Summary
- Unionfs is a stackable file system
- Merges contents of several directories
- Licensed under GPL
- XXX word nicely copy-up is good
- Available at www.unionfs.org
3Overview
- Introduction
- Design Issues
- Performance
- Usage Case Studies
- Status
- Future Work
- Conclusion
4Motivation
- Merge contents of several directories (branches)
- Keep their physical contents separate
- Maintain Unix semantics
- Allow arbitrary branch manipulations
- Add branch
- Remove branch
- Change branch permission mode
- rw, ro
5Background
User Level
User Process
read()
sys_read()
vfs_read()
Virtual File System
Kernel Level
ext2_read()
wrapfs_read()
Ext2
Wrapfs
ext2_read()
6Sample Stackable File systems
7Unionfs Fan-out Stacking
User Process
User Level
read()
sys_read()
vfs_read()
Kernel Level
Virtual File System
ext2_read()
unionfs_read()
- Add/remove branch
- Duplicates
- File changes on RO file systems
Ext2
Unionfs
Upper FS
rw
rw
ro
rw
Ext2
NFS
ISO9660
Lower FS
Left-most (highest priority)
Right-most (lowest priority)
8Branches Example
Unionfs
alice
bob
carol
alice
bob
carol
fsl/dave
fsl/jeff
fsl/jeff
fsl/dave
branch 3
branch 1
branch 2
9Overview
- Introduction
- Design Issues
- Performance
- Usage Case Studies
- Status
- Future Work
- Conclusion
10Design Issues
- Duplicates
- Whiteouts
- Copy-up
11Duplicates
- Problem A file with the same name may exist on
several branches - Solution
- readdir simply eliminate duplicate names
- lookup stop at the first instance
12Duplicates Example
Unionfs
alice
bob
bob
alice
bob
bob
fsl/dave
fsl/jeff
fsl/jeff
fsl/dave
branch 3
branch 1
branch 2
13Whiteouts
- Problem What happens if one wants to remove a
file which resides on a read-only branch? - Solution
- File is masked out by a whiteout
- Whiteout created in a higher priority branch
- readdir remove all instances of the name do
not list the whiteout - lookup return -ENOENT
14Whiteouts Example
Unionfs
alice
bob
carol
alice
bob
carol
.wh.carol
.wh.carol
fsl/dave
fsl/jeff
fsl/jeff
fsl/dave
Whiteout!
branch 3
branch 1
branch 2
15Copy-up
- Problem What if user wants to modify a file on a
read-only branch? - Solution
- Copy the original file up to a higher priority
branch - Let the write through on the new copy
16Copy-up Example
bob
Unionfs
Read-only branch
Read-only branch write fails!
Duplicate eliminated
rw
ro
rw
alice
bob
carol
alice
bob
carol
bob
fsl/dave
fsl/jeff
fsl/jeff
fsl/dave
bob
branch 3
branch 1
branch 2
17Overview
- Introduction
- Design Issues
- Performance
- Usage Case Studies
- Status
- Future Work
- Conclusion
18Performance
- I/O-intensive benchmark
- Postmark simulates the operations of electronic
mail servers - Benchmark configuration
- 20,000 files
- 512-10,240K byte files
- 200,000 transactions
- 200 subdirectories
- CPU-intensive benchmark
- OpenSSH compile
19Postmark
20OpenSSH Compile (dup)
1.16 Elapsed time
2.41 Elapsed time
10.7 Elapsed time
5.26 Elapsed time
3.25 System time
14.0 System time
5.63 System time
10.3 System time
21OpenSSH Compile (dist)
0.99 Elapsed time
1.12 Elapsed time
1.66 Elapsed time
2.10 Elapsed time
4.42 System time
4.85 System time
6.69 System time
7.59 System time
22Overview
- Introduction
- Design Issues
- Performance
- Usage Case Studies
- Status
- Future Work
- Conclusion
23Usage Case Studies
- Live CDs
- SLAX, KNOPPIX, and many more
- NFS/disk-less environment
- Bluetopia (IBM)
- Many other sysadmins
- Snapshotting
- snapmerge
24Live CDs
- Provide user the illusion of being able to write
to the files stored on the CD-ROM - Generally, made up of one writable branch (tmpfs)
and one read-only branch (squashfs, iso, etc.)
mount -t unionfs \ -o dirs/ramdiskrw/KNOPPIXr
o \ /UNIONFS /UNIONFS
25NFS/disk-less environment
- Each client uses a union of a read-only base
system and a writeable storage - Any changes are saved to the writable branch
- Allows the base system to be shared between many
clients
mount -t nfs server/bin /mnt/nfsbins mount -t
nfs server/store/hostname -s\ /mnt/persist mou
nt -t unionfs none /bin o \ dirs/mnt/persist/m
nt/nfsbinsnfsro
26Snapshotting
- Create a consistent image of an entire file
system - When a snapshot is taken at time n
- Mark existing branches file system read-only
- Add a new high-priority branch (tn)
- All writes take place on tn
- Transparently migrate open files on tiltn to tn
- To view snapshot i union ti through t0
- Issues
- Dynamic branch management
- Scalable to many branches
Unionfs
t0
t1
t2
t3
tn
27Overview
- Introduction
- Design Issues
- Performance
- Usage Case Studies
- Status
- Future Work
- Conclusion
28Status
- Out-of-kernel module
- 11,627 lines of code
- Tracking Linux kernel 2.6
- Include user-level utilities and documentation
- Licensed under GPL
29Popularity
- Included in Debian stable
- Included in Gentoo Testing/Masked
- Downloaded by more than 2800 users from 66
countries - Underestimates actual number of end-users
30Users
- Live CD Distributions
- Knoppix 3.8 and newer
- SLAX
- At least two dozen more
- Assorted projects ranging from clusters to
security applications - IBM Bluetopia
31Overview
- Introduction
- Design Issues
- Performance
- Usage Case Studies
- Status
- Future Work
- Conclusion
32Future Work
- Persistent inode map
- Needed by NFS v2 v3
- invariant a file and a whiteout for that file
cannot exist on the same branch - unionfs_fsck would be useful
- Lower file systems cannot be modified directly
- current workaround uniondbg g
- CANNOT be solved without changes to the VFS
- unified cache manager (Heidenmen SOSP '95)
33Overview
- Introduction
- Design Issues
- Performance
- Usage Case Studies
- Status
- Future Work
- Conclusion
34Conclusion
- Unionfs provides a merged view of an arbitrary
number of disparate directories - Used by thousands of end-users
35Questions?
- Unionfs User- and Community-Oriented Development
of a Unification File System
David Quigley, Josef Sipek, Charles P. Wright,
Erez Zadok Stony Brook University
36Opaque Directories
- normally, the contents of directories are merged
and the user is provided with a unified view - what happens if we create a new directory
(unionfs_mkdir)? There might exist a directory on
a lower priority branch whose contents should
_NOT_ be merged (mkdir is supposed to create an
_empty_ directory) - The naive solution is to white out the "contents"
- this is inefficient (many foo_create() calls
make inodes wasted) - The better approach is to make the newly created
directory "opaque" - preventing unionfs from
going further to lower-priority branches
37Opaque Directories Example
Unionfs
Whiteout!
Not-visible
Whiteout!
bob
carol
bob
carol
alice
alice
.wh.fsl
fsl
fsl
fsl/dave
fsl/jeff
fsl/jeff
fsl/dave
fsl/.wh._opaque
Not-visible
branch 3
branch 1
branch 2
38Configuration
- Configfs
- Another dependency
- Already written
- Sysfs
- No new dependency
- No kobjects to represent VFS structures
- Procfs
- Sysfs is prefered
- Custom pseudofs
- No limitations
- Must be implemented from scratch
- IOCTL
- Evil
- Remount
- Complex parser in kernel-space
39nfsro
- NFS returns -EACCES instead of
- -EROFS
- nfsro branch mode was introduced to work around
this issue
40TODO
- Extra slides
- Animation for common operations
- Rename
- Remove