Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Btrfs: A "Next Generation" File System

Btrfs: A "Next Generation" File System

A brief introduction to Btrfs filesystem presented in the annual FOSS Communities meeting in Greece.

Pavlos Ratis

April 18, 2014
Tweet

More Decks by Pavlos Ratis

Other Decks in Technology

Transcript

  1. Btrfs: A “Next Generation” File System A gentle introduction Pavlos

    Ratis [email protected] FOSSCOMM 2014 Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 1 / 24
  2. About me Undergraduate Informatics Engineer @ T.E.I of Central Macedonia

    Gentoo Linux Developer since late 2012 Greek Gentoo Linux Community Member Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 2 / 24
  3. Outline 1 Introduction 2 Design & Architecture 3 Features 4

    Future 5 Conclusion Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 3 / 24
  4. Introduction B-tree FS, Butter FS, Better FS, Bee Tee Arr

    Eff Ess Supported OS: Linux License: GPL History First Development: Oracle, 2007 Introduced: Linux kernel 2.6.29, 2009 Orgs Facebook Fujitsu Google Linux Foundation Oracle Red Hat SUSE Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 4 / 24
  5. Outline 1 Introduction 2 Design & Architecture 3 Features 4

    Future 5 Conclusion Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 5 / 24
  6. Structure B-Tree data structure Max file/volume size: 16 EB Max

    file numbers: 16 EB Max file name length: 255 chars File allocation: extent Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 6 / 24
  7. First steps Get it! btrfs-progs / btrfs-tools (Gentoo, Debian, openSUSE,

    Fedora, etc) Create a new file system # mkfs.btrfs -L label /dev/partition # mount /dev/partition /mnt/btrfs # edit /etc/fstab Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 7 / 24
  8. Viewing filesystem information View allocated space # btrfs filesystem df

    / Data, single: total=121.01GiB, used=112.24GiB System, DUP: total=8.00MiB, used=24.00KiB System, single: total=4.00MiB, used=0.00 Metadata, DUP: total=11.00GiB, used=1.96GiB Metadata, single: total=8.00MiB, used=0.00 Showing Btrfs partition info # btrfs filesystem show /dev/partition Label: ’gentoo64’ uuid: dcea671d-b166-41cb-8cfd-60cff921ddc5 Total devices 1 FS bytes used 114.20GiB devid 1 size 538.17GiB used 143.04GiB path /dev/partition Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 8 / 24
  9. Outline 1 Introduction 2 Design & Architecture 3 Features 4

    Future 5 Conclusion Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 9 / 24
  10. Btrfs Features 1 Copy-on-Write(CoW) Deduplication File cloning(reflink) Multi device support

    Volume manager Subvolumes Online Resizing Built-in RAID support Quota support Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 10 / 24
  11. Managing Btrfs Creating a sub-volume # btrfs subvolume create home

    Listing sub-volumes # btrfs subvolume list . ID 257 gen 218770 top level 5 path home Online Resizing Growing: # btrfs filesystem resize +2G /mnt/btrfs/home Shrinking:# btrfs filesystem resize -4G /mnt/btrfs/home Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 11 / 24
  12. Btrfs Features 2 Checksums (Data & Metadata) Online Scrubbing Online

    Balancing Online file system defragmentation Offline file system check (btrfsck) Transparent compression (ZLIB, LZ0) SSD optimizations / TRIM support Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 12 / 24
  13. Defragmentation / Scrubbing Online defrag # btrfs filesystem defragment -r

    / Online scrubbing # btrfs scrub start / Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 13 / 24
  14. Sysadmin Perspective RAID (1,0,10,5,6) support Snapshots & Rollback Manually Snapper:

    Awesome Snapshotting Tool Misc scripts Send/Receive changes Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 14 / 24
  15. Managing Snapshots manually Creating a snapshot # btrfs subvolume snapshot

    /mnt/btrfs/home /mnt/btrfs/home/snapshot Rolling back a snapshot # mount /mnt/btrfs # umount /home # mount -o defaults,subvol=home snapshot 28042014 /dev/sda /home # btrfs subvolume delete /mnt/btrfs/home # mv /mnt/btrfs/home snapshot 28042014 /mnt/btrfs/home # umount /mnt/btrfs Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 15 / 24
  16. Outline 1 Introduction 2 Design & Architecture 3 Features 4

    Future 5 Conclusion Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 16 / 24
  17. Limitation No Swap files No built-in encryption support dm-crypt /

    LUKS TrueCrypt EncFS RAID 5/6 Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 17 / 24
  18. Future Features Improved offline file system check Online file system

    check More compression: Snappy, LZ4 Alternative checksum algorithms Completion of RAID 5/6 Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 18 / 24
  19. Outline 1 Introduction 2 Design & Architecture 3 Features 4

    Future 5 Conclusion Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 19 / 24
  20. Btrfs wins Production use in Jolla Facebook (Currently: Testing for

    production use) Default file system in openSUSE 13.2 Support in SUSE Linux Enterprise 11 SP2 Support in Docker Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 20 / 24
  21. ext* VS Btrfs Offline ext3/4 to Btrfs migration BACKUP YOUR

    DATA FIRST! ... # btrfs-convert /dev/partition ... Pavlos Ratis ([email protected]) Btrfs: A “Next Generation” File System FOSSCOMM 2014 21 / 24