[iyunv@localhost ~]# fdisk -l
磁盘 /dev/sda:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x000f09eb
设备 Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 41943039 20458496 8e Linux LVM
磁盘 /dev/sdb: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 字节
这里我们使用sdb和sdc两块磁盘直接格式化为btrfs文件系统:
1
2
3
4
5
6
7
[iyunv@localhost ~]# mkfs.btrfs -L mybtrfs /dev/sdb /dev/sdc
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 mybtrfs on /dev/sdb#卷标创建在sdb上为“mybtrfs"
nodesize 16384 leafsize 16384 sectorsize 4096 size 40.00GiB#空间总大小为40G
这样btrfs文件系统创建完成,是不是很简单?
既然创建已经完成,接下来我们查看一下btrfs具体信息:
btrfs filesystem show #btrfs文件系统的查看命令
1
2
3
4
5
6
[iyunv@localhost ~]# btrfs filesystem show
Label: 'mybtrfs' uuid: 1c74225e-a36b-46b2-8bde-bef50d0f89fb
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
[iyunv@localhost ~]# mkdir /mydata#创建一个挂载点
[iyunv@localhost ~]# mount -t btrfs /dev/sdb /mydata/#挂载btrfs文件系统
[iyunv@localhost ~]# mount | tail -n 5 #mount查看最后一个挂载成功
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
/dev/sda1 on /boot type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
/dev/sr0 on /media/cdrom type iso9660 (ro,relatime)
/dev/sdb on /mydata type btrfs (rw,relatime,seclabel,space_cache)
[iyunv@localhost mydata]# ls
a.txt functions grub2.cfg
[iyunv@localhost mydata]# 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
[iyunv@localhost mydata]# btrfs balance start /mydata/
Done, had to relocate 6 out of 6 chunks#迁移出6个chunks
[iyunv@localhost mydata]# btrfs balance status /mydata/
No balance found on '/mydata/'