SlideShare una empresa de Scribd logo
1 de 45
small silent secure systems
Btrfs
The Nascent GNU/Linux Filesystem
An Introduction
by
Richard Melville
Floss UK Spring Conference 2015 York
Building a Btrfs RAID 1 System
For use as a root file system
Why Btrfs and how does it differ
from other file systems?
● Pooling file system
● Own built-in version of RAID
● Built-in support for SSDs
● Obviates the need for traditional partitions
● Can enable subvolumes and quotas instead of partitions
● Allows snapshots of subvolumes
● Use snapshots for backups
● Use snapshots to roll-back to an earlier state
● Once set up almost everything can be done on the fly
Pooling file system – my definition
A pooling file system creates an area of common storage where
data is stored. The pool can be increased in size by adding more
devices, or decreased by removing them, and this can be achieved
on the fly. This is different from the traditional device partitioning
scheme where fixed areas of storage, or partitions, are rigidly
allocated to various parts of the operating system tree.
Similarities to LVM
BUT
Btrfs works at the file system level rather than a
layer above it
RAID
Btrfs has its own version of RAID built-in
BUT
It differs from MDADM RAID
IMPORTANT!
Btrfs RAID 1 keeps only two copies of data and
metadata no matter how many devices you have
in the pool!!!
And those two copies may be held on any two
devices
Built-in support for SSDs
Your /etc/fstab mount options could include
ssd,discard
Obviates need for traditional
partitioning...
run
mkfs.btrfs /dev/sdx
to format a bare device with the Btrfs file system
...or format a device partition
mkfs.btrfs /dev/sdxx
You can convert an existing partition
1) Unmount the system
umount /dev/sdxx
2) Run a file system check
fsck.extN -f /dev/sdxx
3) Do the conversion
btrfs-convert /dev/sdxx
Change your fstab settings
/etc/fstab
new UUID /mount/point btrfs options 0 0
Reboot and if all is well delete
ext2_saved
ext2_saved is the subvolume saved for you by
the btrfs-convert tool
Example
btrfs subvolume delete ext2_saved
If there is a problem you can
roll-back
So don't delete but rather mount ext2_saved
which has been saved as a subvolume
IMPORTANT!
You should NOT continue using your new viable
Btrfs system without deleting ext2_saved
Using a bootable USB flash drive to
boot into a Btrfs RAID 1 rootfs
The boobtable USB flash looks like this from gdisk
Number Start (sector) End (sector) Size Code Name
1 2048 206847 100.0 MiB 8300 Boot
2 206848 19081215 9.0 GiB 8200 Swap
3 19081216 30282974 5.9 GiB 8300 Resc
Syslinux can be found here
If anybody is interested
https://www.kernel.org/pub/linux/utils/boot/syslinux/
It's worth it, believe me
Download the latest kernel and
btrfs-progs
The latest stable kernel is 3.19.2 from kernel.org
For the latest btrfs-progs run
git clone git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git
If you don't have git install it first
I guarantee the distro repositories won't have
anything like the latest versions.
Let's format our two-device Btrfs
RAID 1 rootfs
mkfs.btrfs -m raid1 -d raid1 /dev/sda /dev/sdb
Clearly, you need to do this from a rescue
system, or externally connect the two devices,
via USB, to a build system, or another system
Change your fstab settings again
/etc/fstab
UUID / btrfs device=/dev/sda,device=/dev/sdb 0 0
The mount options where the devices are listed
would be added to with a comma separated list
of your other options. The full list of possible
mount options can be found here
https://btrfs.wiki.kernel.org/index.php/Mount_options
First create some subvolumes
Create a subvolume for root
btrfs sub create root
Creating further subvolumes
btrfs sub create home
btrfs sub create var
btrfs sub create opt
etc...
Mount your additional subvolumes
/etc/fstab
UUID / btrfs subvolume=root... 0 0
UUID /home btrfs subvolume=home... 0 0
UUID /var btrfs subvolume=var... 0 0
UUID /opt btrfs subvolume=opt... 0 0
etc...
Default subvolume
The default subvolume created automatically is
0/5 into which the system boots if no other
subvolume is passed to mount
This can never be deleted
The default subvolume can be toggled with
btrfs subvolume set-default <id> <path>
Quotas
Quotas can be applied to subvolumes
Run btrfs quota enable /
Before creating your subvolumes
Applying limits to quotas
Example
Run btrfs qgroup limit 1g /var
To limit the size of /var to 1GB
Snapshots
Snapshots are just special subvolumes
Basic example for snapshotting
btrfs subvolume snapshot /home/ /home/snapshot
Snapshot and backup tools using
Btrfs send/receive
Choose one of these tools if you wish to
automate your backups
https://github.com/masc3d/btrfs-sxbackup # written in python
http://www.digint.ch/btrbk/doc/readme.html # written in perl
https://github.com/ruediste/btrbck # written in java
My favourite is the second written in perl
Kernel patch for booting without an
initrd
If you are booting without an initrd you may find
that you need to hack the kernel to stop the
rootfs attempting to load too fast. You can find a
patch here
https://gist.github.com/the8lack8ox/2706705
This will not work with every kernel version, so
you may need to add the appropriate lines of
code manually. The good news is there's not
much to change in the file
Testing the file system
After the system boots successfully run
btrfs fi show /
it may return
Label: 'raid 1' uuid: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Total devices 2 FS bytes used 6.63GiB
devid 2 size 29.82GiB used 8.03GiB path /dev/sda1
*** Some devices missing
Getting rid of an annoying message
Run: btrfs device scan
You will find that the message has disappeared
btrfs fi show /
Label: 'raid 1' uuid: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Total devices 2 FS bytes used 6.63GiB
devid 1 size 29.82GiB used 8.03GiB path /dev/sdb1
devid 2 size 29.82GiB used 8.03GiB path /dev/sda1
You can add btrfs dev scan to a boot script
Scrub your file system
Make sure you run this periodically
btrfs scrub start /
You can test the progress with
btrfs scrub status /
You can run this as a cron job
Booting a corrupted root file system
Boot with
rootflags=degraded
as a kernel boot parameter on whichever boot
loader you use
Replacing the failed device with
another device
btrfs device add /dev/sdx(x) /
Device missing?
If you receive a “device missing” warning when
you run
btrfs fi show /
Then run
btrfs device delete missing /
Summary of steps necessary to
replace a failed device
1) Mount in degraded mode
2) Add a new device
3) Remove the missing device
4) Rebalance the data and metadata with
btrfs balance start -dconvert=raid1 -mconvert=raid1 /
Checking for free disk space
Use this invocation
btrfs fi df <btrfs mountpoint>
And not this
df -h <btrfs mountpoint>
You can test each and see the difference
Abbreviation of commands
Example
sub=subvolume and fi=filesystem
There is no definitive list of shortened forms
You can make them up as you go along
A “shortened-form-failed” example
If instead of btrfs subvolume list we attempted
btrfs s l
The parser would return
: ambiguous token 's'
Did you mean one of these ?
subvolume
scrub
send
Shortened form corrected
So if we run
btrfs su l
The command completes as expected
The parser operates on a contextual basis
Help from the Web
There are many howtos on the web
Here are links to three
https://btrfs.wiki.kernel.org/index.php/Main_Page
https://wiki.archlinux.org/index.php/Btrfs
https://www.howtoforge.com/a-beginners-guide-to-btrfs
Acknowledgements
Gerard Beekmans – The man behind Linux From
Scratch who made it possible initially for us to
build our battery-powered solid-state servers
#btrfs on freenode – a great source of help and
advice
Chris Mason – lead developer of Btrfs
Thank you
Richard Melville
Cellularity Limited
richardm@cellularity.co.uk
@6tricky9
Any questions?

