Chinaunix首页 | 论坛 | 博客
  • 博客访问: 216866
  • 博文数量: 60
  • 博客积分: 2440
  • 博客等级: 大尉
  • 技术积分: 530
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-12 16:38
文章分类

全部博文(60)

文章存档

2011年(2)

2010年(16)

2009年(42)

我的朋友

分类: LINUX

2009-05-26 09:43:37

Aufs is  a  stackable  unification  filesystem  such as Unionfs, which unifies several directories and provides a merged single directory.  In the early days, aufs was entirely re-designed and re-implemented Unionfs Version  1.x series.  After many original ideas, approaches and improvements, it becomes totally different from Unionfs while keeping the basic features. See Unionfs Version 1.x series for the basic features.  Recently, Unionfs Version 2.x series begin taking some of same approaches to aufs's.

下面是一个小例子:

mkdir -pv ~/mywork/testdir

cd ~/mywork/testdir

mkdir union tmpptr rodir

# 用一个iso镜像文件作为只读文件系统

sudo munt -o loop /opt/ubuntu-xxx.iso ./rodir

# 测试一下这个只读系统;casperiso里面的一个目录

sudo touch rodir/casper/isrw

# shell会提示:touch: 无法 touch “isrw”: 只读文件系统

# 说明的确是只读的。

# 将可读写的tmpfs挂载在./tmpptr上,它是可读写文件系统

sudo mount -t tmpfs tmpfs ./tmpptr

touch ./tmpptr/isrw_tmpfs

ls tmpfsptr/isrw_tmpfs

# 会发现有了isrw_tmpfs文件,证明tmpfs的可读写性。

# ./tmpptr作为可读写分支(即顶极/最左分支),将./rodir作为只读分支,挂载aufs

# 文件系统到./union;注意分支列表中的路径必须是绝对路径,而且不能有shell环境变量,如你不能用~代替/home/taoer/:

sudo mount -t aufs -o xino=/tmp/.aufs.xino, \

br:/home/taoer/mywork/testdir/tmpptr \

:/home/taoer/mywork/testdir/rodir \

aufs ./union

cd ./union

sudo touch casper/isrwreal

ls casper/isrwreal

# 会发现这个文件可以被创建了,而原先casperiso镜像里边的的一个目录,是不可

# 读写的,但是现在,我们让他变得“可写”了。

# 卸载掉aufs

cd ../

sudo umount -t aufs ./union

# 查看./tmpptr

ls ./tmpptr

你会发现除了isrw_tmpfs文件外,竟然多出了个isrwreal文件,而这个文件分明是在./union/casper/创建的!
这就是aufs强大所在。




阅读(3865) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~