Red is mounted foldersmount -t aufs -o br=<Source Folder Name>=rw:<Source Folder Name>=rw:<Source Folder Name>=rw:<Source Folder Name>=rw -o create=mfs -o sum none <Destination Folder Name>
Green is how to handle new files
Blue is an empty directory that will become the storage pool
Purple is -o sum which makes it so the mount returns the total free space in the pool
How to handle new files:
tdp - Selects the highest writable branch where the parent dir exists. If the parent dir does not exist on a writable branch, then the internal copyup will happen. The policy for this copyup is always ’bottom-up.’ This is the default policy.
rr - Selects a writable branch in round robin. When you have two writable branches and creates 10 new files, 5 files will be created for each branch. mkdir(2) systemcall is an exception. When you create 10 new directories, all are created on the same branch.
mfs[:second] - Selects a writable branch which has most free space. In order to keep the performance, you can specify the duration (’second’) which makes aufs hold the index of last selected writable branch until the specified seconds expires. The first time you create something in aufs after the specified seconds expired, aufs checks the amount of free space of all writable branches by internal statfs call and the held branch index will be updated. The default value is 30 seconds.
mfsrr:low[:second] - Selects a writable branch in most-free-space mode first, and then round-robin mode. If the selected branch has less free space than the specified value ’low’ in bytes, then aufs re-tries in round-robin mode. Try an arithmetic expansion of shell which is defined by POSIX. For example, $((10 * 1024 * 1024)) for 10M. You can also specify the duration (’second’) which is equivalent to the ’mfs’ mode.
pmfs[:second] - Selects a writable branch where the parent dir exists, such as tdp mode. When the parent dir exists on multiple writable branches, aufs selects the one which has most free space, such as mfs mode.
Example:
First I need the tools.
Code: Select all
Mint@Mint /mnt $ sudo apt-get update
Mint@Mint /mnt $ sudo apt-get install aufs-tools
Code: Select all
Mint@Mint /mnt $ sudo mkdir Storage1 Storage2 Storage3 Storage4 Storage
Mint@Mint /mnt $ sudo mount -L Storage1 Storage1
Mint@Mint /mnt $ sudo mount -L Storage2 Storage2
Mint@Mint /mnt $ sudo mount -L Storage3 Storage3
Mint@Mint /mnt $ sudo mount -L Storage4 Storage4
Code: Select all
mount -t aufs -o br=Storage1=rw:Storage2=rw:Storage3=rw:Storage4=rw -o create=pmfs -o sum none Storage