Más contenido relacionado

La actualidad más candente

PostgreSQL on ZFS Lightning Talk
PostgreSQL on ZFS Lightning TalkPostgreSQL on ZFS Lightning Talk
PostgreSQL on ZFS Lightning TalkSean Chittenden
 
PostgreSQL + ZFS best practices
PostgreSQL + ZFS best practicesPostgreSQL + ZFS best practices
PostgreSQL + ZFS best practicesSean Chittenden
 
Zettabyte File Storage System
Zettabyte File Storage SystemZettabyte File Storage System
Zettabyte File Storage SystemAmdocs
 
ZFS by PWR 2013
ZFS by PWR 2013ZFS by PWR 2013
ZFS by PWR 2013pwrsoft
 
Feature rich BTRFS is Getting Richer with Encryption
Feature rich BTRFS is Getting Richer with EncryptionFeature rich BTRFS is Getting Richer with Encryption
Feature rich BTRFS is Getting Richer with EncryptionLF Events
 
RAID, Replication, and You
RAID, Replication, and YouRAID, Replication, and You
RAID, Replication, and YouGreat Wide Open
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copyShay Cohen
 
ZFS Tutorial USENIX June 2009
ZFS  Tutorial  USENIX June 2009ZFS  Tutorial  USENIX June 2009
ZFS Tutorial USENIX June 2009Richard Elling
 
Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)MongoDB
 
