HOW-TO Setup a AUFS

Write tutorials and howtos in here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please. Before you post please read this

HOW-TO Setup a AUFS

Postby Kayot on Thu Jan 09, 2014 6:14 pm

The Command:
mount -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>


Red is mounted folders
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


Make 4 mounts: I have 4 drives with the drive labels Storage1, Storage2, Storage3, and Storage4. I make 4 folders with the same name and then mount the drives by lable. I also make the pool folder where I'll mount the pool
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


Now I mount an aufs using pmfs as I want to keep my music on one disk, and I have my movies on two disks. I don't want them scattered about should I want to split them apart later.
Code: Select all
mount -t aufs -o br=Storage1=rw:Storage2=rw:Storage3=rw:Storage4=rw -o create=pmfs -o sum none Storage


Now wasn't that fun?
Kayot
Level 1
Level 1
 
Posts: 5
Joined: Tue Sep 25, 2012 9:44 am

Linux Mint is funded by ads and donations.
 

Re: HOW-TO Setup a AUFS

Postby Corvalis on Sat Jan 25, 2014 2:01 pm

I did not know what AUFS was at first. Quick link for others who are curious: https://en.wikipedia.org/wiki/Union_mount
Horace: Sedit qui timuit ne non succederet - He who feared he would not succeed sat still. (For fear of failure, he did nothing.)
Corvalis
Level 1
Level 1
 
Posts: 16
Joined: Wed Dec 19, 2012 7:30 pm


Return to Tutorials / Howtos

Who is online

Users browsing this forum: No registered users and 11 guests