How to install Debian with BTRFS subvolumes and restore with TimeShift

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in today's video i want to go over the steps to install debian using a manual partitioning method in a uefi environment and utilize the butter fs file system or butter fs better fs bt rfs b3fs however you want to call it doesn't bother me but the debian installer while it allows you to format partitions to btrfs it doesn't create sub volumes which is necessary for snapshots but there is a way to install debian with btrfs sub volumes and that's what i wanted to show today there's also some tools that you can utilize when using butter fs on debian like snapper and time shift and today i'm going to be using time shift and i'm probably going to make snapper its own video eventually once i get to play around with it some more and get a better understanding because i mean i can copy and paste commands as good as the next guy but if i can't explain it simply then i don't have a good enough understanding of it and i feel like i would be doing you guys a disservice by just copying and pasting commands when i can't give a good explanation of why i'm doing the things that i'm doing so with that said let's install debian on butterfest sub volumes create a snapshot manually then install time shift and make it easy let's get started so here we are in vert manager i just kind of wanted to show how to set up a uefi environment in vert manager because i mean everybody uses virtualbox nowadays and well it's not available in the debian repos so here we go we're gonna hit the plus button and we're gonna install from local media hit forward and you can browse to your iso or whatever but here i have deviant 10.6 already there it forward i'm gonna give myself four gigs of ram and four cores i'm gonna hit forward and i'm going to create a 64 gig volume because i'm planning on using this vm for a little bit but anyway so let's get started i'm going to hit plus on my volumes and i'm going to name this debian 10 dash butterfs and i'm going to increase my size to not quite that much well hit finish butterfest tutorial all right it made that we're going to choose that volume i'm going to hit forward there and i'm going to name it debian 10 butterfest tutorial we're going to customize the configuration before the install remember to click this button we'll hit finish and now you can change your firmware from bios to uefi and you can pass through usbs if you want to there's a lot of things you can do here and honestly it it could probably take its own series of videos but if you wanted to but if you wanted to get a uefi environment change your firmware to uefi i'm going to leave the chipset the same this time i'm going to hit apply and begin installation and here i'm just going to send this to the other desktop and we're going to go to down to advanced options but first let's scale this so we can actually see what's going on all right so we're we're going down to advanced options and we're not going to do the graphical expert install we're going to do the in curses based because if you do the graphical and expert install invert manager i haven't tried it on hardware yet but if you do it in vert manager it x fails once you call up a shell make your edits and then go back try to go back to the to the graphical install so let's just go with the go within curses and we're going to let that run and this is going to be just the standard debian expert install all i'm going to do i'm just going to kind of blow through this pretty quickly and then we're going to stop and really go in depth once we pull up shell what we're going to do now is just use language united states is all good for me american english is good detective mount cd-rom that's good i'm going to hit ok load installer components that's all good and see i didn't choose anything from that list because everything they needed to install diving is there by default anyway so we're going to detect network hardware we're going to configure the network auto configure is fine hit continue and network auto config has succeeded uh hostname debian is fun no domain name because this is going to be a desktop let's say setup users and passwords we're going to enable shadow passwords yes i'm not going to allow login as root because well this is going to be one user system and it's me so full name for the new user is mike username for the account is mike and we're going to set up a talk we're going to set up a password that is not doctor who themed just like all of my other passwords on these virtual machines are not doctor who themed they're not now we're going to configure the clock yes and i'm in the central time zone so i'm going to arrow down to that uh detect the disks this should pop back up to our main menu and partition disks now here's where it gets a little bit different what we're going to do we're going to arrow down to manual we're going to arrow down to virtual disk or virtio block device we're going to create an empty partition table on the device gpt is already highlighted and that's what we want we're gonna go down here to free space and see it actually says that we have 68.7 gigs my free space one i only gave it 64 but i think that's gibby bytes and not gigabytes so we're going to create a new partition i'm going to make just the boot partition say 600 megs the same as i did on my arch install from a long time ago now so we're going to hit continue and put it at the beginning we're going to use this as an efi system partition boot flag is already on so now we are done setting up that partition we're going to arrow down back to our free space we're going to create a new partition i'm going to make this my swap file my swap partition create a new partition we're going gonna make this i don't know i gave it four gigs ram they generally say one and a half times so six gigabytes at the beginning use as swap area done setting up the partition and now we're just going to make one big partition for our route and home and all that because we're because home is going to be on its own sub volume as well so let's create a new partition for the rest of it which is 61.62.1 continue use as we're not going to do ext4 we're going to hit enter here and we're going to arrow up to btrfs journaling file system mount point is root that's all good we're done setting up the partition arrow down to finish partitioning and write changes to disks yes now we're not going to install the base system yet we're actually about to go up here we're going to send it a key to ctrl alt f2 this is going to give us a shell so now we hit enter to activate the shell which is actually busy box so what we're going to do is we're going to run the df command so df and we hit enter we see that vda3 is set up for target and vva1 is target boot efi first we need to unmount both of those so we're going to run u-mount slash target slash boot slash efi now now we can unmount the target so u mount slash target now i want to mount vda3 to slash m t i probably didn't have to unlock it from target but i like to do that because i'm going to mount my sub volumes back to target so let's mount slash dev slash vda3 to slash mnt now that that's mounted we can we can cd into mnt and now we can create our sub volumes so the way that the way i'm going to do that we're going to do btrfs sub volume create and i know that there's abbreviations for all of these things but i'm going to type everything out so it's easier to understand what i'm doing so we're going to call this at and that's going to be our that's going to be our route btr fs sub volume create at home and let's do dot let's do snapshots and we can view these by saying btrfs sub volume list dot you see we have id 257 258 and 259 for for our route home and snapshots respectively what i can do now is say mount dash o for options we're going to do rw for read and write we're going to do no a time compress equals lzo comma space underscore cache we're going to do subvall id equals 257 so you can do in you could leave it like this or you can go ahead and add subvault equals at so i'm just going to leave both in there for now and i'm i'll i'm going to remove one of them later and i'll i'll tell you why we're going to mount with these options slash dev vda3 to slash target so now we actually need to make directories in our slash target to mount home and snapshots too so we're going to do nk dr p slash target slash home we're also gonna we're gonna hit the up arrow to get the same command back and we're gonna change home to snapshots actually we're going to change that to dot snapshots so it is a hidden directory now we can hit the up arrow three times to get this back and i'm going to change 257 to 258 change subvall to at to at home and then add slash target slash home on that command and now that has everything to do with our home sub volume i'll hit enter here and it took it took that rather nicely so now i'm going to do the same thing i'm going to change 258 to 259 we're going to change at home to at snapshots and then we're going to change slash target slash home to slash target slash dot snapshots because we created the hidden directory it needs to be called here as well all right so now let's run the ls command to see what else we have in our mnt directory here you see we have an etsy directory and a media directory we need to move that to target as well so what i'm going to do is mv etsy slash so everything that's in etsy you know it's gonna everything's gonna be moved to slash target now we're also gonna envy media to slash target and if we also have a boot directory here but that boot directory is empty so if i cdn to boot and then do ls-a you see we have an efi so if we cd into efi you see it is completely empty so cd so now we can actually just rm-r boot if we're an ls command again you see we have at home at at home and at snapshots but all of those are now mounted to our slash target now let's mount our boot directory to our target as well so let's mkdir dash p slash target slash boot slash efi now let's mount slash dev slash vda1 to slash target slash boot slash efi all right now we are pretty much ready to go the only thing i want to do now is you mount slash mnt now if we cd into slash target you see we have boot etsy home and media same as what the same as everything we just moved over so if we see into etsy you see we have an fs tab that's already been generated that fs tab is calling old information now so we need to edit this fs tab to be what what it needs to be now so now let's vim i'm sorry not vm vm is not in busy box we have to we have to use nano so nano fs tab so this u this uuid is going to stay the same and this is for our route we're going to change defaults to rw comma no a time comma uh compress equals lzo comma space underscore cache comma sub vol id equals 2 5 7 comma sub ball equals at that's just for our root directory we actually need to do the same thing for all of our sub volumes too so what i'm going to do i'm going to hit control k and that actually cut the line but i'm going to paste it right back so control u control u control you now we have three lines that now we can add slash home and pretty much just edit our subvall id to 258 and our subvall to at home and now we'll do the same thing for for slash instead of slash home now it slash dot snapshots let me come over here and change this sub ball id from 257 to 259 and subvol equals snapshots we should be ready to go now so we're going to control x to get out yes to write it out and enter now we're going to cd out i'm sorry clear is not in not in there so to get out of our shell let's hit ctrl d to deactivate the shell and we're going to go back up here and send it a key to ctrl alt f1 and that's going to get us back to our incursions installer now we can install the base system so we're going to hit enter here and we're going to continue on installing debian as normal so pretty much what we've done we've pretty much just set up an expert install formatted everything to butter fs but before installing the base system we unmounted everything created sub volumes and then mounted the sub volumes to the target instead of the device itself to the target and just made sure we had everything set up and we had our fs tab set up to where it's going to work right then we get out of the shell go back to the installer and let it go so i'm just going to blow through the rest of this i'm going to install xfce and i will see you back at the desktop when we're done oh and one more cool thing about this expert installer you can actually go ahead and have the non-free software included in your your appsources.list right as it's installed so i'm going to go ahead and do that because well why not and you can enable source repositories in app as well and once this pops up you can even enable back ported software as well so i'm going to select that and we're going to continue and here we are at our login screen so we you see that the installation did success did successfully complete so we're going to log in as mike and we're going to use the default config the default config now let me mess with this a little bit and i will get the resolution better and yeah it's just going to be better all right i think that looks a lot better so now let's let me edit my preferences and increase my font size so it's a little easier to see anyway so let's go ahead and make a go ahead and make a snapshot of our system right after our install so if we're going to do this manually of course we're going to need to invoke sudo actually tell you what let's go ahead and look at our etsy app sources list for first so let's do sudo nano slash etsy out sources.list you see we do have pseudo privileges out of the gate but one thing that i've noticed that the debian installer expert installer does it does not comment out this line right here this one is for the cd-rom and if you don't comment out this line it's not going to run updates properly it's not going to want to install any kind of software out of the gate so you're going to want to edit this file here at your etsy appsources.list and comment out this and comment out this line you know our book our regular repos our main non-free income trib enabled on everything and we also have our back ports so we're going to control x to write it out or yes to write it and enter so if we clear the screen do sudo apt update everything does work properly so we're going to do sudo apt install i don't know get them and let's do time shift so while that's running let's open up another terminal and place it right on top and let's go ahead and create a butterfest snapshot if we do this manually we're going to do sudo btrfs sub volume snapshot we're going to do it of our root directory and put it in in the root directory dot snapshots slash i like to put the date so let's do 10 13 20 20. we're going to call it root or dash root snapshot give it our password and it was created so now if we do let's say sudo butter fs sub volume list of root you'll see that we have 257 is our regular root 258 is home 259 is snapshots and now we have 264 which is a snapshot of our root directory and we can boot from this snapshot if we want to if we edit the sources.list are not sources list the fstab file i don't know why i've got sources.list on the brain so if we do sudo them slash exec etsy fs tab we can change let's go ahead and make that full screen so if we change this one this top line right here and we change that sub volume id to 264 instead of 257 and we could get rid of that if we wanted to and we would boot from 264 which would be our snapshot but we haven't changed anything so why do that yet but if you want to use time shift there is a certain there's a certain thing that you need to do because let's say let's say i wanted to run time shift right now so let's you know what i'm just going to go ahead and add the whisker menu because well i like it a lot get rid of applications menu okay i like i like the wisdom menu because i can just type in timeshift it asks for a password and you can set up a snapshot type whether it's going to be rsync if you have an ext4 or xfs or whatever kind of anything that's not butter fs so if i select that and i hit next i can select vda3 here and hit next and let's say i want to do a boot an hourly weekly monthly let's say i just want to select all of them we'll hit next and you can include your home sub volume in your backups so if you click that it's going to include of course your home sub volume but let's say you just want to back up your route you hit next and hit finish all seems well and good right now but if you hit create it actually worked all right so that one actually worked but one thing that i have learned if you restore a snapshot with the fs tab in the state that we have it in now most of the time it's going to fail so what i want to do is let's say let's vim slash etsy fs tab because if we're going to use time shift i want to get rid of subvall id and i want to do it on all of them if you're doing it manually i highly recommend doing the subvall id but if you're doing it with time shift get rid of all id and just go with your subfile i've had the best luck with that but yeah i but i've had the best luck with just using subvall equals at at home and at snapshots when i'm using time shift if i'm doing it manually go ahead and include your subvall id equals and get rid of the subvall equals at or at home or at snapshots the subvall id is fantastic for manual it's not so not so great if you're using it with timeshift so what i want to do is i i was not sudo so let's do sudo them etsy fs tab so what i want to do now i want to delete this get out of there we're going to create another one all right and we and our snapshot was successful it was not successful the first time i ran this off camera but now that it's on camera it worked it's usually the other way around usually i can get it to work perfectly off camera but as soon as i go to record that's when it messes up so this time it was right it was right the opposite but now you see that we have a debian 10 snapshot here so now let's go ahead and edit some stuff let's let's theme it a little bit and then we'll create a snapshot after we theme it and then restore from our own then restart our old one so i'm just going to open up another terminal and let's say sudo apt install let's say materia gtk theme and the deepen icons then we're going to do get clone https column slash github.com slash nextdoubler slash terminal features and now let's do get clone https column slash slash github.com slash linux doubler slash person personal dot files into dot files all right so that fit so that part finished so let's go ahead and change our appearance to materia dark compact let's change our icons to deep and dark and let's go back to all settings change our window manager to materia dark compact hit close there and see we've already we've already improved the look in my opinion greatly so now that that's done let's cd into terminal fetchers and now let's say chmod plus x dev dash fetch and i want to have that run every time i start a terminal so let's go ahead and say sudo mv dev dash fetch to slash user local bin and let's echo deb dash fetch into home slash dot dash rc and now let's see into our dot files and let's move our wallpapers let's say cd wallpapers so we have a bunch of them in there so let's actually move everything dot png into user share backgrounds but we're gonna need to be sudo for that so let's exit out of that now if we open up this and let's go to desktop change desktop base to backgrounds it took a minute to populate because i had a bunch of them in there so let's say we wanted this one as our background i'm going to close that and now that we've customized it a little bit let's create another snapshot so let's create that and snapshot was created successfully so now what i want to do i want to click this one and restore we're going to do next restore was completed but it's not going to show until after we reboot so let's go down here log out restart if everything's working properly this should have undone all of our customizations and it has so let's say and say deb fetch is not is a command that's not found so so let's open up time shift again give it our password all right so let's say we okay so let's choose this one and we're going to restore that one restore completed now that's done let's go back and log out restart and you see all of our customizations are back i just have to fix the resolution or better yet i could just do this the gui way we go to display we'll change this to 1920 1920 by 1080 and hit apply let's close that close that and you see that we're we're back to our regular system as we customized it earlier so that's about all i've got for today i just kind of wanted to show how to install debian with butter fs sub volumes for the root home and make a dot snapshots directory so if you wanted to do things manually you could or if you and also want to show how to set up time shift with butter fs sub volumes and honestly it's pretty solid i've i'm probably i may set this up on my on my production machine because this is fantastic i'm kind of interested to see how how it's all going to work with uh with my tiling window managers and everything so i may set that up later may do a video on it i don't know so anyway thank you for watching y'all have a nice day like share and subscribe
Info
Channel: linux dabbler
Views: 11,141
Rating: undefined out of 5
Keywords: Debian, Linux, BTRFS, btrfs, btrfs tutorial, btrfs subvolume, how to install debian on btrfs subvolume, timeshift, timeshift tutorial, BTRFS subvolume, Debian BTRFS, Debian btrfs, debian btrfs, How to install Debian manual partition, manual efi partition, debian manual efi partition, debian btrfs snapshot, timeshift snapshot, timeshift btrfs snapshot, debian btrfs root snapshot, Debian BTRFS snapshot, linux snapshot, easy btrfs tutorial, butterfs, betterfs, b-treefs, btreefs
Id: uxHbV6pOytk
Channel Id: undefined
Length: 35min 2sec (2102 seconds)
Published: Wed Oct 14 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.