Wish list from PostgreSQL - Linux Kernel Summit 2009
Wish list from PostgreSQL - Linux Kernel Summit 2009Wish list from PostgreSQL - Linux Kernel Summit 2009
Wish list from PostgreSQL - Linux Kernel Summit 2009Takahiro Itagaki
 

La actualidad más candente (20)

PostgreSQL on ZFS Lightning Talk
PostgreSQL on ZFS Lightning TalkPostgreSQL on ZFS Lightning Talk
PostgreSQL on ZFS Lightning Talk
 
MySQL on ZFS
MySQL on ZFSMySQL on ZFS
MySQL on ZFS
 
PostgreSQL + ZFS best practices
PostgreSQL + ZFS best practicesPostgreSQL + ZFS best practices
PostgreSQL + ZFS best practices
 
Zettabyte File Storage System
Zettabyte File Storage SystemZettabyte File Storage System
Zettabyte File Storage System
 
ZFS in 30 minutes
ZFS in 30 minutesZFS in 30 minutes
ZFS in 30 minutes
 
ZFS by PWR 2013
ZFS by PWR 2013ZFS by PWR 2013
ZFS by PWR 2013
 
Feature rich BTRFS is Getting Richer with Encryption
Feature rich BTRFS is Getting Richer with EncryptionFeature rich BTRFS is Getting Richer with Encryption
Feature rich BTRFS is Getting Richer with Encryption
 
BiTteRsweet FS
BiTteRsweet FSBiTteRsweet FS
BiTteRsweet FS
 
Scale2014
Scale2014Scale2014
Scale2014
 
ZFS
ZFSZFS
ZFS
 
RAID, Replication, and You
RAID, Replication, and YouRAID, Replication, and You
RAID, Replication, and You
 
4. linux file systems
4. linux file systems4. linux file systems
4. linux file systems
 
Fossetcon14
Fossetcon14Fossetcon14
Fossetcon14
 
ZFS Talk Part 1
ZFS Talk Part 1ZFS Talk Part 1
ZFS Talk Part 1
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copy
 
ZFS Tutorial USENIX June 2009
ZFS  Tutorial  USENIX June 2009ZFS  Tutorial  USENIX June 2009
ZFS Tutorial USENIX June 2009
 
Flourish16
Flourish16Flourish16
Flourish16
 
Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)
 
Wish list from PostgreSQL - Linux Kernel Summit 2009
Wish list from PostgreSQL - Linux Kernel Summit 2009Wish list from PostgreSQL - Linux Kernel Summit 2009
Wish list from PostgreSQL - Linux Kernel Summit 2009
 
ZFS
ZFSZFS
ZFS
 

Similar a Introduction to Btrfs - FLOSS UK Spring Conference York 2015

Grub and dracut ii
Grub and dracut iiGrub and dracut ii
Grub and dracut iiplarsen67
 
Mirroring the root_disk under solaris SVM
Mirroring the root_disk under solaris SVMMirroring the root_disk under solaris SVM
Mirroring the root_disk under solaris SVMKazimal Abed Mohammed
 
