Btrfs文件系统(B-tree FS, Butter-FS)是2007年oracle公司给linux开发的下一代文件系统,
采用了B-tree结构, 文件以盘区(extent)的方式进行分配,
支持子卷, 可写快照(writable snapshot), 快照的快照(snapshot of snapshot),
支持压缩, 动态分配, 支持多设备影射和RAID, 对象级的镜像和条带化,
支持快速离线文件系统检查, 在线碎片整理, 数据和元数据校验等特性
问题也很多, 比如格式没有最终确定, 不支持directio, aio, 不能处理磁盘满, 不能删除快照等
现在仍处于开发阶段,预计未来将会加到Linux内核中
安装一个试试:
1. 下载btrfs
mkdir -p /data/root/btrfs
cd /data/root/btrfs
[root@Perf-pxy-2 ~]# mkdir -p /data/root/btrfs
[root@Perf-pxy-2 ~]# cd /data/root/btrfs
[root@Perf-pxy-2 /data/root/btrfs]#
[root@Perf-pxy-2 ~]# cd /data/root/btrfs
[root@Perf-pxy-2 /data/root/btrfs]#
下载稳定版, v0.16版
wget http://www.kernel.org/hg/index.cgi/btrfs/kernel/archive/tip.tar.gz \
http://www.kernel.org/hg/index.cgi/btrfs/progs/archive/tip.tar.gz
[root@Perf-pxy-2 /data/root/btrfs]# wget http://www.kernel.org/hg/index.cgi/btrfs/kernel/archive/tip.tar.gz \
> http://www.kernel.org/hg/index.cgi/btrfs/progs/archive/tip.tar.gz
--14:41:42-- http://www.kernel.org/hg/index.cgi/btrfs/kernel/archive/tip.tar.gz
Resolving www.kernel.org... 199.6.1.164, 204.152.191.37, 130.239.17.4, ...
Connecting to www.kernel.org|199.6.1.164|:80... connected.
HTTP request sent, awaiting response... 200 Script output follows
Length: unspecified [application/x-tar]
Saving to: `kernel-417d87e57364.tar.gz'
[ <=> ] 174,542 79.4K/s in 2.1s
14:41:46 (79.4 KB/s) - `kernel-417d87e57364.tar.gz' saved [174542]
--14:41:46-- http://www.kernel.org/hg/index.cgi/btrfs/progs/archive/tip.tar.gz
Connecting to www.kernel.org|199.6.1.164|:80... connected.
HTTP request sent, awaiting response... 200 Script output follows
Length: unspecified [application/x-tar]
Saving to: `progs-da35ab2b0b54.tar.gz'
[ <=> ] 127,430 69.6K/s in 1.8s
14:41:48 (69.6 KB/s) - `progs-da35ab2b0b54.tar.gz' saved [127430]
FINISHED --14:41:48--
Downloaded: 2 files, 295K in 3.9s (75.0 KB/s)
[root@Perf-pxy-2 /data/root/btrfs]#
ls -l> http://www.kernel.org/hg/index.cgi/btrfs/progs/archive/tip.tar.gz
--14:41:42-- http://www.kernel.org/hg/index.cgi/btrfs/kernel/archive/tip.tar.gz
Resolving www.kernel.org... 199.6.1.164, 204.152.191.37, 130.239.17.4, ...
Connecting to www.kernel.org|199.6.1.164|:80... connected.
HTTP request sent, awaiting response... 200 Script output follows
Length: unspecified [application/x-tar]
Saving to: `kernel-417d87e57364.tar.gz'
[ <=> ] 174,542 79.4K/s in 2.1s
14:41:46 (79.4 KB/s) - `kernel-417d87e57364.tar.gz' saved [174542]
--14:41:46-- http://www.kernel.org/hg/index.cgi/btrfs/progs/archive/tip.tar.gz
Connecting to www.kernel.org|199.6.1.164|:80... connected.
HTTP request sent, awaiting response... 200 Script output follows
Length: unspecified [application/x-tar]
Saving to: `progs-da35ab2b0b54.tar.gz'
[ <=> ] 127,430 69.6K/s in 1.8s
14:41:48 (69.6 KB/s) - `progs-da35ab2b0b54.tar.gz' saved [127430]
FINISHED --14:41:48--
Downloaded: 2 files, 295K in 3.9s (75.0 KB/s)
[root@Perf-pxy-2 /data/root/btrfs]#
[root@Perf-pxy-2 /data/root/btrfs]# ls -l
total 308
-rw-r--r-- 1 root root 174542 Dec 22 14:41 kernel-417d87e57364.tar.gz
-rw-r--r-- 1 root root 127430 Dec 22 14:41 progs-da35ab2b0b54.tar.gz
total 308
-rw-r--r-- 1 root root 174542 Dec 22 14:41 kernel-417d87e57364.tar.gz
-rw-r--r-- 1 root root 127430 Dec 22 14:41 progs-da35ab2b0b54.tar.gz
解压
tar zxf kernel-417d87e57364.tar.gz
tar zxf progs-da35ab2b0b54.tar.gz
[root@Perf-pxy-2 /data/root/btrfs]# tar zxf kernel-417d87e57364.tar.gz
[root@Perf-pxy-2 /data/root/btrfs]# tar zxf progs-da35ab2b0b54.tar.gz
[root@Perf-pxy-2 /data/root/btrfs]#
[root@Perf-pxy-2 /data/root/btrfs]# tar zxf progs-da35ab2b0b54.tar.gz
[root@Perf-pxy-2 /data/root/btrfs]#
不稳定版本:
http://git.kernel.org/?p=linux/kernel/git/mason/btrfs-unstable.git;a=summary
http://git.kernel.org/?p=linux/kernel/git/mason/btrfs-unstable-standalone.git;a=summary
http://git.kernel.org/?p=linux/kernel/git/mason/btrfs-progs-unstable.git;a=summary
用git下载
git clone http://www.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable-standalone.git
git clone http://www.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs-unstable.git
2. 安装相关的rpm包
rpm -Uvh http://192.168.11.16/CentOS-5.2-x86_64-bin-DVD/CentOS/e2fsprogs-devel-1.39-15.el5.x86_64.rpm
[root@Perf-pxy-2 ~]# rpm -Uvh http://192.168.11.16/CentOS-5.2-x86_64-bin-DVD/CentOS/e2fsprogs-devel-1.39-15.el5.x86_64.rpm
Retrieving http://192.168.11.16/CentOS-5.2-x86_64-bin-DVD/CentOS/e2fsprogs-devel-1.39-15.el5.x86_64.rpm
warning: /var/tmp/rpm-xfer.0N0GT2: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:e2fsprogs-devel ########################################### [100%]
[root@Perf-pxy-2 ~]#
Retrieving http://192.168.11.16/CentOS-5.2-x86_64-bin-DVD/CentOS/e2fsprogs-devel-1.39-15.el5.x86_64.rpm
warning: /var/tmp/rpm-xfer.0N0GT2: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:e2fsprogs-devel ########################################### [100%]
[root@Perf-pxy-2 ~]#
rpm -Uvh http://192.168.11.16/CentOS-5.2-x86_64-bin-DVD/CentOS/libattr-devel-2.4.32-1.1.x86_64.rpm
rpm -Uvh http://192.168.11.16/CentOS-5.2-x86_64-bin-DVD/CentOS/libacl-devel-2.2.39-3.el5.x86_64.rpm
[root@Perf-pxy-2 ~]# rpm -Uvh http://192.168.11.16/CentOS-5.2-x86_64-bin-DVD/CentOS/libattr-devel-2.4.32-1.1.x86_64.rpm
Retrieving http://192.168.11.16/CentOS-5.2-x86_64-bin-DVD/CentOS/libattr-devel-2.4.32-1.1.x86_64.rpm
warning: /var/tmp/rpm-xfer.qz4sPQ: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:libattr-devel ########################################### [100%]
[root@Perf-pxy-2 ~]# rpm -Uvh http://192.168.11.16/CentOS-5.2-x86_64-bin-DVD/CentOS/libacl-devel-2.2.39-3.el5.x86_64.rpm
Retrieving http://192.168.11.16/CentOS-5.2-x86_64-bin-DVD/CentOS/libacl-devel-2.2.39-3.el5.x86_64.rpm
warning: /var/tmp/rpm-xfer.1mMa05: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:libacl-devel ########################################### [100%]
[root@Perf-pxy-2 ~]#
3. 编译和安装
编译和安装内核模块
cd kernel-417d87e57364
make && make modules_install
ls -l /lib/modules/`uname -r`/extra/btrfs.ko
[root@Perf-pxy-2 /data/root/btrfs]# cd kernel-417d87e57364
[root@Perf-pxy-2 /data/root/btrfs/kernel-417d87e57364]#
[root@Perf-pxy-2 /data/root/btrfs/kernel-417d87e57364]# make && make modules_install
bash version.sh
which: no hg in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
make -C /lib/modules/`uname -r`/build M=`pwd` modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-92.el5-x86_64'
CC [M] /data/root/btrfs/kernel-417d87e57364/super.o
CC [M] /data/root/btrfs/kernel-417d87e57364/ctree.o
CC [M] /data/root/btrfs/kernel-417d87e57364/extent-tree.o
CC [M] /data/root/btrfs/kernel-417d87e57364/print-tree.o
CC [M] /data/root/btrfs/kernel-417d87e57364/root-tree.o
CC [M] /data/root/btrfs/kernel-417d87e57364/dir-item.o
CC [M] /data/root/btrfs/kernel-417d87e57364/hash.o
CC [M] /data/root/btrfs/kernel-417d87e57364/file-item.o
CC [M] /data/root/btrfs/kernel-417d87e57364/inode-item.o
CC [M] /data/root/btrfs/kernel-417d87e57364/inode-map.o
CC [M] /data/root/btrfs/kernel-417d87e57364/disk-io.o
CC [M] /data/root/btrfs/kernel-417d87e57364/transaction.o
CC [M] /data/root/btrfs/kernel-417d87e57364/bit-radix.o
CC [M] /data/root/btrfs/kernel-417d87e57364/inode.o
CC [M] /data/root/btrfs/kernel-417d87e57364/file.o
CC [M] /data/root/btrfs/kernel-417d87e57364/tree-defrag.o
CC [M] /data/root/btrfs/kernel-417d87e57364/extent_map.o
CC [M] /data/root/btrfs/kernel-417d87e57364/sysfs.o
CC [M] /data/root/btrfs/kernel-417d87e57364/struct-funcs.o
CC [M] /data/root/btrfs/kernel-417d87e57364/xattr.o
CC [M] /data/root/btrfs/kernel-417d87e57364/ordered-data.o
CC [M] /data/root/btrfs/kernel-417d87e57364/extent_io.o
CC [M] /data/root/btrfs/kernel-417d87e57364/volumes.o
CC [M] /data/root/btrfs/kernel-417d87e57364/async-thread.o
CC [M] /data/root/btrfs/kernel-417d87e57364/ioctl.o
CC [M] /data/root/btrfs/kernel-417d87e57364/locking.o
CC [M] /data/root/btrfs/kernel-417d87e57364/orphan.o
CC [M] /data/root/btrfs/kernel-417d87e57364/ref-cache.o
CC [M] /data/root/btrfs/kernel-417d87e57364/acl.o
LD [M] /data/root/btrfs/kernel-417d87e57364/btrfs.o
Building modules, stage 2.
MODPOST
CC /data/root/btrfs/kernel-417d87e57364/btrfs.mod.o
LD [M] /data/root/btrfs/kernel-417d87e57364/btrfs.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.18-92.el5-x86_64'
make -C /lib/modules/`uname -r`/build M=`pwd` modules_install
make[1]: Entering directory `/usr/src/kernels/2.6.18-92.el5-x86_64'
INSTALL /data/root/btrfs/kernel-417d87e57364/btrfs.ko
DEPMOD 2.6.18-92.el5
make[1]: Leaving directory `/usr/src/kernels/2.6.18-92.el5-x86_64'
[root@Perf-pxy-2 /data/root/btrfs/kernel-417d87e57364]#
[root@Perf-pxy-2 /data/root/btrfs/kernel-417d87e57364]# ls -l /lib/modules/`uname -r`/extra/btrfs.ko
-rw-r--r-- 1 root root 4571860 Dec 22 14:47 /lib/modules/2.6.18-92.el5/extra/btrfs.ko
[root@Perf-pxy-2 /data/root/btrfs/kernel-417d87e57364]#
[root@Perf-pxy-2 /data/root/btrfs/kernel-417d87e57364]#
[root@Perf-pxy-2 /data/root/btrfs/kernel-417d87e57364]# make && make modules_install
bash version.sh
which: no hg in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
make -C /lib/modules/`uname -r`/build M=`pwd` modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-92.el5-x86_64'
CC [M] /data/root/btrfs/kernel-417d87e57364/super.o
CC [M] /data/root/btrfs/kernel-417d87e57364/ctree.o
CC [M] /data/root/btrfs/kernel-417d87e57364/extent-tree.o
CC [M] /data/root/btrfs/kernel-417d87e57364/print-tree.o
CC [M] /data/root/btrfs/kernel-417d87e57364/root-tree.o
CC [M] /data/root/btrfs/kernel-417d87e57364/dir-item.o
CC [M] /data/root/btrfs/kernel-417d87e57364/hash.o
CC [M] /data/root/btrfs/kernel-417d87e57364/file-item.o
CC [M] /data/root/btrfs/kernel-417d87e57364/inode-item.o
CC [M] /data/root/btrfs/kernel-417d87e57364/inode-map.o
CC [M] /data/root/btrfs/kernel-417d87e57364/disk-io.o
CC [M] /data/root/btrfs/kernel-417d87e57364/transaction.o
CC [M] /data/root/btrfs/kernel-417d87e57364/bit-radix.o
CC [M] /data/root/btrfs/kernel-417d87e57364/inode.o
CC [M] /data/root/btrfs/kernel-417d87e57364/file.o
CC [M] /data/root/btrfs/kernel-417d87e57364/tree-defrag.o
CC [M] /data/root/btrfs/kernel-417d87e57364/extent_map.o
CC [M] /data/root/btrfs/kernel-417d87e57364/sysfs.o
CC [M] /data/root/btrfs/kernel-417d87e57364/struct-funcs.o
CC [M] /data/root/btrfs/kernel-417d87e57364/xattr.o
CC [M] /data/root/btrfs/kernel-417d87e57364/ordered-data.o
CC [M] /data/root/btrfs/kernel-417d87e57364/extent_io.o
CC [M] /data/root/btrfs/kernel-417d87e57364/volumes.o
CC [M] /data/root/btrfs/kernel-417d87e57364/async-thread.o
CC [M] /data/root/btrfs/kernel-417d87e57364/ioctl.o
CC [M] /data/root/btrfs/kernel-417d87e57364/locking.o
CC [M] /data/root/btrfs/kernel-417d87e57364/orphan.o
CC [M] /data/root/btrfs/kernel-417d87e57364/ref-cache.o
CC [M] /data/root/btrfs/kernel-417d87e57364/acl.o
LD [M] /data/root/btrfs/kernel-417d87e57364/btrfs.o
Building modules, stage 2.
MODPOST
CC /data/root/btrfs/kernel-417d87e57364/btrfs.mod.o
LD [M] /data/root/btrfs/kernel-417d87e57364/btrfs.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.18-92.el5-x86_64'
make -C /lib/modules/`uname -r`/build M=`pwd` modules_install
make[1]: Entering directory `/usr/src/kernels/2.6.18-92.el5-x86_64'
INSTALL /data/root/btrfs/kernel-417d87e57364/btrfs.ko
DEPMOD 2.6.18-92.el5
make[1]: Leaving directory `/usr/src/kernels/2.6.18-92.el5-x86_64'
[root@Perf-pxy-2 /data/root/btrfs/kernel-417d87e57364]#
[root@Perf-pxy-2 /data/root/btrfs/kernel-417d87e57364]# ls -l /lib/modules/`uname -r`/extra/btrfs.ko
-rw-r--r-- 1 root root 4571860 Dec 22 14:47 /lib/modules/2.6.18-92.el5/extra/btrfs.ko
[root@Perf-pxy-2 /data/root/btrfs/kernel-417d87e57364]#
make modules_install好像有点问题,所以再手工depmod一下
depmod
[root@Perf-pxy-2 ~]# depmod
[root@Perf-pxy-2 ~]#
[root@Perf-pxy-2 ~]#
编译和安装程序
cd ../progs-da35ab2b0b54
make && make convert && make install
ls -l /usr/local/bin/
[root@Perf-pxy-2 /data/root/btrfs/kernel-417d87e57364]# cd ../progs-da35ab2b0b54
[root@Perf-pxy-2 /data/root/btrfs/progs-da35ab2b0b54]#
[root@Perf-pxy-2 /data/root/btrfs/progs-da35ab2b0b54]# make && make convert && make install
bash version.sh
which: no hg in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
ls ctree.c
ctree.c
gcc -Wp,-MMD,./.ctree.o.d,-MT,ctree.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c ctree.c
ls disk-io.c
disk-io.c
gcc -Wp,-MMD,./.disk-io.o.d,-MT,disk-io.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c disk-io.c
ls radix-tree.c
radix-tree.c
gcc -Wp,-MMD,./.radix-tree.o.d,-MT,radix-tree.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c radix-tree.c
ls extent-tree.c
extent-tree.c
gcc -Wp,-MMD,./.extent-tree.o.d,-MT,extent-tree.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c extent-tree.c
ls print-tree.c
print-tree.c
gcc -Wp,-MMD,./.print-tree.o.d,-MT,print-tree.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c print-tree.c
ls root-tree.c
root-tree.c
gcc -Wp,-MMD,./.root-tree.o.d,-MT,root-tree.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c root-tree.c
ls dir-item.c
dir-item.c
gcc -Wp,-MMD,./.dir-item.o.d,-MT,dir-item.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c dir-item.c
ls hash.c
hash.c
gcc -Wp,-MMD,./.hash.o.d,-MT,hash.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c hash.c
ls file-item.c
file-item.c
gcc -Wp,-MMD,./.file-item.o.d,-MT,file-item.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c file-item.c
ls inode-item.c
inode-item.c
gcc -Wp,-MMD,./.inode-item.o.d,-MT,inode-item.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c inode-item.c
ls inode-map.c
inode-map.c
gcc -Wp,-MMD,./.inode-map.o.d,-MT,inode-map.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c inode-map.c
ls crc32c.c
crc32c.c
gcc -Wp,-MMD,./.crc32c.o.d,-MT,crc32c.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c crc32c.c
ls rbtree.c
rbtree.c
gcc -Wp,-MMD,./.rbtree.o.d,-MT,rbtree.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c rbtree.c
ls extent-cache.c
extent-cache.c
gcc -Wp,-MMD,./.extent-cache.o.d,-MT,extent-cache.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c extent-cache.c
ls extent_io.c
extent_io.c
gcc -Wp,-MMD,./.extent_io.o.d,-MT,extent_io.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c extent_io.c
ls volumes.c
volumes.c
gcc -Wp,-MMD,./.volumes.o.d,-MT,volumes.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c volumes.c
ls utils.c
utils.c
gcc -Wp,-MMD,./.utils.o.d,-MT,utils.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c utils.c
ls btrfsctl.c
btrfsctl.c
gcc -Wp,-MMD,./.btrfsctl.o.d,-MT,btrfsctl.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c btrfsctl.c
gcc -g -Werror -Os -o btrfsctl btrfsctl.o ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o hash.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o -luuid
ls btrfsck.c
btrfsck.c
gcc -Wp,-MMD,./.btrfsck.o.d,-MT,btrfsck.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c btrfsck.c
ls bit-radix.c
bit-radix.c
gcc -Wp,-MMD,./.bit-radix.o.d,-MT,bit-radix.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c bit-radix.c
gcc -g -Werror -Os -o btrfsck btrfsck.o ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o hash.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o bit-radix.o -luuid
ls mkfs.c
mkfs.c
gcc -Wp,-MMD,./.mkfs.o.d,-MT,mkfs.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c mkfs.c
gcc -g -Werror -Os -o mkfs.btrfs ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o hash.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o mkfs.o -luuid
ls debug-tree.c
debug-tree.c
gcc -Wp,-MMD,./.debug-tree.o.d,-MT,debug-tree.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c debug-tree.c
gcc -g -Werror -Os -o debug-tree ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o hash.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o debug-tree.o -luuid
ls btrfs-show.c
btrfs-show.c
gcc -Wp,-MMD,./.btrfs-show.o.d,-MT,btrfs-show.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c btrfs-show.c
gcc -g -Werror -Os -o btrfs-show btrfs-show.o ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o hash.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o -luuid
ls btrfs-vol.c
btrfs-vol.c
gcc -Wp,-MMD,./.btrfs-vol.o.d,-MT,btrfs-vol.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c btrfs-vol.c
gcc -g -Werror -Os -o btrfs-vol btrfs-vol.o ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o hash.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o -luuid
ls convert.c
convert.c
gcc -Wp,-MMD,./.convert.o.d,-MT,convert.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c convert.c
gcc -g -Werror -Os -o btrfs-convert ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o hash.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o convert.o -lext2fs -luuid
install -m755 -d /usr/local/bin
install btrfsctl btrfsck mkfs.btrfs debug-tree btrfs-show btrfs-vol /usr/local/bin
if [ -e btrfs-convert ]; then install btrfs-convert /usr/local/bin; fi
[root@Perf-pxy-2 /data/root/btrfs/progs-da35ab2b0b54]#
[root@Perf-pxy-2 /data/root/btrfs/progs-da35ab2b0b54]# ls -l /usr/local/bin/
total 3464
-rwxr-xr-x 1 root root 512210 Dec 22 15:05 btrfsck
-rwxr-xr-x 1 root root 569484 Dec 22 15:05 btrfs-convert
-rwxr-xr-x 1 root root 479349 Dec 22 15:05 btrfsctl
-rwxr-xr-x 1 root root 482791 Dec 22 15:05 btrfs-show
-rwxr-xr-x 1 root root 479228 Dec 22 15:05 btrfs-vol
-rwxr-xr-x 1 root root 486578 Dec 22 15:05 debug-tree
-rwxr-xr-x 1 root root 493286 Dec 22 15:05 mkfs.btrfs
[root@Perf-pxy-2 /data/root/btrfs/progs-da35ab2b0b54]#
[root@Perf-pxy-2 /data/root/btrfs/progs-da35ab2b0b54]#
[root@Perf-pxy-2 /data/root/btrfs/progs-da35ab2b0b54]# make && make convert && make install
bash version.sh
which: no hg in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
ls ctree.c
ctree.c
gcc -Wp,-MMD,./.ctree.o.d,-MT,ctree.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c ctree.c
ls disk-io.c
disk-io.c
gcc -Wp,-MMD,./.disk-io.o.d,-MT,disk-io.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c disk-io.c
ls radix-tree.c
radix-tree.c
gcc -Wp,-MMD,./.radix-tree.o.d,-MT,radix-tree.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c radix-tree.c
ls extent-tree.c
extent-tree.c
gcc -Wp,-MMD,./.extent-tree.o.d,-MT,extent-tree.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c extent-tree.c
ls print-tree.c
print-tree.c
gcc -Wp,-MMD,./.print-tree.o.d,-MT,print-tree.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c print-tree.c
ls root-tree.c
root-tree.c
gcc -Wp,-MMD,./.root-tree.o.d,-MT,root-tree.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c root-tree.c
ls dir-item.c
dir-item.c
gcc -Wp,-MMD,./.dir-item.o.d,-MT,dir-item.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c dir-item.c
ls hash.c
hash.c
gcc -Wp,-MMD,./.hash.o.d,-MT,hash.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c hash.c
ls file-item.c
file-item.c
gcc -Wp,-MMD,./.file-item.o.d,-MT,file-item.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c file-item.c
ls inode-item.c
inode-item.c
gcc -Wp,-MMD,./.inode-item.o.d,-MT,inode-item.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c inode-item.c
ls inode-map.c
inode-map.c
gcc -Wp,-MMD,./.inode-map.o.d,-MT,inode-map.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c inode-map.c
ls crc32c.c
crc32c.c
gcc -Wp,-MMD,./.crc32c.o.d,-MT,crc32c.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c crc32c.c
ls rbtree.c
rbtree.c
gcc -Wp,-MMD,./.rbtree.o.d,-MT,rbtree.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c rbtree.c
ls extent-cache.c
extent-cache.c
gcc -Wp,-MMD,./.extent-cache.o.d,-MT,extent-cache.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c extent-cache.c
ls extent_io.c
extent_io.c
gcc -Wp,-MMD,./.extent_io.o.d,-MT,extent_io.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c extent_io.c
ls volumes.c
volumes.c
gcc -Wp,-MMD,./.volumes.o.d,-MT,volumes.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c volumes.c
ls utils.c
utils.c
gcc -Wp,-MMD,./.utils.o.d,-MT,utils.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c utils.c
ls btrfsctl.c
btrfsctl.c
gcc -Wp,-MMD,./.btrfsctl.o.d,-MT,btrfsctl.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c btrfsctl.c
gcc -g -Werror -Os -o btrfsctl btrfsctl.o ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o hash.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o -luuid
ls btrfsck.c
btrfsck.c
gcc -Wp,-MMD,./.btrfsck.o.d,-MT,btrfsck.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c btrfsck.c
ls bit-radix.c
bit-radix.c
gcc -Wp,-MMD,./.bit-radix.o.d,-MT,bit-radix.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c bit-radix.c
gcc -g -Werror -Os -o btrfsck btrfsck.o ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o hash.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o bit-radix.o -luuid
ls mkfs.c
mkfs.c
gcc -Wp,-MMD,./.mkfs.o.d,-MT,mkfs.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c mkfs.c
gcc -g -Werror -Os -o mkfs.btrfs ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o hash.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o mkfs.o -luuid
ls debug-tree.c
debug-tree.c
gcc -Wp,-MMD,./.debug-tree.o.d,-MT,debug-tree.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c debug-tree.c
gcc -g -Werror -Os -o debug-tree ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o hash.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o debug-tree.o -luuid
ls btrfs-show.c
btrfs-show.c
gcc -Wp,-MMD,./.btrfs-show.o.d,-MT,btrfs-show.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c btrfs-show.c
gcc -g -Werror -Os -o btrfs-show btrfs-show.o ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o hash.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o -luuid
ls btrfs-vol.c
btrfs-vol.c
gcc -Wp,-MMD,./.btrfs-vol.o.d,-MT,btrfs-vol.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c btrfs-vol.c
gcc -g -Werror -Os -o btrfs-vol btrfs-vol.o ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o hash.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o -luuid
ls convert.c
convert.c
gcc -Wp,-MMD,./.convert.o.d,-MT,convert.o -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -Os -c convert.c
gcc -g -Werror -Os -o btrfs-convert ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o hash.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o convert.o -lext2fs -luuid
install -m755 -d /usr/local/bin
install btrfsctl btrfsck mkfs.btrfs debug-tree btrfs-show btrfs-vol /usr/local/bin
if [ -e btrfs-convert ]; then install btrfs-convert /usr/local/bin; fi
[root@Perf-pxy-2 /data/root/btrfs/progs-da35ab2b0b54]#
[root@Perf-pxy-2 /data/root/btrfs/progs-da35ab2b0b54]# ls -l /usr/local/bin/
total 3464
-rwxr-xr-x 1 root root 512210 Dec 22 15:05 btrfsck
-rwxr-xr-x 1 root root 569484 Dec 22 15:05 btrfs-convert
-rwxr-xr-x 1 root root 479349 Dec 22 15:05 btrfsctl
-rwxr-xr-x 1 root root 482791 Dec 22 15:05 btrfs-show
-rwxr-xr-x 1 root root 479228 Dec 22 15:05 btrfs-vol
-rwxr-xr-x 1 root root 486578 Dec 22 15:05 debug-tree
-rwxr-xr-x 1 root root 493286 Dec 22 15:05 mkfs.btrfs
[root@Perf-pxy-2 /data/root/btrfs/progs-da35ab2b0b54]#
4. 加载内核模块
modprobe btrfs
[root@Perf-pxy-2 ~]# modprobe btrfs
[root@Perf-pxy-2 ~]#
或[root@Perf-pxy-2 ~]#
insmod /lib/modules/`uname -r`/extra/btrfs.ko
lsmod |grep btrfs
[root@Perf-pxy-2 ~]# lsmod |grep btrfs
btrfs 324936 0
[root@Perf-pxy-2 ~]#
btrfs 324936 0
[root@Perf-pxy-2 ~]#
配置系统启动自动加载
cat >/etc/sysconfig/modules/btrfs.modules <<'EOF'
#!/bin/sh
modprobe btrfs >/dev/null 2>&1
EOF
chmod 755 /etc/sysconfig/modules/btrfs.modules
ls -l /etc/sysconfig/modules/btrfs.modules
[root@Perf-pxy-2 ~]# cat >/etc/sysconfig/modules/btrfs.modules <<'EOF'
> #!/bin/sh
> modprobe btrfs >/dev/null 2>&1
> EOF
[root@Perf-pxy-2 ~]# chmod 755 /etc/sysconfig/modules/btrfs.modules
[root@Perf-pxy-2 ~]# ls -l /etc/sysconfig/modules/btrfs.modules
-rwxr-xr-x 1 root root 41 Dec 22 15:29 /etc/sysconfig/modules/btrfs.modules
[root@Perf-pxy-2 ~]#
> #!/bin/sh
> modprobe btrfs >/dev/null 2>&1
> EOF
[root@Perf-pxy-2 ~]# chmod 755 /etc/sysconfig/modules/btrfs.modules
[root@Perf-pxy-2 ~]# ls -l /etc/sysconfig/modules/btrfs.modules
-rwxr-xr-x 1 root root 41 Dec 22 15:29 /etc/sysconfig/modules/btrfs.modules
[root@Perf-pxy-2 ~]#
5. 创建磁盘分区
建4个1G大小的分区
fdisk /dev/sda <<EOF
p
n
+1g
n
+1g
n
+1g
n
+1g
p
w
EOF
partprobe
[root@Perf-pxy-2 ~]# fdisk /dev/sda <<EOF
> p
> n
>
> +1g
> n
>
> +1g
> n
>
> +1g
> n
>
> +1g
> p
> w
> EOF
The number of cylinders for this disk is set to 8908.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help):
Disk /dev/sda: 73.2 GB, 73274490880 bytes
255 heads, 63 sectors/track, 8908 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1925 15358140 83 Linux
/dev/sda3 1926 2945 8193150 83 Linux
/dev/sda4 2946 8908 47897797+ 5 Extended
/dev/sda5 2946 3455 4096543+ 82 Linux swap / Solaris
Command (m for help): First cylinder (3456-8908, default 3456): Using default value 3456
Last cylinder or +size or +sizeM or +sizeK (3456-8908, default 8908):
Command (m for help): First cylinder (3579-8908, default 3579): Using default value 3579
Last cylinder or +size or +sizeM or +sizeK (3579-8908, default 8908):
Command (m for help): First cylinder (3702-8908, default 3702): Using default value 3702
Last cylinder or +size or +sizeM or +sizeK (3702-8908, default 8908):
Command (m for help): First cylinder (3825-8908, default 3825): Using default value 3825
Last cylinder or +size or +sizeM or +sizeK (3825-8908, default 8908):
Command (m for help):
Disk /dev/sda: 73.2 GB, 73274490880 bytes
255 heads, 63 sectors/track, 8908 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1925 15358140 83 Linux
/dev/sda3 1926 2945 8193150 83 Linux
/dev/sda4 2946 8908 47897797+ 5 Extended
/dev/sda5 2946 3455 4096543+ 82 Linux swap / Solaris
/dev/sda6 3456 3578 987966 83 Linux
/dev/sda7 3579 3701 987966 83 Linux
/dev/sda8 3702 3824 987966 83 Linux
/dev/sda9 3825 3947 987966 83 Linux
Command (m for help): The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@Perf-pxy-2 ~]# partprobe
[root@Perf-pxy-2 ~]#
> p
> n
>
> +1g
> n
>
> +1g
> n
>
> +1g
> n
>
> +1g
> p
> w
> EOF
The number of cylinders for this disk is set to 8908.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help):
Disk /dev/sda: 73.2 GB, 73274490880 bytes
255 heads, 63 sectors/track, 8908 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1925 15358140 83 Linux
/dev/sda3 1926 2945 8193150 83 Linux
/dev/sda4 2946 8908 47897797+ 5 Extended
/dev/sda5 2946 3455 4096543+ 82 Linux swap / Solaris
Command (m for help): First cylinder (3456-8908, default 3456): Using default value 3456
Last cylinder or +size or +sizeM or +sizeK (3456-8908, default 8908):
Command (m for help): First cylinder (3579-8908, default 3579): Using default value 3579
Last cylinder or +size or +sizeM or +sizeK (3579-8908, default 8908):
Command (m for help): First cylinder (3702-8908, default 3702): Using default value 3702
Last cylinder or +size or +sizeM or +sizeK (3702-8908, default 8908):
Command (m for help): First cylinder (3825-8908, default 3825): Using default value 3825
Last cylinder or +size or +sizeM or +sizeK (3825-8908, default 8908):
Command (m for help):
Disk /dev/sda: 73.2 GB, 73274490880 bytes
255 heads, 63 sectors/track, 8908 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1925 15358140 83 Linux
/dev/sda3 1926 2945 8193150 83 Linux
/dev/sda4 2946 8908 47897797+ 5 Extended
/dev/sda5 2946 3455 4096543+ 82 Linux swap / Solaris
/dev/sda6 3456 3578 987966 83 Linux
/dev/sda7 3579 3701 987966 83 Linux
/dev/sda8 3702 3824 987966 83 Linux
/dev/sda9 3825 3947 987966 83 Linux
Command (m for help): The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@Perf-pxy-2 ~]# partprobe
[root@Perf-pxy-2 ~]#
6. 创建文件系统
mkfs.btrfs /dev/sda6
mkfs.btrfs /dev/sda7
mkfs.btrfs /dev/sda8
mkfs.btrfs /dev/sda9
btrfs-show
[root@Perf-pxy-2 ~]# mkfs.btrfs /dev/sda6
fs created label (null) on /dev/sda6
nodesize 4096 leafsize 4096 sectorsize 4096 size 964.81MB
Btrfs Btrfs v0.16
[root@Perf-pxy-2 ~]# mkfs.btrfs /dev/sda7
fs created label (null) on /dev/sda7
nodesize 4096 leafsize 4096 sectorsize 4096 size 964.81MB
Btrfs Btrfs v0.16
[root@Perf-pxy-2 ~]# mkfs.btrfs /dev/sda8
fs created label (null) on /dev/sda8
nodesize 4096 leafsize 4096 sectorsize 4096 size 964.81MB
Btrfs Btrfs v0.16
[root@Perf-pxy-2 ~]# mkfs.btrfs /dev/sda9
fs created label (null) on /dev/sda9
nodesize 4096 leafsize 4096 sectorsize 4096 size 964.81MB
Btrfs Btrfs v0.16
[root@Perf-pxy-2 ~]# btrfs-show
failed to read /dev/fd0u1120
failed to read /dev/fd0u830
failed to read /dev/fd0u720
failed to read /dev/fd0u1920
failed to read /dev/fd0u1743
failed to read /dev/fd0u1680
failed to read /dev/fd0
failed to read /dev/hda
Label: none uuid: 7f473f0f-e354-4e4b-b8d8-afd164c9aa36
Total devices 1 FS bytes used 40.00KB
devid 1 size 964.81MB used 132.38MB path /dev/sda8
Label: none uuid: 7042801b-28df-4620-83bb-5237f4fdeae4
Total devices 1 FS bytes used 40.00KB
devid 1 size 964.81MB used 132.38MB path /dev/sda7
Label: none uuid: 30cb5dcf-7fd0-4704-be8f-ea73dac61cd0
Total devices 1 FS bytes used 40.00KB
devid 1 size 964.81MB used 132.38MB path /dev/sda9
Label: none uuid: 80709a87-b5e2-475a-81af-6d94accd21c0
Total devices 1 FS bytes used 40.00KB
devid 1 size 964.81MB used 132.38MB path /dev/sda6
Btrfs Btrfs v0.16
[root@Perf-pxy-2 ~]#
fs created label (null) on /dev/sda6
nodesize 4096 leafsize 4096 sectorsize 4096 size 964.81MB
Btrfs Btrfs v0.16
[root@Perf-pxy-2 ~]# mkfs.btrfs /dev/sda7
fs created label (null) on /dev/sda7
nodesize 4096 leafsize 4096 sectorsize 4096 size 964.81MB
Btrfs Btrfs v0.16
[root@Perf-pxy-2 ~]# mkfs.btrfs /dev/sda8
fs created label (null) on /dev/sda8
nodesize 4096 leafsize 4096 sectorsize 4096 size 964.81MB
Btrfs Btrfs v0.16
[root@Perf-pxy-2 ~]# mkfs.btrfs /dev/sda9
fs created label (null) on /dev/sda9
nodesize 4096 leafsize 4096 sectorsize 4096 size 964.81MB
Btrfs Btrfs v0.16
[root@Perf-pxy-2 ~]# btrfs-show
failed to read /dev/fd0u1120
failed to read /dev/fd0u830
failed to read /dev/fd0u720
failed to read /dev/fd0u1920
failed to read /dev/fd0u1743
failed to read /dev/fd0u1680
failed to read /dev/fd0
failed to read /dev/hda
Label: none uuid: 7f473f0f-e354-4e4b-b8d8-afd164c9aa36
Total devices 1 FS bytes used 40.00KB
devid 1 size 964.81MB used 132.38MB path /dev/sda8
Label: none uuid: 7042801b-28df-4620-83bb-5237f4fdeae4
Total devices 1 FS bytes used 40.00KB
devid 1 size 964.81MB used 132.38MB path /dev/sda7
Label: none uuid: 30cb5dcf-7fd0-4704-be8f-ea73dac61cd0
Total devices 1 FS bytes used 40.00KB
devid 1 size 964.81MB used 132.38MB path /dev/sda9
Label: none uuid: 80709a87-b5e2-475a-81af-6d94accd21c0
Total devices 1 FS bytes used 40.00KB
devid 1 size 964.81MB used 132.38MB path /dev/sda6
Btrfs Btrfs v0.16
[root@Perf-pxy-2 ~]#
挂载根卷
mkdir -p /mnt/btrfs-root
mount -t btrfs -o subvol=. /dev/sda6 /mnt/btrfs-root
ls -laR /mnt/btrfs-root/
mount -t btrfs
df -h /mnt/btrfs-root
[root@Perf-pxy-2 ~]# mkdir -p /mnt/btrfs-root
[root@Perf-pxy-2 ~]# mount -t btrfs -o subvol=. /dev/sda6 /mnt/btrfs-root
[root@Perf-pxy-2 ~]# ls -laR /mnt/btrfs-root/
/mnt/btrfs-root/:
total 9
dr-xr-xr-x 1 root root 0 Jan 1 1970 .
drwxr-xr-x 3 root root 4096 Dec 23 10:31 ..
dr-xr-xr-x 1 root root 0 Jan 1 1970 default
/mnt/btrfs-root/default:
total 1
dr-xr-xr-x 1 root root 0 Jan 1 1970 .
dr-xr-xr-x 1 root root 0 Jan 1 1970 ..
[root@Perf-pxy-2 ~]# mount -t btrfs
/dev/sda6 on /mnt/btrfs-root type btrfs (rw,subvol=.)
[root@Perf-pxy-2 ~]# df -h /mnt/btrfs-root
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 44K 965M 1% /mnt/btrfs-root
[root@Perf-pxy-2 ~]#
根卷下有一个默认的default子卷[root@Perf-pxy-2 ~]# mount -t btrfs -o subvol=. /dev/sda6 /mnt/btrfs-root
[root@Perf-pxy-2 ~]# ls -laR /mnt/btrfs-root/
/mnt/btrfs-root/:
total 9
dr-xr-xr-x 1 root root 0 Jan 1 1970 .
drwxr-xr-x 3 root root 4096 Dec 23 10:31 ..
dr-xr-xr-x 1 root root 0 Jan 1 1970 default
/mnt/btrfs-root/default:
total 1
dr-xr-xr-x 1 root root 0 Jan 1 1970 .
dr-xr-xr-x 1 root root 0 Jan 1 1970 ..
[root@Perf-pxy-2 ~]# mount -t btrfs
/dev/sda6 on /mnt/btrfs-root type btrfs (rw,subvol=.)
[root@Perf-pxy-2 ~]# df -h /mnt/btrfs-root
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 44K 965M 1% /mnt/btrfs-root
[root@Perf-pxy-2 ~]#
7. 创建子卷
在根卷上建一个新的子卷
btrfsctl -s sv_test /mnt/btrfs-root
[root@Perf-pxy-2 ~]# btrfsctl -s sv_test /mnt/btrfs-root
operation complete
Btrfs Btrfs v0.16
[root@Perf-pxy-2 ~]#
operation complete
Btrfs Btrfs v0.16
[root@Perf-pxy-2 ~]#
挂载子卷
mkdir -p /mnt/btrfs-sv_test
mount -t btrfs -o subvol=sv_test /dev/sda6 /mnt/btrfs-sv_test
ls -laR /mnt/btrfs-sv_test/
mount -t btrfs
df -h /mnt/btrfs-*
[root@Perf-pxy-2 ~]# mkdir -p /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]# mount -t btrfs -o subvol=sv_test /dev/sda6 /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]# ls -laR /mnt/btrfs-sv_test/
/mnt/btrfs-sv_test/:
total 8
drwx------ 1 root root 0 Dec 23 10:33 .
drwxr-xr-x 4 root root 4096 Dec 23 10:33 ..
[root@Perf-pxy-2 ~]# mount -t btrfs
/dev/sda6 on /mnt/btrfs-root type btrfs (rw,subvol=.)
/dev/sda6 on /mnt/btrfs-sv_test type btrfs (rw,subvol=sv_test)
[root@Perf-pxy-2 ~]# df -h /mnt/btrfs-*
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 44K 965M 1% /mnt/btrfs-root
/dev/sda6 965M 44K 965M 1% /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]#
[root@Perf-pxy-2 ~]# mount -t btrfs -o subvol=sv_test /dev/sda6 /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]# ls -laR /mnt/btrfs-sv_test/
/mnt/btrfs-sv_test/:
total 8
drwx------ 1 root root 0 Dec 23 10:33 .
drwxr-xr-x 4 root root 4096 Dec 23 10:33 ..
[root@Perf-pxy-2 ~]# mount -t btrfs
/dev/sda6 on /mnt/btrfs-root type btrfs (rw,subvol=.)
/dev/sda6 on /mnt/btrfs-sv_test type btrfs (rw,subvol=sv_test)
[root@Perf-pxy-2 ~]# df -h /mnt/btrfs-*
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 44K 965M 1% /mnt/btrfs-root
/dev/sda6 965M 44K 965M 1% /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]#
ls -laR /mnt/btrfs-root/
[root@Perf-pxy-2 ~]# ls -laR /mnt/btrfs-root/
/mnt/btrfs-root/:
total 9
dr-xr-xr-x 1 root root 0 Jan 1 1970 .
drwxr-xr-x 4 root root 4096 Dec 23 10:33 ..
dr-xr-xr-x 1 root root 0 Jan 1 1970 default
drwx------ 1 root root 0 Dec 23 10:33 sv_test
/mnt/btrfs-root/default:
total 1
dr-xr-xr-x 1 root root 0 Jan 1 1970 .
dr-xr-xr-x 1 root root 0 Jan 1 1970 ..
/mnt/btrfs-root/sv_test:
total 1
drwx------ 1 root root 0 Dec 23 10:33 .
dr-xr-xr-x 1 root root 0 Jan 1 1970 ..
[root@Perf-pxy-2 ~]#
根卷下自动创建了该子卷的目录/mnt/btrfs-root/:
total 9
dr-xr-xr-x 1 root root 0 Jan 1 1970 .
drwxr-xr-x 4 root root 4096 Dec 23 10:33 ..
dr-xr-xr-x 1 root root 0 Jan 1 1970 default
drwx------ 1 root root 0 Dec 23 10:33 sv_test
/mnt/btrfs-root/default:
total 1
dr-xr-xr-x 1 root root 0 Jan 1 1970 .
dr-xr-xr-x 1 root root 0 Jan 1 1970 ..
/mnt/btrfs-root/sv_test:
total 1
drwx------ 1 root root 0 Dec 23 10:33 .
dr-xr-xr-x 1 root root 0 Jan 1 1970 ..
[root@Perf-pxy-2 ~]#
创建一个文件, 500兆
dd if=/dev/zero of=/mnt/btrfs-sv_test/file1 bs=1024 count=$((1024*500))
ls -l /mnt/btrfs-sv_test/
df -h /mnt/btrfs-sv_test/
[root@Perf-pxy-2 ~]# dd if=/dev/zero of=/mnt/btrfs-sv_test/file1 bs=1024 count=$((1024*500))
512000+0 records in
512000+0 records out
524288000 bytes (524 MB) copied, 9.58796 seconds, 54.7 MB/s
[root@Perf-pxy-2 ~]# ls -l /mnt/btrfs-sv_test/
total 410114
-rw-r--r-- 1 root root 524288000 Dec 23 10:35 file1
[root@Perf-pxy-2 ~]# df -h /mnt/btrfs-sv_test/
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 399M 567M 42% /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]# du -sh /mnt/btrfs-sv_test/
401M /mnt/btrfs-sv_test/
[root@Perf-pxy-2 ~]#
400M了, 过一分钟再查看512000+0 records in
512000+0 records out
524288000 bytes (524 MB) copied, 9.58796 seconds, 54.7 MB/s
[root@Perf-pxy-2 ~]# ls -l /mnt/btrfs-sv_test/
total 410114
-rw-r--r-- 1 root root 524288000 Dec 23 10:35 file1
[root@Perf-pxy-2 ~]# df -h /mnt/btrfs-sv_test/
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 399M 567M 42% /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]# du -sh /mnt/btrfs-sv_test/
401M /mnt/btrfs-sv_test/
[root@Perf-pxy-2 ~]#
[root@Perf-pxy-2 ~]# df -h /mnt/btrfs-sv_test/
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 424M 542M 44% /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]#
越来越大Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 424M 542M 44% /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]#
[root@Perf-pxy-2 ~]# df -h /mnt/btrfs-sv_test/
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 501M 465M 52% /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]#
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 501M 465M 52% /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]#
9. 创建快照
给子卷btrfs-sv_test创建一个快照
btrfsctl -s ss_of_sv_test /mnt/btrfs-sv_test/
ls -l /mnt/btrfs-root/
[root@Perf-pxy-2 ~]# btrfsctl -s ss_of_sv_test /mnt/btrfs-sv_test/
operation complete
Btrfs Btrfs v0.16
[root@Perf-pxy-2 ~]# ls -l /mnt/btrfs-root/
total 1
dr-xr-xr-x 1 root root 0 Jan 1 1970 default
drwx------ 1 root root 10 Dec 23 10:35 ss_of_sv_test
drwx------ 1 root root 10 Dec 23 10:35 sv_test
[root@Perf-pxy-2 ~]#
根卷下也新建了一个目录operation complete
Btrfs Btrfs v0.16
[root@Perf-pxy-2 ~]# ls -l /mnt/btrfs-root/
total 1
dr-xr-xr-x 1 root root 0 Jan 1 1970 default
drwx------ 1 root root 10 Dec 23 10:35 ss_of_sv_test
drwx------ 1 root root 10 Dec 23 10:35 sv_test
[root@Perf-pxy-2 ~]#
挂载快照
mkdir -p /mnt/btrfs-ss_of_sv_test
mount -t btrfs -o subvol=ss_of_sv_test /dev/sda6 /mnt/btrfs-ss_of_sv_test
mount -t btrfs
df -h /mnt/btrfs-*
ls -l /mnt/btrfs-ss_of_sv_test/
[root@Perf-pxy-2 ~]# mkdir -p /mnt/btrfs-ss_of_sv_test
[root@Perf-pxy-2 ~]# mount -t btrfs -o subvol=ss_of_sv_test /dev/sda6 /mnt/btrfs-ss_of_sv_test
[root@Perf-pxy-2 ~]# mount -t btrfs
/dev/sda6 on /mnt/btrfs-root type btrfs (rw,subvol=.)
/dev/sda6 on /mnt/btrfs-sv_test type btrfs (rw,subvol=sv_test)
/dev/sda6 on /mnt/btrfs-ss_of_sv_test type btrfs (rw,subvol=ss_of_sv_test)
[root@Perf-pxy-2 ~]# df -h /mnt/btrfs-*
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 501M 465M 52% /mnt/btrfs-root
/dev/sda6 965M 501M 465M 52% /mnt/btrfs-ss_of_sv_test
/dev/sda6 965M 501M 465M 52% /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]# ls -l /mnt/btrfs-ss_of_sv_test/
total 512006
-rw-r--r-- 1 root root 524288000 Dec 23 10:35 file1
[root@Perf-pxy-2 ~]#
文件file1在快照中有[root@Perf-pxy-2 ~]# mount -t btrfs -o subvol=ss_of_sv_test /dev/sda6 /mnt/btrfs-ss_of_sv_test
[root@Perf-pxy-2 ~]# mount -t btrfs
/dev/sda6 on /mnt/btrfs-root type btrfs (rw,subvol=.)
/dev/sda6 on /mnt/btrfs-sv_test type btrfs (rw,subvol=sv_test)
/dev/sda6 on /mnt/btrfs-ss_of_sv_test type btrfs (rw,subvol=ss_of_sv_test)
[root@Perf-pxy-2 ~]# df -h /mnt/btrfs-*
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 501M 465M 52% /mnt/btrfs-root
/dev/sda6 965M 501M 465M 52% /mnt/btrfs-ss_of_sv_test
/dev/sda6 965M 501M 465M 52% /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]# ls -l /mnt/btrfs-ss_of_sv_test/
total 512006
-rw-r--r-- 1 root root 524288000 Dec 23 10:35 file1
[root@Perf-pxy-2 ~]#
btrfs-show
[root@Perf-pxy-2 ~]# btrfs-show
failed to read /dev/fd0u1120
failed to read /dev/fd0u830
failed to read /dev/fd0u720
failed to read /dev/fd0u1920
failed to read /dev/fd0u1743
failed to read /dev/fd0u1680
failed to read /dev/fd0
failed to read /dev/hda
Label: none uuid: 7f473f0f-e354-4e4b-b8d8-afd164c9aa36
Total devices 1 FS bytes used 40.00KB
devid 1 size 964.81MB used 132.38MB path /dev/sda8
Label: none uuid: 7042801b-28df-4620-83bb-5237f4fdeae4
Total devices 1 FS bytes used 40.00KB
devid 1 size 964.81MB used 132.38MB path /dev/sda7
Label: none uuid: 30cb5dcf-7fd0-4704-be8f-ea73dac61cd0
Total devices 1 FS bytes used 40.00KB
devid 1 size 964.81MB used 132.38MB path /dev/sda9
Label: none uuid: 80709a87-b5e2-475a-81af-6d94accd21c0
Total devices 1 FS bytes used 500.64MB
devid 1 size 964.81MB used 903.88MB path /dev/sda6
Btrfs Btrfs v0.16
[root@Perf-pxy-2 ~]#
failed to read /dev/fd0u1120
failed to read /dev/fd0u830
failed to read /dev/fd0u720
failed to read /dev/fd0u1920
failed to read /dev/fd0u1743
failed to read /dev/fd0u1680
failed to read /dev/fd0
failed to read /dev/hda
Label: none uuid: 7f473f0f-e354-4e4b-b8d8-afd164c9aa36
Total devices 1 FS bytes used 40.00KB
devid 1 size 964.81MB used 132.38MB path /dev/sda8
Label: none uuid: 7042801b-28df-4620-83bb-5237f4fdeae4
Total devices 1 FS bytes used 40.00KB
devid 1 size 964.81MB used 132.38MB path /dev/sda7
Label: none uuid: 30cb5dcf-7fd0-4704-be8f-ea73dac61cd0
Total devices 1 FS bytes used 40.00KB
devid 1 size 964.81MB used 132.38MB path /dev/sda9
Label: none uuid: 80709a87-b5e2-475a-81af-6d94accd21c0
Total devices 1 FS bytes used 500.64MB
devid 1 size 964.81MB used 903.88MB path /dev/sda6
Btrfs Btrfs v0.16
[root@Perf-pxy-2 ~]#
创建3个文件
dd if=/dev/urandom of=/mnt/btrfs-sv_test/file1 bs=1024 count=$((3*1024))
dd if=/dev/urandom of=/mnt/btrfs-sv_test/file2 bs=1024 count=$((2*1024))
dd if=/dev/urandom of=/mnt/btrfs-ss_of_sv_test/file3 bs=1024 count=$((1*1024))
df -h /mnt/btrfs-*
ls -l /mnt/btrfs-sv_test/
ls -l /mnt/btrfs-ss_of_sv_test/
[root@Perf-pxy-2 ~]# dd if=/dev/urandom of=/mnt/btrfs-sv_test/file1 bs=1024 count=$((3*1024))
3072+0 records in
3072+0 records out
3145728 bytes (3.1 MB) copied, 0.647297 seconds, 4.9 MB/s
[root@Perf-pxy-2 ~]# dd if=/dev/urandom of=/mnt/btrfs-sv_test/file2 bs=1024 count=$((2*1024))
2048+0 records in
2048+0 records out
2097152 bytes (2.1 MB) copied, 0.434674 seconds, 4.8 MB/s
[root@Perf-pxy-2 ~]# dd if=/dev/urandom of=/mnt/btrfs-ss_of_sv_test/file3 bs=1024 count=$((1*1024))
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 0.219023 seconds, 4.8 MB/s
[root@Perf-pxy-2 ~]# df -h /mnt/btrfs-*
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 501M 465M 52% /mnt/btrfs-root
/dev/sda6 965M 501M 465M 52% /mnt/btrfs-ss_of_sv_test
/dev/sda6 965M 501M 465M 52% /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]# ls -l /mnt/btrfs-sv_test/
total 5138
-rw-r--r-- 1 root root 3145728 Dec 24 03:15 file1
-rw-r--r-- 1 root root 2097152 Dec 24 03:16 file2
[root@Perf-pxy-2 ~]# ls -l /mnt/btrfs-ss_of_sv_test/
total 513036
-rw-r--r-- 1 root root 524288000 Dec 23 10:35 file1
-rw-r--r-- 1 root root 1048576 Dec 24 03:16 file3
[root@Perf-pxy-2 ~]#
快照是可写的3072+0 records in
3072+0 records out
3145728 bytes (3.1 MB) copied, 0.647297 seconds, 4.9 MB/s
[root@Perf-pxy-2 ~]# dd if=/dev/urandom of=/mnt/btrfs-sv_test/file2 bs=1024 count=$((2*1024))
2048+0 records in
2048+0 records out
2097152 bytes (2.1 MB) copied, 0.434674 seconds, 4.8 MB/s
[root@Perf-pxy-2 ~]# dd if=/dev/urandom of=/mnt/btrfs-ss_of_sv_test/file3 bs=1024 count=$((1*1024))
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 0.219023 seconds, 4.8 MB/s
[root@Perf-pxy-2 ~]# df -h /mnt/btrfs-*
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 501M 465M 52% /mnt/btrfs-root
/dev/sda6 965M 501M 465M 52% /mnt/btrfs-ss_of_sv_test
/dev/sda6 965M 501M 465M 52% /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]# ls -l /mnt/btrfs-sv_test/
total 5138
-rw-r--r-- 1 root root 3145728 Dec 24 03:15 file1
-rw-r--r-- 1 root root 2097152 Dec 24 03:16 file2
[root@Perf-pxy-2 ~]# ls -l /mnt/btrfs-ss_of_sv_test/
total 513036
-rw-r--r-- 1 root root 524288000 Dec 23 10:35 file1
-rw-r--r-- 1 root root 1048576 Dec 24 03:16 file3
[root@Perf-pxy-2 ~]#
10. 删除快照
快照目录删不掉, 只能删除目录下的所有文件, 释放空间
df -h /mnt/btrfs-*
rm -rf /mnt/btrfs-ss_of_sv_test/
ls -la /mnt/btrfs-ss_of_sv_test/
umount /mnt/btrfs-ss_of_sv_test/
rm -rf /mnt/btrfs-ss_of_sv_test/
ls -la /mnt/btrfs-root/
rmdir /mnt/btrfs-root/ss_of_sv_test
ls -la /mnt/btrfs-root/
df -h /mnt/btrfs-*
[root@Perf-pxy-2 ~]# df -h /mnt/btrfs-*
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 507M 459M 53% /mnt/btrfs-root
/dev/sda6 965M 507M 459M 53% /mnt/btrfs-ss_of_sv_test
/dev/sda6 965M 507M 459M 53% /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]# rm -rf /mnt/btrfs-ss_of_sv_test/
rm: cannot remove directory `/mnt/btrfs-ss_of_sv_test/': Device or resource busy
[root@Perf-pxy-2 ~]# ls -la /mnt/btrfs-ss_of_sv_test/
total 8
drwx------ 1 root root 0 Dec 24 03:18 .
drwxr-xr-x 5 root root 4096 Dec 23 10:41 ..
[root@Perf-pxy-2 ~]# umount /mnt/btrfs-ss_of_sv_test/
[root@Perf-pxy-2 ~]# rm -rf /mnt/btrfs-ss_of_sv_test/
[root@Perf-pxy-2 ~]# ls -la /mnt/btrfs-root/
total 9
dr-xr-xr-x 1 root root 0 Jan 1 1970 .
drwxr-xr-x 4 root root 4096 Dec 24 03:19 ..
dr-xr-xr-x 1 root root 0 Jan 1 1970 default
drwx------ 1 root root 0 Dec 24 03:18 ss_of_sv_test
drwx------ 1 root root 20 Dec 24 03:16 sv_test
[root@Perf-pxy-2 ~]# rmdir /mnt/btrfs-root/ss_of_sv_test
rmdir: /mnt/btrfs-root/ss_of_sv_test: Operation not permitted
[root@Perf-pxy-2 ~]# ls -la /mnt/btrfs-root/
total 9
dr-xr-xr-x 1 root root 0 Jan 1 1970 .
drwxr-xr-x 4 root root 4096 Dec 24 03:19 ..
dr-xr-xr-x 1 root root 0 Jan 1 1970 default
drwx------ 1 root root 0 Dec 24 03:18 ss_of_sv_test
drwx------ 1 root root 20 Dec 24 03:16 sv_test
[root@Perf-pxy-2 ~]# df -h /mnt/btrfs-*
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 5.1M 960M 1% /mnt/btrfs-root
/dev/sda6 965M 5.1M 960M 1% /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]#
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 507M 459M 53% /mnt/btrfs-root
/dev/sda6 965M 507M 459M 53% /mnt/btrfs-ss_of_sv_test
/dev/sda6 965M 507M 459M 53% /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]# rm -rf /mnt/btrfs-ss_of_sv_test/
rm: cannot remove directory `/mnt/btrfs-ss_of_sv_test/': Device or resource busy
[root@Perf-pxy-2 ~]# ls -la /mnt/btrfs-ss_of_sv_test/
total 8
drwx------ 1 root root 0 Dec 24 03:18 .
drwxr-xr-x 5 root root 4096 Dec 23 10:41 ..
[root@Perf-pxy-2 ~]# umount /mnt/btrfs-ss_of_sv_test/
[root@Perf-pxy-2 ~]# rm -rf /mnt/btrfs-ss_of_sv_test/
[root@Perf-pxy-2 ~]# ls -la /mnt/btrfs-root/
total 9
dr-xr-xr-x 1 root root 0 Jan 1 1970 .
drwxr-xr-x 4 root root 4096 Dec 24 03:19 ..
dr-xr-xr-x 1 root root 0 Jan 1 1970 default
drwx------ 1 root root 0 Dec 24 03:18 ss_of_sv_test
drwx------ 1 root root 20 Dec 24 03:16 sv_test
[root@Perf-pxy-2 ~]# rmdir /mnt/btrfs-root/ss_of_sv_test
rmdir: /mnt/btrfs-root/ss_of_sv_test: Operation not permitted
[root@Perf-pxy-2 ~]# ls -la /mnt/btrfs-root/
total 9
dr-xr-xr-x 1 root root 0 Jan 1 1970 .
drwxr-xr-x 4 root root 4096 Dec 24 03:19 ..
dr-xr-xr-x 1 root root 0 Jan 1 1970 default
drwx------ 1 root root 0 Dec 24 03:18 ss_of_sv_test
drwx------ 1 root root 20 Dec 24 03:16 sv_test
[root@Perf-pxy-2 ~]# df -h /mnt/btrfs-*
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 965M 5.1M 960M 1% /mnt/btrfs-root
/dev/sda6 965M 5.1M 960M 1% /mnt/btrfs-sv_test
[root@Perf-pxy-2 ~]#
删除子卷也是一样的, 删除那个都行
11. 多设备
添加删除设备有问题, 不好用
12. 空间满ENOSPC
磁盘空间满了可能造成系统崩溃
13. 其它文件系统
nilfs [http://www.nilfs.org]:
持续快照(continuous snapshotting), 任何修改都记录检查点, 删除快照或检查点会导致产生新的检查点, 占用空间巨大
tux3 [http://tux3.org]:
太新了, 目前还是fuse的
hammer[http://www.dragonflybsd.org/hammer/]:
DragonFly BSD上用的
zfs on fuse [http://www.wizy.org/wiki/ZFS_on_FUSE]:
FUSE据说很慢
外部链接:
btrfs
Btrfs(wikipedia)
Btrfs trees for linux-next
Btrfs mainline plans
Kernel Log: Ext4 completes development phase as interim step to btrfs
Ext4 Advances As Interim Step To Btrfs
List of file systems
Comparison_of file systems
Emerging Filesystems
On File Systems
More Linux File Systems
Xie Wen (谢文)
Network & Operations,
Multimedia Applications & Services (MDB) MOTOROLA Inc.
NO.104 mail box,
8th floor, Motorola Tower,
No. 1 Wang Jing East Road, Chao Yang District,
Beijing 100102 P. R. China
e-mail wenxie at motorola.com
=====
updated on Jan. 17, 2009: btrfs v0.18版发布了
-fin-
No comments:
Post a Comment