BTRFS Guide | The Best Desktop File System

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
better FS a better file system for Linux desktop and it's badly misunderstood there's a lot of issues that people just can't really wrap their brain around and I sit there for four or five hours I think of a live stream just kind of hacking away with some people like contributing said oh you should do this or that and really this is all that knowledge condensed down into a very short segment I'm gonna try and keep this around 20 minutes but we got a lot to cover today we're gonna be going over basic commands the actual structure of better FS and how to use it because there's chances if you've done like a vanilla arch install you're not even using better FS correctly with subvolumes and then you got snapshots which is the best feature in better FS one that you should be using if you're using better FS and then of course just standard raid for some redundancy and I'm just gonna be doing mirrored raid arrays because that's probably gonna be the most amount of people again this is for desktop Linux in business yeah I don't think I'll probably use better FS but I wouldn't really use Linux for file sharing in many instances as it's not my favorite so with all that said let's get into it really do a deep dive into better FS so you can better understand it so we're gonna start like I do all my tutorial based videos with the guide on Chris Titus calm this one's Chris Titus calm btrfs - guide or butter FS and from there you'll be able to get all of these commands and also the links in the description but you need to know certain things about better FS the file system itself it depends on how you install it too many people just install better FS and goes hey I'm got a better FS partition therefore I'm using it and that is not true the first thing you need to know is the structure you have your standard top-level partition and then you have sub volumes underneath that nothing should be stored in this top level here if it is and you install let's say Linux on your top level you'll not be able to use snapshots and all the other cool features of better FS so it's super important to actually make sub volumes before you install Linux I only bring this up because I used Arch Phi and it was a complete nightmare because I installed it all on the top level to check to see where everything is we can simply do some of the basic commands now I'm gonna actually jump to the middle of the basic commands here just because I'm talking about this top level and the sub volumes just know that your route should be a sub volume and typically that can be the only sub volume you have on your whole system that's totally okay I actually have a couple different ones as right here if you do a disk free you'll see I have four different physical disks with better FS on them and they're all independent sub volumes and I did that kind of on purpose as I'm not doing any raid arrays but getting back to what we talked about we need to actually do a listing so we're gonna actually do a sub vol list and our mount point and we're gonna just take the very front part of that mount point come over to our terminal type this in and you'll see here is all the sub volumes we have on this so you have the top one which is root the dash at at 256 or actually 288 is the ID the ID is definitely come into hand handy especially when you have specific names for what you got going on so if we go in cat ET CF stab you'll see that we and we mount our actual root directory as better FS I actually specify the sub volume to 88 now you can jump around here and go to specific time shift things so I do a time shift of my root directory so I could easily restore and that restore happens instantaneously so it's an atomic swap and it just happens immediately so if I needed to let's say just get pushed to this specific time I could say you know what I'm gonna go with ID 304 and then just change this sub volume to 304 and reboot and I would be at that exact time as far as a restore or I could go through time shift and copy that entire sub volume into my root however you want to play it you can do either one but just know you can boot directly into these different snapshots and it's all deduplicated so it doesn't have exact one-to-one copy of every single file it's how better FS works is it doesn't need to copy something that is already on the disk so that's really the power of it better FS is a snapshot capabilities which is fantastic so just to go ahead I have another drive that actually mounted as my home drive so let's let's do a solve volume list again and go home and you'll notice that we have a couple different options to choose from here so we're gonna go ahead and restore one of these snapshots just so you can see it in person today so we have one from yesterday 114 and this is the home path if we look at our fstab if we look towards home right here you'll see subvolume at home so actually this one that it's pulling from is right here ID two six seven is the actual one it's using so if we want to go ahead and pull a snapshot from 114 we can do that using id 321 so let's go ahead and go sudo nano et Cie fstab and we're gonna change this mount directory over here so sub Vall instead of actually using the name which I don't recommend I think when I was doing this I was tinkering around and I was using the name just like you don't want to use like dev SD b3 or something like that you want to use the UUID for your actual hard drive so on here we'll use the sub volume three two one was that it yeah oh uh write that out yeah three two one that was it so it'll actually go ahead and boot to this one but before we do that lets do a listing of what we have here so this is everything I don't see anything that's really been changed except for maybe pictures folder but let's go ahead and just touch test file dot txt and you'll see if we do a listing the test files there but we're gonna go reboot the PC come back into our terminal and see what we get as far as that that test file should disappear all right log back in and we'll go right to our terminal now we'll do a list and sure enough that test file isn't there and if you look actually the pictures folder has been shot back to who January 14th as well that actually had an edit from the 15th but let's say you're on here and go oh crap something happened or I made this big change that was on my other snapshot again you can just go sudo nano et Cie fstab and flip back to that actual sub volume but before we do that lets do a listing of that sub volume just to make sure we we get it also will go sudo better FS sub V or our volume you can spell it all the way up list and then we're gonna go home now from here we will actually want the at home that's ID 267 so again I always recommend using sub volume IDs as we're on 321 right now we'll go ahead sudo nano et Cie fstab and we'll come back over into here and I think was 267 write that out double-check our ID sure enough it is there and we're gonna go ahead and reboot again and we should see the test file come back and we actually should see that the pictures folder has been modified on the 15th so let's see what happens all right so here we are we're in our home directory will go listing and there we are we're back on our proper sub volume so that's the power of snapshots like you can literally bounce around I could do this on my root directory I could do it on my home directory I have it set up that method so it's all about that directory structure and getting it set up perfectly make sure you pay careful attention to this when you set up your system as if you set up better FS and you're not using sub volumes it's you might as well be using any other file system because you're missing out on all of the good parts of better FS so now that we understand that a bit I want to clarify a couple things here when I first did better FS I messed up I put it on my top level instead of an actual sub volume and to get out of this I went ahead and made a snapshot to create that sub volume and then I just basically took that snapshot and needed a boot from it after changing its fstab to have sub volume ID in that actual thing now that sounds easy to do because creating the snapshot is very simple and changing the fstab is also very simple on that snapshot but there is one more catch here it's booting from this actual top level so that means you have to rebuild grub outside of this install so I had to chmod using a live ISO to accomplish the move from the top level to an actual sub volume so don't do that hopefully you didn't mess up or hopefully the Installer was a little more friendly I was using Arch Phi and Arch Phi's better FS is set up incorrectly where it doesn't use a sub volume or better FS correctly so that kind of is a bummer but you know that's what I get for using just two random scrip off the internet so with that said you can actually go in these snapshots let's say you didn't need to reboot and go into a home and you didn't want to boot from it you just like you know what that file changed I just want to grab that one file that changed well it's actually pretty easy to do so we can easily look at our snapshots coming back into here let's take a peek at our snapshots so to easily go ahead and mount this snapshot using ID three two one we actually needed to go sudo better or actually before this we need to know what device this is so we'll do LS B okay we'll know that the home directory is actually on s de is that that's it so I forgot the partition this quite the right way but this will work just fine so for most people though it would be when using this command as dev as de one is the actual partition however I partition this entire disk to just this one thing so there's no numbers after it you can definitely get in trouble doing it this way but I did it so now that we know the actual partition that we need to mount we can go mount we should have all of our homes so if we do a listing of home now let's do a listing of MNT and you'll see that we have the entire home so we can go into CD m and T take a list go to CD Titus list that and you'll see that it's that 14th snapshot so that's kind of cool all right so we have that done now once we're finished obviously you mount MNT or sudo you mount enmity and get rid of that mount point so it's not just sitting there hanging out but it's a neat way to just go ahead and mount one of these snapshots look at what's in that snapshot grab that one file that you messed up grab it back I never have to worry about this stuff and the great thing about it is those snapshots take up almost no room speaking of which we need to figure out how much space is on our thing now you have the traditional D F - H and you're like okay on the home directory it has 18 gigs used in that well we want to get a little more granular with that with better FS those snapshots do take some room but how much is better FS ticking up so we can figure that out so for disk usage under that and I'll edit my website to reflect this the - s is a summarized command that you need to use this will actually take a little bit to build and then once it's built it'll spit it out right here so this actually tells me exactly how much is being actually used right now it's using 28 gigs it's sharing 15.6 gigs of that across all of our snapshots which is pretty cool and we can delete snapshots and kind of clean this up and you'll you'll see this exclusive number go down the set share number will probably stay that about the same but this total number will actually get reduced as well so very cool so you can kind of get that you also have the disc free command as well which gives you a little more info than what we saw from the musing DF on the other one so if we go DF - home we can go ahead and do that you'll see the data set itself takes about 17 gigs the system is using about 8 Meg's metadata is 1 gig and then the global reserves using 36 so this kind of gives you a little bit of a breakdown of how better FS uses your filesystem and to get a breakdown of your sub volumes and seeing what all is being used because you can add multiple devices and sub volumes you can use filesystem or fi show and that shows that so let's do that real fast and you'll see right there I have four different hard drives assigned a four different sub volumes so I'm not using any raid here or any anything like that I probably will go ahead and move this around a little bit and probably do some type of ray now there's couple things I threw in here this is actually scrubbing the sub volume this kind of cleans it up a bit and then also balance which balance is more important when you have multiple disks in the same sub volume this balances the actual data between both disks which is important to do every once in a while that way you don't have one disk completely fill up or one you know just kind of get out of whack it also helps with performance on better FS because if it's constantly reading everything from one disk you're gonna lose a lot of that read/write benefit from having like let's say a striped array in in better FS so balancing your data is important with the balanced command and then make sure you use these filters because if you don't use the filters it's just gonna go through block by block every disk you'll take forever it'll use up all your resources it's just no fun this basically just says hey filter it based on block usage if you have more than 50% of the block being used it needs to be balanced so that's what it does is just kind of cell you know gets it to the point where it'll easily run this balanced command and it'll do it rather quickly and efficiently but let's say you mess up and don't do that I went ahead and added the cancel command because I didn't use it without filters at first and it just rain and rain and ran and that's not good so I just cancelled that out waited a minute for it to finalize the cancel and then I reran it with the filters and everything was right with the world so we already kind of went over the sub volumes based on mount point very important to know and then mounting this directly this is actually supposed to be the mount command right here not better FS but Mountain - o sub volume ID 267 I actually will fix this when this goes live but for today just know if you if you get this right as the videos released it might still say better FS that actually should say Mountain - OH so with that we got snapshots I already kind of went into actually restoring snapshots because I thought this is the most powerful thing about better FS this is where better FS shines this is where you should be using better FS if you don't use snapshots honestly probably should be using a different file system because this is where better FS is just awesome it's it's great the performance is awesome having this abilities great managing it is fairly simple you know once you figure out the sub volumes delete and creating a new snapshot you can manually take snapshots so after making halfway through this tutorial I realized I didn't like my structure and I wanted to just completely move everything off so I kind of changed my fstab and if we look here I want to just walk through I'm utilizing this I changed this I had it own home directory and its own Drive and I'm like you know what I don't really like that anymore so I commented this out booted back in of course I had problems booting because my home directory was no longer there and then basically what I did is I mounted this sub volume 267 into like the M&T folder copied all over to home rebooted and then everything was right with the world and everything sitting on this one drive under sub volume 288 so everything right now I wanted to make it a little more simplistic and clean up my F step so we're gonna go ahead kill this and now we have just kind of an extra disk we can play around with in the next step with multiple disks we fixed our F stab up and just kind of simplified it so if we look at better FS sub ball list and then our mount point of root you'll notice we have our root and then we have a couple root var things I don't know quite what those IDs are typically when you create a system under better FS it it adds those sub volumes so I'm just gonna leave them alone and then the @ symbol that's what we're actually running on that's where all our system is it's what it boots to and if we actually boot into timeshift here and we'll login authenticate and we can actually create and we go settings here's how I have my time shift setup now that we actually are on a sub volume I have it set as better FS the location you just specify your drive that has better FS set up the schedule I want daily users just include the entire home directory now if you've ever used time shift before this is a lot better than our sink so it's kind of cool under users you just say yeah include my entire home directory that's cool in enable queue groups which is actually good that's actually for quotas and things of that nature so it doesn't get out of control and then miscellaneous just kind of is a naming scheme for the actual thing so I usually do just the defaults here but you can actually change this up and get a little fancy with it like but for that we'll leave it at defaults and come back into here hit okay so from here we can easily just create a snapshot now now if you run into a problem using the singular directory you can come into settings and notice that it uses this at home sub volume this means you have two drives or two different partitions one for home one for root this would need to be checked and it would need this at home as the actual sub volume name so very important my root is just the @ symbol so that works but if I were to create another sub volume and another drive for my home it would be needin aimed at home for time shift or you could just use the command prompt or the CLI however I like how time shift manages this and I just just really really dig how it manages this snapshot so very very fast a lot faster than our sink and I can restore at any point in time now let's get a little more complex here and go into multiple discs let's go back to our cheat sheet we've got kind of snapshots down pat we can create them we can restore them we can boot off them you can do a whole bunch of stuff with better FS snapshots in comes multiple discs and rape and really all raid is for this is some redundancy I didn't put rate zero or anything for performance in here because honestly if you're looking for performance don't use better FS it's gonna underperform ext4 x FS you name it it's gonna underperform it better FS though it may be in the future this will change you know but I still don't trust its striping capabilities there's a lot of issues you know a lot of people said things in the forum's raid5 is still listed as unstable on their site so I don't use raid 5 obviously and for today's video let's do a raid 1 setup I like adding that so let's take a look at our entire file system layout in better FS and then we're gonna go ahead and do just a simple raid 1 and we're not actually creating it we're gonna add it to and existing and convert an existing better FS partition to rate one so we can easily do that by just adding a disk to an existing sub volume if you look right here we're gonna just add it and let's take a look at our mount points and disks real fast and then we'll see where to add that disk so we'll do it LS blk right fast you'll see that we have this extra SD e one disk just kind of hanging out and then we have that exact same it's replica it's the same disk so it makes a lot of sense to add this to our existing better FS media backup but we want to verify that is truly a better FS thing so we'll do file systems show and we're gonna go media backup and you'll see that is labeled data one has this UUID there's a total of one device in here so I think from here we can easily add this to this guy so let's do that so we'll go better FS device add and then we choose dev SD e1 and we're gonna go ahead and add it to media backup oh and it actually see this already contains an existing file system use the F option to overwrite of SD one so we could either go into gparted wipe that out or we could just do dash F to force it and then we should have that device on there so we'll do an LS blk real fast see if that changed at all it hasn't yet but let's go ahead and do that filesystem show command again you'll notice we actually added that device so this one right here it has nothing used yet we need to balance these disks out to truly actually be mirroring everything in the files so to do that we simply come into here we're gonna do a balance and do grade one on our file system mount point so we'll come back paste this in and then it's under media backup so this will go through balance the first disks which currently has all the data with the second disk which we just added and it'll be replicating and be that true raid one so we'll have some redundancy built onto the secondary drive and that's multi disks I could go into like raid five and also this but I don't really like raid five professionally I've never used raid five and probably the past ten years medias so cheap that if you really want true redundancy you should be doing rate in which means get another disk four disks at a minimum to do raid ten so have four identically you know labeled disk would be great if you don't you can still technically do it however I think that's a little janky and why I don't really do anything other than rate ten and rate one stripe trades is all for performance and I just don't like this honestly if you just do if you're on a performance junkie you'd probably be better off just doing a stripe trade use an MD in an ext4 file system and get higher performance than you'd ever see in a raid zero on better FS so you can do raid zero use an MD on a traditional Linux system and see a decent performance bump but I always think stripe trades is just silly you're just asking for problems because if one disk fails you're completely boned so with that that's the basis of better FS great file system I love it I can totally see every single patch most kernel patches has some improvement to better if s so I truly think this will be kind of like the future Desktop Linux file system even though I'm a big ZFS junkie and I know ZFS just really sucks for Linux and that's mainly just because of licensing ZFS itself is still my favorite filesystem and if I'm in a business and I want to do filesystem I'm never using Linux typically I'm usually using FreeBSD and ZFS whenever possible but for today this gets you going on better FS and that was better FS and I gotta say in the middle of this video I started to have issues with my structure I just didn't like how it looked so I was like you know what I'm gonna change this and I wiped out my home partition and basically put home back onto my root Drive and then just kind of changed it up a little bit so we could do that mirroring towards the end the cool thing about better FS is its flexibility I really didn't talk too much about that but just being able to add a drive into a RAID one and just expand an existing volume is huge most most times when you're setting up a raid you're wiping out the existing one and then copying all the data over with better FS you literally just add it into the sub volume and then just go o balance the drives for me so it'll go ahead and do it all for you really awesome I absolutely love this for Desktop Linux again though ZFS is still my favorite filesystem and that's usually sitting on FreeBSD just because of licensing issues with Linux I really think this is a huge missed opportunity because I do like ZFS better than better FS but I don't like ZFS is implementation and Linux as it's just a little bit cumbersome and how to get it going is kind of hacky and there's the licensing thing that most people always point to you know Linus Torvalds not a big fan of it but you know better FS is a good alternative for desktop users as you know this is an enterprise for desktop a better FS is probably my favorite file system something I'm going to just because that snapshot capabilities that puts it ahead of almost everything else that instantaneous hey I can immediately revert back to this day and time huge snapshots big time as far as using raid and all that other stuff and take it or leave it I'm not a huge fan of it I just kind of showed a basic mirror here as that's what probably the extent of the raid I'd use in better FS overall I was like yeah it could turn into something decent but messing around with raid in its current state and better FS it's not really recommended but if you're doing basic mirrors or even rate in I think it would be a little more safer than just a straight stripe or raid5 not not recommended whatsoever so with all that said I've drone on too long I just want to say thank you and you sure let me know what you think in the comments as I'm always looking forward to reading the comments and with that I'll see you in the next video you
Info
Channel: Chris Titus Tech
Views: 74,372
Rating: undefined out of 5
Keywords: chris titus tech, btrfs, btrfs (software), btrfs file system, btrfs filesystem, btrfs vs zfs, btrfs tutorial, btrfs ext 4, btrfs plex, btrfs linux, raid, btrfs subvolume, btrfs extend, btrfs reduce, btrfs timestamps, btrfs subvolumes, btrfs nas, qnap btrfs, suse btrfs, btrfs benefits, btrfs commands, btrfs architecture, btree fs, btrfsck, redhat btrfs, ext 4 vs btrfs, ext4 to btrfs, sles 12 btrfs, red hat btrfs, btrfs performance, redhat btrfs filesystem
Id: J2QP4onqJKI
Channel Id: undefined
Length: 28min 46sec (1726 seconds)
Published: Sat Jan 18 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.