101 2.2 install boot manager
101 2.2 install boot manager101 2.2 install boot manager
101 2.2 install boot managerAcácio Oliveira
 
logical volume manager.ppt
logical volume manager.pptlogical volume manager.ppt
logical volume manager.pptPandiya Rajan
 
101 4.3 control mounting and unmounting of filesystems
101 4.3 control mounting and unmounting of filesystems101 4.3 control mounting and unmounting of filesystems
101 4.3 control mounting and unmounting of filesystemsAcácio Oliveira
 
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...Mydbops
 
How to install gentoo distributed
How to install gentoo distributedHow to install gentoo distributed
How to install gentoo distributedSongWang54
 
101 2.1 design hard disk layout
101 2.1 design hard disk layout101 2.1 design hard disk layout
101 2.1 design hard disk layoutAcácio Oliveira
 
Dru lavigne servers-tutorial
Dru lavigne servers-tutorialDru lavigne servers-tutorial
Dru lavigne servers-tutorialDru Lavigne
 
2.1 design hard disk layout v2
2.1 design hard disk layout v22.1 design hard disk layout v2
2.1 design hard disk layout v2Acácio Oliveira
 
Btrfs: Design, Implementation and the Current Status
Btrfs: Design, Implementation and the Current StatusBtrfs: Design, Implementation and the Current Status
Btrfs: Design, Implementation and the Current StatusLukáš Czerner
 
Linux Kernel Development
Linux Kernel DevelopmentLinux Kernel Development
Linux Kernel DevelopmentPriyank Kapadia
 
How to mount and unmount filesystem
How to mount and unmount filesystemHow to mount and unmount filesystem
How to mount and unmount filesystemCOMSATS
 
101 2.1 design hard disk layout v2
101 2.1 design hard disk layout v2101 2.1 design hard disk layout v2
101 2.1 design hard disk layout v2Acácio Oliveira
 

Similar a Introduction to Btrfs - FLOSS UK Spring Conference York 2015 (20)

pptdisk
pptdiskpptdisk
pptdisk
 
Ch12 system administration
Ch12 system administration Ch12 system administration
Ch12 system administration
 
Grub and dracut ii
Grub and dracut iiGrub and dracut ii
Grub and dracut ii
 
Mirroring the root_disk under solaris SVM
Mirroring the root_disk under solaris SVMMirroring the root_disk under solaris SVM
Mirroring the root_disk under solaris SVM
 
101 1.2 boot the system
101 1.2 boot the system101 1.2 boot the system
101 1.2 boot the system
 
101 2.2 install boot manager
101 2.2 install boot manager101 2.2 install boot manager
101 2.2 install boot manager
 
logical volume manager.ppt
logical volume manager.pptlogical volume manager.ppt
logical volume manager.ppt
 
101 4.3 control mounting and unmounting of filesystems
101 4.3 control mounting and unmounting of filesystems101 4.3 control mounting and unmounting of filesystems
101 4.3 control mounting and unmounting of filesystems
 
Xen time machine
Xen time machineXen time machine
Xen time machine
 
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
 
How to install gentoo distributed
How to install gentoo distributedHow to install gentoo distributed
How to install gentoo distributed
 
101 2.1 design hard disk layout
101 2.1 design hard disk layout101 2.1 design hard disk layout
101 2.1 design hard disk layout
 
Dru lavigne servers-tutorial
Dru lavigne servers-tutorialDru lavigne servers-tutorial
Dru lavigne servers-tutorial
 
2.2 install boot manager
2.2 install boot manager2.2 install boot manager
2.2 install boot manager
 
2.1 design hard disk layout v2
2.1 design hard disk layout v22.1 design hard disk layout v2
2.1 design hard disk layout v2
 
Btrfs: Design, Implementation and the Current Status
Btrfs: Design, Implementation and the Current StatusBtrfs: Design, Implementation and the Current Status
Btrfs: Design, Implementation and the Current Status
 
