Next: , Up: Crash Tolerance   [Contents][Index]


16.1 Using Proper Filesystem

Use a filesystem that supports reflink copying. Currently XFS, BtrFS, and OCFS2 support reflink. You can create such a filesystem if you don’t have one already. (Note that reflink support may require that special options be specified at the time of filesystem creation; this is true of XFS.) The most conventional way to create a filesystem is on a dedicated storage device. However it is also possible to create a filesystem within an ordinary file on some other filesystem.

For example, the following commands, executed as root, will create a smallish XFS filesystem inside a file on another filesystem:

mkdir XFS
cd XFS
truncate --size 512m XFSfile
mkfs -t xfs -m crc=1 -m reflink=1 XFSfile
mkdir XFSmountpoint
mount -o loop XFSfile XFSmountpoint

The XFS filesystem is now available in directory XFSmountpoint. Now, create a directory where your unprivileged user account may create and delete files:

cd XFSmountpoint
mkdir test
chown user:group test

(where user and group are the user and group names of the unprivileged account the application uses).

Reflink copying via ioctl(FICLONE) should work for files in and below this directory. You can test reflink copying using the GNU cp program:

cp --reflink=always file1 file2

See reflink in GNU Coreutils.

Your GNU dbm database file and two snapshot files described below must all reside on the same reflink-capable filesystem.