一,Btrfs文件系统简介
Btrfs(通常念成Butter FS),由Oracle于2007年宣布并进行中的COW(copy-on-write式)文件系统。目标是取代Linux目前的ext3文件系统,改善ext3的限制,特别是单一文件大小的限制,总文件系统大小限制以及加入文件校验和特性。加入目前ext3/4未支持的一些功能,例如可写的磁盘快照(snapshots),以及支持递归的快照(snapshots of snapshots),内建磁盘阵列(RAID)支持,支持子卷(Subvolumes)的概念,允许在线调整文件系统大小。
二BTRFS核心特性
多物理卷支持:btrfs可由多个底层物理卷组成,支持RAID,以联机“添加”,“移除”,“修改”
写时复制更新机制(Cow) 复制,更新及替换指针,而非“就地”更新
数据及元数据检验码:checksum
子卷:sub_volume
快照:支持快照的快照
透明压缩
三,配置BTRFS文件系统
添加三块磁盘,每块20GB。
[[email protected] ~]# fdisk -l #查看磁盘情况
磁盘 /dev/sdd:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘 /dev/sdc:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘 /dev/sdb:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘 /dev/sda:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x000b57bf
设备 Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 41943039 20458496 8e Linux LVM
磁盘 /dev/mapper/centos-root:18.8 GB, 18756927488 字节,36634624 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘 /dev/mapper/centos-swap:2147 MB, 2147483648 字节,4194304 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
[[email protected] ~]# mkfs.btrfs -L mydata /dev/sdb /dev/sdc #创建btrfs文件系统,总共40GB
Btrfs v3.16.2
See http://btrfs.wiki.kernel.org for more information.
Turning ON incompat feature ‘extref‘: increased hardlink limit per file to 65536
adding device /dev/sdc id 2
fs created label mydata on /dev/sdb
nodesize 16384 leafsize 16384 sectorsize 4096 size 40.00GiB
[[email protected] ~]# btrfs filesystem show #显示btrfs详细信息
Label: ‘mydata‘ uuid: 6dfeb558-63ca-43cb-ac46-a95ce7375511
Total devices 2 FS bytes used 112.00KiB
devid 1 size 20.00GiB used 2.03GiB path /dev/sdb
devid 2 size 20.00GiB used 2.01GiB path /dev/sdc
Btrfs v3.16.2
[[email protected] ~]# blkid /dev/sdb #查看btrfs文件系统,UUID相同, 子UUID不同
/dev/sdb: LABEL="mydata" UUID="6dfeb558-63ca-43cb-ac46-a95ce7375511" UUID_SUB="e306fe96-df9b-4911-be6b-3cd776b226bf" TYPE="btrfs"
[[email protected] ~]# blkid /dev/sdc
/dev/sdc: LABEL="mydata" UUID="6dfeb558-63ca-43cb-ac46-a95ce7375511" UUID_SUB="1a7b3777-1c7e-414b-9670-17417c288bcf" TYPE="btrfs"
Last login: Tue Aug 23 17:01:48 2016 from 192.168.1.12
[[email protected] ~]# btrfs filesystem show --all-devices #查看btrfs文件系统
Label: ‘mydata‘ uuid: 6dfeb558-63ca-43cb-ac46-a95ce7375511
Total devices 2 FS bytes used 112.00KiB
devid 1 size 20.00GiB used 2.03GiB path /dev/sdb
devid 2 size 20.00GiB used 2.01GiB path /dev/sdc
Btrfs v3.16.2
[[email protected] ~]# btrfs filesystem show /dev/sdb #查看btrfs文件系统
Label: ‘mydata‘ uuid: 6dfeb558-63ca-43cb-ac46-a95ce7375511
Total devices 2 FS bytes used 112.00KiB
devid 1 size 20.00GiB used 2.03GiB path /dev/sdb
devid 2 size 20.00GiB used 2.01GiB path /dev/sdc
Btrfs v3.16.2
[[email protected] ~]# btrfs filesystem label /dev/sdb #查看卷标
mydata
[[email protected] ~]# btrfs filesystem label /dev/sdc
mydata
[[email protected] ~]# mkdir /mydata #新建mydata目录
[[email protected] ~]# mount -t btrfs /dev/sdb /mydata/ #挂载btrfs到mydata目录下
[[email protected]7 ~]# mount
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=491656k,nr_inodes=122914,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/mapper/centos-root on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=31,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
/dev/sda1 on /boot type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
/dev/sdb on /mydata type btrfs (rw,relatime,seclabel,space_cache) #可以看见/dev/sdb 已挂载至mydata目录下
[[email protected] ~]# cd /mydata/ #进入mydata目录
[[email protected] mydata]# touch a.txt #创建文件
[[email protected] mydata]# cp /etc/grub2.cfg ./ #拷贝文件到当前目录下
[[email protected] mydata]# ls
a.txt grub2.cfg
[[email protected] mydata]# cd #返回到根目录
[[email protected] ~]# umount /dev/sdb #卸载sdb磁盘
[[email protected] ~]# ls /mydata/ #查看mydata目录,已没有数据
[[email protected] ~]# mount -o compress=lzo /dev/sdb /mydata #使用lzo方式进行透明压缩,支持lzo zlib两种压缩类型
[[email protected] ~]# cp /etc/rc.d/init.d/functions /mydata/ #文件压缩后在拷贝到mydata目录里
[[email protected] ~]# cd /mydata/
[[email protected] mydata]# ll -l
总用量 20
-rw-r--r--. 1 root root 0 8月 23 17:26 a.txt
-rw-r--r--. 1 root root 13430 8月 23 17:38 functions
-rw-r--r--. 1 root root 4028 8月 23 17:26 grub2.cfg
[[email protected] ~]# btrfs filesystem resize -10G /mydata/ #在线缩减btrfs文件系统大小,将mydata缩减10GB,
Resize ‘/mydata/‘ of ‘-10G‘
[[email protected] ~]# btrfs filesystem show /mydata
Label: ‘mydata‘ uuid: 6dfeb558-63ca-43cb-ac46-a95ce7375511
Total devices 2 FS bytes used 904.00KiB
devid 1 size 10.00GiB used 2.03GiB path /dev/sdb
devid 2 size 20.00GiB used 2.01GiB path /dev/sdc
Btrfs v3.16.2
[[email protected] ~]# df -lh
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root 18G 6.8G 11G 39% /
devtmpfs 481M 0 481M 0% /dev
tmpfs 490M 80K 490M 1% /dev/shm
tmpfs 490M 7.1M 483M 2% /run
tmpfs 490M 0 490M 0% /sys/fs/cgroup
/dev/sda1 497M 126M 372M 26% /boot
/dev/sdb 30G 1.1M 18G 1% /mydata
[[email protected] ~]# ls /mydata/ #mydata目录里的文件仍可正常访问
a.txt functions grub2.cfg
[[email protected] ~]# cat /mydata/grub2.cfg #mydata目录里的文件仍可正常访问
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
[[email protected] ~]# btrfs filesystem resize +5G /mydata/ #联机将mydata大小扩容5GB
Resize ‘/mydata/‘ of ‘+5G‘
[[email protected] ~]# df -lh #sdb的大小为35GB
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root 18G 6.8G 11G 39% /
devtmpfs 481M 0 481M 0% /dev
tmpfs 490M 80K 490M 1% /dev/shm
tmpfs 490M 7.1M 483M 2% /run
tmpfs 490M 0 490M 0% /sys/fs/cgroup
/dev/sda1 497M 126M 372M 26% /boot
/dev/sdb 35G 1.1M 28G 1% /mydata
[[email protected] ~]# btrfs filesystem resize max /mydata/ #将btrfs文件系统调整至最大
Resize ‘/mydata/‘ of ‘max‘
[[email protected] ~]# df -lh #sdb 容量已达到40GB
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root 18G 6.8G 11G 39% /
devtmpfs 481M 0 481M 0% /dev
tmpfs 490M 80K 490M 1% /dev/shm
tmpfs 490M 7.1M 483M 2% /run
tmpfs 490M 0 490M 0% /sys/fs/cgroup
/dev/sda1 497M 126M 372M 26% /boot
/dev/sdb 40G 1.1M 38G 1% /mydata
[[email protected] ~]# btrfs device add /dev/sdd /mydata #将sdd 磁盘添加到btrfs文件系统里
[[email protected] ~]# df -lh #mydata目录容量已达到60GB
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root 18G 6.8G 11G 39% /
devtmpfs 481M 0 481M 0% /dev
tmpfs 490M 80K 490M 1% /dev/shm
tmpfs 490M 7.1M 483M 2% /run
tmpfs 490M 0 490M 0% /sys/fs/cgroup
/dev/sda1 497M 126M 372M 26% /boot
/dev/sdb 60G 1.1M 56G 1% /mydata
[[email protected] ~]# btrfs balance status /mydata/ #检查 btrfs平衡的状态信息
No balance found on ‘/mydata/‘
[[email protected] ~]# btrfs balance start /mydata/ #启动 btrfs平衡的状态,将数据平衡到磁盘上
Done, had to relocate 6 out of 6 chunks
[[email protected] ~]# btrfs device delete /dev/sdb /mydata/ #在线将磁盘移除,系统默认会把所在磁盘上的数据移走
[[email protected] ~]# df -lh #此时的mydata容量为40GB
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root 18G 6.8G 11G 39% /
devtmpfs 481M 0 481M 0% /dev
tmpfs 490M 80K 490M 1% /dev/shm
tmpfs 490M 7.1M 483M 2% /run
tmpfs 490M 0 490M 0% /sys/fs/cgroup
/dev/sda1 497M 126M 372M 26% /boot
/dev/sdc 40G 1.1M 38G 1% /mydata
[[email protected] ~]# btrfs filesystem show /mydata/
Btrfs v3.16.2
[[email protected] ~]# ll -l /mydata/
总用量 20
-rw-r--r--. 1 root root 0 8月 23 17:26 a.txt
-rw-r--r--. 1 root root 13430 8月 23 17:38 functions
-rw-r--r--. 1 root root 4028 8月 23 17:26 grub2.cfg
[[email protected] ~]# cat /mydata/grub2.cfg #mydata目录里的文件照样可以访问
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
set pager=1
if [ -s $prefix/grubenv ]; then
load_env
fi
if [ "${next_entry}" ] ; then
[[email protected] ~]# btrfs device add /dev/sdb /mydata/ #添加设备到btrfs系统里,下面要做rida5,需要3块磁盘
[[email protected] ~]# btrfs filesystem show /mydata/
Btrfs v3.16.2
[[email protected] ~]# btrfs balance start -mconvert=raid5 /mydata/ #将元数据动态改成raid
Done, had to relocate 2 out of 3 chunks
[[email protected] ~]# btrfs balance start -dconvert=raid5 /mydata/ #将数据动态改成raid5
Done, had to relocate 1 out of 3 chunks
[[email protected] ~]# btrfs subvolume list /mydata/ #因为没有创建子卷,所以没有列表显示
[[email protected] ~]# btrfs subvolume create /mydata/logs #在mydata下创建子卷,子卷名为logs
Create subvolume ‘/mydata/logs‘
[[email protected] ~]# btrfs subvolume list /mydata/ #显示子卷列表为logs
ID 263 gen 92 top level 5 path logs
[[email protected] ~]# btrfs subvolume create /mydata/cache
Create subvolume ‘/mydata/cache‘
[[email protected] ~]# btrfs subvolume list /mydata/
ID 263 gen 92 top level 5 path logs
ID 264 gen 93 top level 5 path cache
[[email protected] ~]# umount /mydata/ #卸载mydata
[[email protected] ~]# mount -o subvol=logs /dev/sdb /mnt #需要挂载子卷,要先把父卷卸载,挂载logs子卷,挂载在mnt目录下
[[email protected] ~]# ls /mnt
[[email protected] ~]# cp /var/log/messages /mnt #将messages文件拷贝到logs挂载的mnt目录下
[[email protected] ~]# ls /mnt/
messages
[[email protected] ~]# btrfs subvolume show /mnt #显示子卷的详细信息
/mnt
Name: logs
uuid: f11b002b-db2f-a44c-a53a-ab37eaddfc8a
Parent uuid: -
Creation time: 2016-08-23 20:28:30
Object ID: 263
Generation (Gen): 96
Gen at creation: 92
Parent: 5
Top Level: 5
Flags: -
Snapshot(s):
[[email protected] ~]# umount /mnt/ #卸载子卷,挂载父卷
[[email protected] ~]# mount /dev/sdb /mydata/ #挂载父卷
[[email protected] ~]# ls /mydata/logs/ #挂载子卷时的文件,把子卷卸载了,挂载父卷数据依然存在 ,但是单独挂载子卷,父卷就无法访问
messages
[[email protected] ~]# btrfs subvolume delete /mydata/logs/ #删除子卷,前提是要挂载父卷,才能删除子卷
Transaction commit: none (default)
Delete subvolume ‘/mydata/logs‘
[[email protected] ~]# btrfs subvolume list /mydata #只显示cache子卷
ID 264 gen 93 top level 5 path cache
[[email protected] ~]# btrfs subvolume create /mydata/logs #创建子卷
Create subvolume ‘/mydata/logs‘
[[email protected] ~]# cp /etc/grub2.cfg /mydata/logs/ #将文件拷贝到子卷里
[[email protected] ~]# btrfs subvolume snapshot /mydata/logs/ /mydata/logs/_snapshot #给子卷创建快照,快照卷要与原卷必须 在同一个卷组中,子卷快照必须在父卷组中
Create a snapshot of ‘/mydata/logs/‘ in ‘/mydata/logs_snapshot‘
[[email protected] ~]# btrfs subvolume list /mydata/ #在列表中就多了一个子卷
ID 264 gen 93 top level 5 path cache
ID 265 gen 101 top level 5 path logs
ID 266 gen 101 top level 265 path logs_snapshot
[[email protected] ~]# cd /mydata/logs_snapshot/ #进入到子卷快照中
[[email protected] logs_snapshot]# ll #可以看到子卷里的文件
总用量 4
-rw-r--r--. 1 root root 4028 8月 23 20:42 grub2.cfg
drwxr-xr-x. 1 root root 0 8月 23 20:47 _snapshot
[[email protected] logs_snapshot]# cat grub2.cfg #快照里的文件也可以正常访问
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
set pager=1
if [ -s $prefix/grubenv ]; then
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="${saved_entry}"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
[[email protected] logs_snapshot]# vim /mydata/logs/grub2.cfg #在文件首行里添加新内容
# How are you!!!!
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
[[email protected] logs_snapshot]# cat grub2.cfg #快照子卷里并没有刚才所添加的内容
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
set pager=1
[[email protected] mydata]# btrfs subvolume delete /mydata/logs_snapshot/ #删除子卷快照
Transaction commit: none (default)
Delete subvolume ‘/mydata/logs_snapshot‘
[[email protected] logs]# cp --reflink grub2.cfg grub2.cfg_snap #给单个文件做快照
[[email protected] logs]# btrfs balance start -dconvert=single /mydata/ #拆除元数据
Done, had to relocate 1 out of 3 chunks
[[email protected] logs]# btrfs balance start -mconvert=raid1 /mydata/ #拆除数据
Done, had to relocate 2 out of 3 chunks
[[email protected] logs]# btrfs device delete /dev/sdd /mydata/ #拆除磁盘sdd
[[email protected] ~]# fdisk /dev/sdd
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
Device does not contain a recognized partition table
使用磁盘标识符 0xc3fdf033 创建新的 DOS 磁盘标签。
命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-41943039,默认为 41943039):+5G
分区 1 已设置为 Linux 类型,大小设为 5 GiB
命令(输入 m 获取帮助):w
The partition table has been altered!
Calling ioctl() to re-read partition table.
正在同步磁盘。
[[email protected] ~]# partx -a /dev/sdd
partx: /dev/sdd: error adding partition 1
[[email protected] ~]# partx -a /dev/sdd
partx: /dev/sdd: error adding partition 1
[[email protected] ~]# mke2fs -t ext4 /dev/sdd1 #格式化sdd1
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
327680 inodes, 1310720 blocks
65536 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=1342177280
40 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
[[email protected] ~]# mount /dev/sdd1 /mnt/
[[email protected] ~]# cp /etc/fstab /mnt
[[email protected] ~]# cat /mnt/fstab
#
# /etc/fstab
# Created by anaconda on Thu Dec 31 21:49:05 2015
#
# Accessible filesystems, by reference, are maintained under ‘/dev/disk‘
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=51337a51-d4e3-4c36-bc23-e99029ea570b /boot xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
[[email protected] ~]# umount /mnt/ #卸载mnt, 联机将文件系统改成btrfs文件有风险,所以要先做卸载动作
[[email protected] ~]# fsck -f /dev/sdd1 #对文件强制做检测
fsck,来自 util-linux 2.23.2
e2fsck 1.42.9 (28-Dec-2013)
第一步: 检查inode,块,和大小
第二步: 检查目录结构
第3步: 检查目录连接性
Pass 4: Checking reference counts
第5步: 检查簇概要信息
/dev/sdd1: 12/327680 files (0.0% non-contiguous), 58463/1310720 blocks
[[email protected] ~]# btrfs-convert /dev/sdd1 #将sdd1转换成btrfs文件系统
creating btrfs metadata.
creating ext2fs image file.
cleaning up system chunk.
conversion complete.
[[email protected] ~]# btrfs filesystem show #新的文件系统sdd1出现了
Label: ‘mydata‘ uuid: 6dfeb558-63ca-43cb-ac46-a95ce7375511
Total devices 2 FS bytes used 696.00KiB
devid 2 size 20.00GiB used 2.03GiB path /dev/sdc
devid 4 size 20.00GiB used 1.03GiB path /dev/sdb
Label: none uuid: f6e6dddd-bec5-4884-a411-952d2ca7a72c
Total devices 1 FS bytes used 228.42MiB
devid 1 size 5.00GiB used 5.00GiB path /dev/sdd1
Btrfs v3.16.2
[[email protected] ~]# mount /dev/sdd1 /mnt #此时就可以挂载使用了
[[email protected] ~]# cd /mnt/
[[email protected] mnt]# ls
ext2_saved fstab lost+found
[[email protected] mnt]# cat fstab #文件可以正常访问
#
# /etc/fstab
# Created by anaconda on Thu Dec 31 21:49:05 2015
#
# Accessible filesystems, by reference, are maintained under ‘/dev/disk‘
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=51337a51-d4e3-4c36-bc23-e99029ea570b /boot xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
[[email protected] mnt]# umount /mnt #先卸载mnt目录
[[email protected] ~]# btrfs-convert -r /dev/sdd1 #将sdd1降级回去, 不加"-r",无法将文件系统转换回"ext4"
rollback complete.
[[email protected] ~]# blkid /dev/sdd1 #文件系统就降级回ext4
/dev/sdd1: UUID="ad08cf9d-24ff-49b8-8c54-78c9962d78e7" TYPE="ext4"