Linux Kernel Development
Linux Kernel DevelopmentLinux Kernel Development
Linux Kernel Development
 
How to mount and unmount filesystem
How to mount and unmount filesystemHow to mount and unmount filesystem
How to mount and unmount filesystem
 
101 2.1 design hard disk layout v2
101 2.1 design hard disk layout v2101 2.1 design hard disk layout v2
101 2.1 design hard disk layout v2
 
Linux Booting Process
Linux Booting ProcessLinux Booting Process
Linux Booting Process
 

Último

Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Vipesco
 
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort ServiceDelhi Call girls
 
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdf
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdfCTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdf
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdfhenrik385807
 
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdfOpen Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdfhenrik385807
 
George Lever - eCommerce Day Chile 2024
George Lever -  eCommerce Day Chile 2024George Lever -  eCommerce Day Chile 2024
George Lever - eCommerce Day Chile 2024eCommerce Institute
 
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...Salam Al-Karadaghi
 
Introduction to Prompt Engineering (Focusing on ChatGPT)
Introduction to Prompt Engineering (Focusing on ChatGPT)Introduction to Prompt Engineering (Focusing on ChatGPT)
Introduction to Prompt Engineering (Focusing on ChatGPT)Chameera Dedduwage
 
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024eCommerce Institute
 
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...Kayode Fayemi
 
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...Sheetaleventcompany
 
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptxMohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptxmohammadalnahdi22
 
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara ServicesVVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara ServicesPooja Nehwal
 
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Pooja Nehwal
 
ANCHORING SCRIPT FOR A CULTURAL EVENT.docx
ANCHORING SCRIPT FOR A CULTURAL EVENT.docxANCHORING SCRIPT FOR A CULTURAL EVENT.docx
ANCHORING SCRIPT FOR A CULTURAL EVENT.docxNikitaBankoti2
 
SaaStr Workshop Wednesday w: Jason Lemkin, SaaStr
SaaStr Workshop Wednesday w: Jason Lemkin, SaaStrSaaStr Workshop Wednesday w: Jason Lemkin, SaaStr
SaaStr Workshop Wednesday w: Jason Lemkin, SaaStrsaastr
 
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779Delhi Call girls
 
Presentation on Engagement in Book Clubs
Presentation on Engagement in Book ClubsPresentation on Engagement in Book Clubs
Presentation on Engagement in Book Clubssamaasim06
 
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...henrik385807
 
Mathematics of Finance Presentation.pptx
Mathematics of Finance Presentation.pptxMathematics of Finance Presentation.pptx
Mathematics of Finance Presentation.pptxMoumonDas2
 
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 

Último (20)

Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510
 
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
 
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdf
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdfCTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdf
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdf
 
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdfOpen Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
 
George Lever - eCommerce Day Chile 2024
George Lever -  eCommerce Day Chile 2024George Lever -  eCommerce Day Chile 2024
George Lever - eCommerce Day Chile 2024
 
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
 
Introduction to Prompt Engineering (Focusing on ChatGPT)
Introduction to Prompt Engineering (Focusing on ChatGPT)Introduction to Prompt Engineering (Focusing on ChatGPT)
Introduction to Prompt Engineering (Focusing on ChatGPT)
 
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
 
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
 
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
 
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptxMohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptx
 
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara ServicesVVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
 
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
 
ANCHORING SCRIPT FOR A CULTURAL EVENT.docx
ANCHORING SCRIPT FOR A CULTURAL EVENT.docxANCHORING SCRIPT FOR A CULTURAL EVENT.docx
ANCHORING SCRIPT FOR A CULTURAL EVENT.docx
 
SaaStr Workshop Wednesday w: Jason Lemkin, SaaStr
SaaStr Workshop Wednesday w: Jason Lemkin, SaaStrSaaStr Workshop Wednesday w: Jason Lemkin, SaaStr
SaaStr Workshop Wednesday w: Jason Lemkin, SaaStr
 
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
 
Presentation on Engagement in Book Clubs
Presentation on Engagement in Book ClubsPresentation on Engagement in Book Clubs
Presentation on Engagement in Book Clubs
 
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...
 
Mathematics of Finance Presentation.pptx
Mathematics of Finance Presentation.pptxMathematics of Finance Presentation.pptx
Mathematics of Finance Presentation.pptx
 
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkata
 

Introduction to Btrfs - FLOSS UK Spring Conference York 2015

  • 1. small silent secure systems Btrfs The Nascent GNU/Linux Filesystem An Introduction by Richard Melville Floss UK Spring Conference 2015 York
  • 2. Building a Btrfs RAID 1 System For use as a root file system
  • 3. Why Btrfs and how does it differ from other file systems? ● Pooling file system ● Own built-in version of RAID ● Built-in support for SSDs ● Obviates the need for traditional partitions ● Can enable subvolumes and quotas instead of partitions ● Allows snapshots of subvolumes ● Use snapshots for backups ● Use snapshots to roll-back to an earlier state ● Once set up almost everything can be done on the fly
  • 4. Pooling file system – my definition A pooling file system creates an area of common storage where data is stored. The pool can be increased in size by adding more devices, or decreased by removing them, and this can be achieved on the fly. This is different from the traditional device partitioning scheme where fixed areas of storage, or partitions, are rigidly allocated to various parts of the operating system tree.
  • 5. Similarities to LVM BUT Btrfs works at the file system level rather than a layer above it
  • 6. RAID Btrfs has its own version of RAID built-in BUT It differs from MDADM RAID
  • 7. IMPORTANT! Btrfs RAID 1 keeps only two copies of data and metadata no matter how many devices you have in the pool!!! And those two copies may be held on any two devices
  • 8. Built-in support for SSDs Your /etc/fstab mount options could include ssd,discard
  • 9. Obviates need for traditional partitioning... run mkfs.btrfs /dev/sdx to format a bare device with the Btrfs file system
  • 10. ...or format a device partition mkfs.btrfs /dev/sdxx
  • 11. You can convert an existing partition 1) Unmount the system umount /dev/sdxx 2) Run a file system check fsck.extN -f /dev/sdxx 3) Do the conversion btrfs-convert /dev/sdxx
  • 12. Change your fstab settings /etc/fstab new UUID /mount/point btrfs options 0 0
  • 13. Reboot and if all is well delete ext2_saved ext2_saved is the subvolume saved for you by the btrfs-convert tool Example btrfs subvolume delete ext2_saved
  • 14. If there is a problem you can roll-back So don't delete but rather mount ext2_saved which has been saved as a subvolume
  • 15. IMPORTANT! You should NOT continue using your new viable Btrfs system without deleting ext2_saved
  • 16. Using a bootable USB flash drive to boot into a Btrfs RAID 1 rootfs The boobtable USB flash looks like this from gdisk Number Start (sector) End (sector) Size Code Name 1 2048 206847 100.0 MiB 8300 Boot 2 206848 19081215 9.0 GiB 8200 Swap 3 19081216 30282974 5.9 GiB 8300 Resc
  • 17. Syslinux can be found here If anybody is interested https://www.kernel.org/pub/linux/utils/boot/syslinux/ It's worth it, believe me
  • 18. Download the latest kernel and btrfs-progs The latest stable kernel is 3.19.2 from kernel.org For the latest btrfs-progs run git clone git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git If you don't have git install it first I guarantee the distro repositories won't have anything like the latest versions.
  • 19. Let's format our two-device Btrfs RAID 1 rootfs mkfs.btrfs -m raid1 -d raid1 /dev/sda /dev/sdb Clearly, you need to do this from a rescue system, or externally connect the two devices, via USB, to a build system, or another system
  • 20. Change your fstab settings again /etc/fstab UUID / btrfs device=/dev/sda,device=/dev/sdb 0 0 The mount options where the devices are listed would be added to with a comma separated list of your other options. The full list of possible mount options can be found here https://btrfs.wiki.kernel.org/index.php/Mount_options
  • 21. First create some subvolumes
  • 22. Create a subvolume for root btrfs sub create root
  • 23. Creating further subvolumes btrfs sub create home btrfs sub create var btrfs sub create opt etc...
  • 24. Mount your additional subvolumes /etc/fstab UUID / btrfs subvolume=root... 0 0 UUID /home btrfs subvolume=home... 0 0 UUID /var btrfs subvolume=var... 0 0 UUID /opt btrfs subvolume=opt... 0 0 etc...
  • 25. Default subvolume The default subvolume created automatically is 0/5 into which the system boots if no other subvolume is passed to mount This can never be deleted The default subvolume can be toggled with btrfs subvolume set-default <id> <path>
  • 26. Quotas Quotas can be applied to subvolumes Run btrfs quota enable / Before creating your subvolumes
  • 27. Applying limits to quotas Example Run btrfs qgroup limit 1g /var To limit the size of /var to 1GB
  • 28. Snapshots Snapshots are just special subvolumes Basic example for snapshotting btrfs subvolume snapshot /home/ /home/snapshot
  • 29. Snapshot and backup tools using Btrfs send/receive Choose one of these tools if you wish to automate your backups https://github.com/masc3d/btrfs-sxbackup # written in python http://www.digint.ch/btrbk/doc/readme.html # written in perl https://github.com/ruediste/btrbck # written in java My favourite is the second written in perl
  • 30. Kernel patch for booting without an initrd If you are booting without an initrd you may find that you need to hack the kernel to stop the rootfs attempting to load too fast. You can find a patch here https://gist.github.com/the8lack8ox/2706705 This will not work with every kernel version, so you may need to add the appropriate lines of code manually. The good news is there's not much to change in the file
  • 31. Testing the file system After the system boots successfully run btrfs fi show / it may return Label: 'raid 1' uuid: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Total devices 2 FS bytes used 6.63GiB devid 2 size 29.82GiB used 8.03GiB path /dev/sda1 *** Some devices missing
  • 32. Getting rid of an annoying message Run: btrfs device scan You will find that the message has disappeared btrfs fi show / Label: 'raid 1' uuid: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Total devices 2 FS bytes used 6.63GiB devid 1 size 29.82GiB used 8.03GiB path /dev/sdb1 devid 2 size 29.82GiB used 8.03GiB path /dev/sda1 You can add btrfs dev scan to a boot script
  • 33. Scrub your file system Make sure you run this periodically btrfs scrub start / You can test the progress with btrfs scrub status / You can run this as a cron job
  • 34. Booting a corrupted root file system Boot with rootflags=degraded as a kernel boot parameter on whichever boot loader you use
  • 35. Replacing the failed device with another device btrfs device add /dev/sdx(x) /
  • 36. Device missing? If you receive a “device missing” warning when you run btrfs fi show / Then run btrfs device delete missing /
  • 37. Summary of steps necessary to replace a failed device 1) Mount in degraded mode 2) Add a new device 3) Remove the missing device 4) Rebalance the data and metadata with btrfs balance start -dconvert=raid1 -mconvert=raid1 /
  • 38. Checking for free disk space Use this invocation btrfs fi df <btrfs mountpoint> And not this df -h <btrfs mountpoint> You can test each and see the difference
  • 40. There is no definitive list of shortened forms You can make them up as you go along
  • 41. A “shortened-form-failed” example If instead of btrfs subvolume list we attempted btrfs s l The parser would return : ambiguous token 's' Did you mean one of these ? subvolume scrub send
  • 42. Shortened form corrected So if we run btrfs su l The command completes as expected The parser operates on a contextual basis
  • 43. Help from the Web There are many howtos on the web Here are links to three https://btrfs.wiki.kernel.org/index.php/Main_Page https://wiki.archlinux.org/index.php/Btrfs https://www.howtoforge.com/a-beginners-guide-to-btrfs
  • 44. Acknowledgements Gerard Beekmans – The man behind Linux From Scratch who made it possible initially for us to build our battery-powered solid-state servers #btrfs on freenode – a great source of help and advice Chris Mason – lead developer of Btrfs
  • 45. Thank you Richard Melville Cellularity Limited richardm@cellularity.co.uk @6tricky9 Any questions?

Notas del editor

  1. This will be a Simple introduction Anybody used it Stop me at any time if you have a question
  2. Other options open single device, RAID 0, RAID 10 Too fully featured to cover everything Not enough time today But I wanted to start at the beginning as one would when installing Btrfs for the first time. Listing the necessary steps and flagging possible pitfalls.
  3. The first thing that Btrfs does is to pool all devices. RAID 0 is much the same as MDADM RAID 0. Data and metadata striped across as many disks as you have but with no redundancy. Btrfs RAID 10 is built on those precepts.
  4. You could have added 2 disks or you could have added 20 but Btrfs keeps only two copies.
  5. SSD has optimisations built-in Rotational in /sys should be set at 0 Discard brings back into service discarded blocks that are no longer in use.
  6. You might still need a partition if you wish to:- Use different file systems on the same device Have a swap file Or you might want to just try btrfs out on a spare partition
  7. If you don&amp;apos;t every action to your new system gets mirrored on the backup subvolume Don&amp;apos;t forget that the saved subvolume is a copy of your original OS and that wasn&amp;apos;t Btrfs, so your trying to maintain two different file systems.
  8. As a point of interest, I always boot my systems from a 16GB USB flash drive. I create three GPT partitions. I take it everybody knows what I&amp;apos;m talking about when I say GPT? “Globally Unique Identifiers Partition Table”. It&amp;apos;s the successor to the legacy MBR style partitioning scheme where we&amp;apos;re stuck with only four primary partitions and are forced to use the extended partition kludge to achieve a greater number of logical partitions.
  9. use Syslinux rather than Grub2 because, while I really liked legacy Grub, I think that Grub2 has become excessively bloated. Syslinux, on the other hand, is small, light, fast and under constant development, and it&amp;apos;s a pleasure to use. The other benefit here is that once set up the flash drive can be cloned with dd to boot other boxes from flash drives.
  10. I&amp;apos;m not an expert on distros
  11. Btrfs enabled in your kerne –latest kernel built-in and not as a module the userspace btrfs-progs – latest from the kernel devs major distributions already have Btrfs loaded in the kernel, with the btrfs-progs in the repository I&amp;apos;m no expert on the various distributions. In fact, come to think of it, I would never refer to myself as an “expert” on anything. Why is that you may ask? Or maybe not. However, the term “expert” has unfortunate connotations. Maybe some of you know this. Many “experts” that I&amp;apos;ve met over the years, and as you can see there have been many of those years. I&amp;apos;ve been around the block a few times. Well, many of those “experts”, unfortunately, have turned out to be of the type where X was the unknown quantity, and spurt was the drip under pressure. I don&amp;apos;t wish to be associated with those people.
  12. Subvolumes are the key to flexibility
  13. This is where the root file system will be mounted You don&amp;apos;t have to call it root
  14. These will be mounted on the corresponding directories
  15. Once you have your subvolumes with quotas applied they behave very much like a traditional partition. The main difference is that they can be shrunk, extended, deleted re-created on a running system. You don&amp;apos;t have to reboot. I&amp;apos;m a big fan of Erlang. Erlang is a fault tolerant language developed by Ericsson back in the 1980s for its telephone switches. It has concurrency built in, and Ericcson claims to have a running system in its labs with the elusive nine nines uptime. An Erlang mantra is “let it crash”, meaning processes can crash and be restarted on a running system. I&amp;apos;m not saying that Btrfs works in the same manne but there are a lot of cool tings you can do on a running system at the file system level
  16. “missing” is a Btrfs term for a specific device
  17. The GNU Coreutils df tool does not return the correct free space.
  18. I think this is really cool If you have a number of commands to enter it can save a great deal of time Some may disagree – it&amp;apos;s a free country
  19. Official Btrfs wiki Archlinux geared towards systemd and we don&amp;apos;t use that. We generally build our own systems, although we do use Linux Mint – generally as a demonstration for Windows users to show them what a nice environment they could be working in. Third one is simple and good but with a caveat: the final column of the fstab should be 0 and not 1