How to install Debian with BTRFS subvolumes and restore with TimeShift

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ต.ค. 2024

ความคิดเห็น • 108

  • @fallen1994
    @fallen1994 3 ปีที่แล้ว +13

    Awesome guide! I would just add that the latest debian bullseye actually creates @rootfs when creating a btrfs partition. Instead of creating @ subvol like at 10:14, simply cd into /mnt and "mv @rootfs @". It will already contain etc media and boot. This way timeshift will be able to detect the root subvolume because it only works with @ for root.

  • @birawaich
    @birawaich 3 ปีที่แล้ว +2

    Thanks, this really helped me :D
    For the ones that want to follow it without watching the video twice, I wrote a transcript of the installation part:
    ```
    Transcript install Debian w/ Btrfs subvolumes of linux dabbler video
    --------------------------------------------------------------------
    (start install)
    do Expert install:
    #standard install until partion disk menu
    select menual
    select disk
    create empty partition table (gpt for UEFI)
    create new partition (600 MB as EFI System partition)
    create new partition (1.5x RAM as SWAP)
    create new partition (rest, btrfs)
    finish partiioning and write changes to disk
    change to CLI: #CTRL+ALT+F2:
    #list device usage
    df
    #unmount all partitions which are mounted to created partitions
    unmount /target/bot/efi
    unmount /target
    #mount btrfs partition (vd3 here) to temporary mount point
    mount /dev/vda3 /mnt
    cd /mnt
    #declare subvolumes
    btrfs subvolume create @ #@ is a convention
    btrfs subvolume create @home
    btrfs subvolume create @snapshots
    #get real subvolid via
    btrfs subvolume list .
    #mount subvolumes at target
    mount -o rw,noatime,compress=lzo,space_cache,subvolid=257,subvol=@ /dev/vda3 /target #debian wiki does not recommend lzo; all subvolumes have to have the same mounting (see Debian wiki>problems; noatime can also have some influence on some applications, but the disadvantages are negliable)
    #make missing directions in target
    mkdir -p /target/home
    mkdir -p /target/.snapshots #. means hidden, -p means parents
    #mount rest
    mount -o rw,noatime,compress=lzo,space_cache,subvolid=258,subvol=@home /dev/vda3 /target/home
    mount -o rw,noatime,compress=lzo,space_cache,subvolid=259,subvol=@snapshots /dev/vda3 /target/.snapshots
    #clean up mnt
    mv etc/ /target
    mv media/ /target
    rm -r boot/ #is empty
    #mount boot directory to target
    mkdir -p /target/boot/efi
    mount /dev/vda1 /target/boot/efi
    #unmount mnt
    cd
    umount /mnt
    #get to fstab and edit
    cd /target/etc/
    nano fstab:
    #add all subvolumes, same UUID, add arguments, adopt mount points
    cd #cd out
    get out of shell: CTRL+D
    get back to install: CTRL+ALT+F1
    ```

  • @mrrogers4591
    @mrrogers4591 3 ปีที่แล้ว +1

    Excellent video. Before finding your video, I spent many hours trying to get the same setup and failed. Now I have Debian BTRFS system with subvolumes. Thanks.

  • @dennishallman3713
    @dennishallman3713 4 ปีที่แล้ว +2

    Heya Mike, Now I understand yours & Miyos' passion for the Debian installer. Wow, I thoroughly enjoyed watching. The look on your face when timeshift worked, priceless. You're right, it's usually the other way around. One day when I master Arch (yeah right) I will take the plunge into the expert mode. :~) Thanks Mike for sharing your passion. May the winds of fortune always be at your back.

  • @WR47HOFO5IRI2
    @WR47HOFO5IRI2 2 ปีที่แล้ว

    I was about to lose my life and destroy my laptop to pieces until i saw this video
    i had 2 entries for the home and it didn’t let me restore (I have no idea why), and because of this video i noticed the issue and fixed it
    i adore and hate arch with all my being, but the learning process is so much fun, especially when it works
    thank you for showing me the way brother.

  • @Mikesco3
    @Mikesco3 3 ปีที่แล้ว +1

    I really appreciate this tutorial, how well organized it was ... I'm actually looking for a tutorial on how to backup BTRFS to an external device or location and then restore from live media.

    • @martindorigny4360
      @martindorigny4360 2 ปีที่แล้ว

      Timeshift rsync devrait être votre solution.

  • @huubdegroot
    @huubdegroot 4 ปีที่แล้ว

    Needed to setup a new Debian Buster system and saw your video. Excellent video and did the same here. Thank you Mike !!

  • @movax20h
    @movax20h 3 ปีที่แล้ว +1

    Hmm. Does it integrate with grub in anyway to easily have option for the restore? Is there a CLI version to run in the background as a deamon or from cron?

  • @cjbaghl
    @cjbaghl 4 ปีที่แล้ว

    Mike, this is great stuff. Just starting to learn about btrfs because I think it will fill the need I have in my homelab. I would like to use btrfs us the underlying fs for my OpenMediaVault server which is Debian Buster based. You steps were clear and concise and I greatly appreciate your approach. Many thanks.

  • @edricusty2682
    @edricusty2682 3 ปีที่แล้ว +1

    Really great tutorial, I wish you'd show how to restore with grub because snapshots are also for catastrophics accidents where you just can't boot into your system lol

  • @henrik2117
    @henrik2117 3 ปีที่แล้ว +4

    Great tutorial! Thank you for sharing!

  • @Bitwise1024
    @Bitwise1024 3 ปีที่แล้ว

    What an awesome piece of work, Mike. Thank you!

  • @Bandicoot803
    @Bandicoot803 2 ปีที่แล้ว

    Wow, that totally the equivalent to Apple's TimeCapsule / -Machine! Thanks a lot for this very useful and deeply informative video. You received the 321st "LIKE" from me.

  • @marconiandcheese7258
    @marconiandcheese7258 2 ปีที่แล้ว +1

    Thanks for your video! It really helped me

  • @intrax2tv
    @intrax2tv 3 ปีที่แล้ว

    Would be great if debian included this in the expert setup ! Nice tutorial, thanks...

  • @_pietro1388
    @_pietro1388 2 หลายเดือนก่อน

    as i'm practicing linux i have a question... is it possible to create these subvolumes after the installation and then move in the corrisponding folders ?!

    • @linuxdabbler
      @linuxdabbler  2 หลายเดือนก่อน

      @_pietro1388. It is possible, but I've never done it that way so I can't speak intelligently on the matter.

  • @ozaki66
    @ozaki66 3 ปีที่แล้ว +2

    Hey there Mike, thanks for your guide! I used it to have a separate VAR partition, since for my servers its the one that typically fills up quickly.
    Its been a little less than a year since this video. Do we still need to go to Busybox, unmount and create the BTRFS subvolumes, or has Debian added more support on the installer?

    • @linuxdabbler
      @linuxdabbler  3 ปีที่แล้ว +1

      @RDJ. I haven't tried it with the bullseye release candidate yet. It is entirely possible that the updated installer creates subvolumes now.
      I will have to try it out to be sure though.

    • @aceattackk
      @aceattackk 3 ปีที่แล้ว +1

      @@linuxdabbler the bullseye installer is creating @rootfs subvol by default which is not ideal for timeshift so we need to create @ and just mv the contents of @rootfs

    • @linuxdabbler
      @linuxdabbler  3 ปีที่แล้ว +1

      @Aceattack. Thank you for the info. I really appreciate it.

  • @dennismitchell8507
    @dennismitchell8507 3 ปีที่แล้ว

    Thank you, right to the point! Perfect video !

  • @marcelomafra
    @marcelomafra 3 ปีที่แล้ว

    Excellent video! Very clear explanation.

  • @nejathakan5521
    @nejathakan5521 3 ปีที่แล้ว +1

    Hi Mike, really great Video.
    Do you plan also the same as an encrypted Version?
    That would be really amazing 😍
    Best regards

  • @luc5543
    @luc5543 3 ปีที่แล้ว

    Any reason you went with UEFI, does it have any bearing on the functionality of BTRFS etc?

    • @linuxdabbler
      @linuxdabbler  3 ปีที่แล้ว +1

      @Luc. Not particularly. I have done this on uefi and bios and it works on both. I mainly did it to show that debian can be installed in a VM as uefi and to show the flags one would need.

  • @michelhoude3022
    @michelhoude3022 3 ปีที่แล้ว

    Hi, it doesn`t work anymore with the new bullseye release. Can you update the process ? Thanks!

  • @auronkardek
    @auronkardek 3 ปีที่แล้ว

    Can I do this with a separated home partition ? When I try to mount /mnt/home at /target/home it says the ressource is busy. I mounted my home partition to /mnt/home and created @home and @snapshots from this folder (@ in /mnt)

    • @komi_maru
      @komi_maru 3 ปีที่แล้ว

      Make @home subvolume at your specified home partition and basically point it out to the UUID of that partition in FSTAB, then you're basically good, almost same steps after.

  • @Andreas-fh9zf
    @Andreas-fh9zf 3 ปีที่แล้ว

    Hy Mike,
    thank you for this tutorial. I make it also on my host system.
    Greeting from Vienna (Austria)
    Andreas

  • @Giovanni2862
    @Giovanni2862 2 ปีที่แล้ว

    What is the DE that you use in this video?

  • @markiroto9395
    @markiroto9395 4 ปีที่แล้ว

    Hi, couldn't you just go to the shell from the install options? I haven't try installing it and is there a difference from using ctrl+alt+f2 and the execute shell option?

    • @linuxdabbler
      @linuxdabbler  4 ปีที่แล้ว

      @Markiroto Baby. You could execute a shell from the install options. But I haven't tried it that way. I have always just dropped to a TTY when there was a need. The guides that I found (had to translate some of them) never mentioned calling up a shell from the install options.
      As for the difference... I don't think there is one. Ctrl+Alt+F2 gets you busybox, and I believe that is also the shell you can execute in the install options.
      When I did that, I had to send it the key from virt-manager because pressing it on my keyboard would have pulled up a TTY on my main machine... Not so good when recording. Lol

  • @demirmahir
    @demirmahir 3 ปีที่แล้ว

    Hey Mike, can you also make a video and install Debian on ZFS (not ZFS on Debian, I watched that video :)). I can follow the guide on openzfs github documentation, but seeing you doing it and explaining everything makes it much more easier for a first time install. Appreciate it!

  • @ronobvious1785
    @ronobvious1785 4 ปีที่แล้ว

    I did this on a laptop and it worked! I do have one question though. When I bring up timeshift it says that it puts all btrfs backups in some folder (I don't recall the name and I'm not on that machine right now) other than /.snapshots. It also says that this folder cannot be changed. Is /.snapshots just for doing manual backups?

    • @linuxdabbler
      @linuxdabbler  4 ปีที่แล้ว +1

      @ Ron Obvious. Yes. It's mainly for manual backups unless you are using snapper choose snapshots in the grub menu.

  • @mhelmreich1
    @mhelmreich1 2 ปีที่แล้ว

    This suited my purpose pretty perfectly.
    Thanks heaps.

    • @linuxdabbler
      @linuxdabbler  2 ปีที่แล้ว +1

      @Michael Helmreich. Im glad you found it useful. Btrfs subvolumes on Debian is a pretty niche thing, but it is fantastic for my purpose as well.

    • @mhelmreich1
      @mhelmreich1 2 ปีที่แล้ว

      @@linuxdabbler I have been using snapshots, but more as a tool to then give me something to copy out to other drives.
      I hadn't really understood the value of the '@' subvolume feature.

    • @linuxdabbler
      @linuxdabbler  2 ปีที่แล้ว +1

      @Micharl Helmreich. @ (no idea why it's named that) is your root subvolume, I like to take a snapshot of root before upgrades(especially if I'm running testing or sid) just for a safety net, in case something breaks, I can boot to a TTY, change the subvolid in /etc/fstab to the most recent root snapshot, reboot into the snapshot and fix my system from there.

  • @cepi24
    @cepi24 4 ปีที่แล้ว

    Thanks for tutorial. Why does terminal shows that deb-fetch was not found after reboot in 32:51? Shouldn't the snapshot revert also the .bashrc? Thanks

    • @linuxdabbler
      @linuxdabbler  4 ปีที่แล้ว

      @cepi24. It was reading the ~/.bashrc which stayed the same, The script was located in /usr/local/bin and it wasn't there anymore after the snapshot was restored. Which is why it faulted.

  • @metafile001
    @metafile001 2 ปีที่แล้ว

    Hello Mike. Another great video. BUT did you see the btrfs and sub-volume implementation that MX-21 has? "Run with the Dolphin" describes the VERY simple setup out of box in a recent video...
    stay safe...

    • @linuxdabbler
      @linuxdabbler  2 ปีที่แล้ว

      Hi @Jim Acklaw. I really like your channel. I haven't tried MX-21. I will have to check out run with the dolphin. Thanks for the tip!

    • @linuxdabbler
      @linuxdabbler  2 ปีที่แล้ว

      @Jim Acklaw. I updated this video for debian bullseye and while the bullseye installed does create a root subvolume now... It doesn't work out of the box with timeshift.

  • @i18nde
    @i18nde 3 ปีที่แล้ว

    Very good tutorial, helped me a lot. Thank you.

  • @RichardThaddeus
    @RichardThaddeus 2 ปีที่แล้ว

    I was watching and thinking do I subscribe?? Then you had me at Doctor who :D

  • @giova62gds34
    @giova62gds34 2 ปีที่แล้ว

    What’s your operating system?

  • @LucS0042
    @LucS0042 3 ปีที่แล้ว

    I'm guessing time shift didn't use .snapshots right?

  • @gguman150
    @gguman150 2 ปีที่แล้ว

    I can't restore rootfs thru setting subvolid of snapshot inside the fstab file. Does described method work or not?

    • @linuxdabbler
      @linuxdabbler  2 ปีที่แล้ว

      @gguman ss. I have this set up on my desktop and laptop and haven't had any trouble booting into a snapshot by changing the subvolid in /etc/fstab.

    • @gguman150
      @gguman150 2 ปีที่แล้ว

      I've spent a day and didn't able to restore. Could you create a short video of this process, plz. I dont know where I'm wrong

    • @gguman150
      @gguman150 2 ปีที่แล้ว

      Did you change grub.cfg for booting into a snapshot?

    • @linuxdabbler
      @linuxdabbler  2 ปีที่แล้ว

      Sorry I just saw your other comment. I didn't change anything with grub.
      The only thing I changed was in /etc/fstab
      I changed subvol=@rootfs to subvolid=256
      This method of booting into a snapshot by the ID should work if your snapshot subvolume is on the same drive as your root subvolume because they have the same UUID.
      Your subvolid will probably be different than mine. Running the command
      sudo btrfs subvolume list /
      Should give you your subvolume IDs

    • @gguman150
      @gguman150 2 ปีที่แล้ว

      Doesnt work for me

  • @kristosy
    @kristosy 3 ปีที่แล้ว

    Hi! Can you please explain why you create a separate subvolume for snapshots? Is it for security reasons? Because you could also just create the /.snapshot dir (inside the @ root-subvolume) without using a separate @snapshots subvolume. Taking snapshots is not recursive so taking snapshots of the @ root-subvolume will not include the snapshots stored inside /.snapshots directory. Thanks! :)

    • @linuxdabbler
      @linuxdabbler  3 ปีที่แล้ว

      @Kristoffer. I created the . snapshots directory because I like to keep it neat. And having a separate subvolume for snapshots is more secure than just using the root subvolume with a snapshots folder.

    • @kristosy
      @kristosy 3 ปีที่แล้ว

      @@linuxdabbler can you explain why it is more secure than having a snapshot dir at the top-level? since the top-level will be unmounted unless taking snapshots anyway? I just want to understand, since I haven't seen this practice before :-)

    • @linuxdabbler
      @linuxdabbler  3 ปีที่แล้ว

      I may be misinterpreting what you are saying here... I also mistyped earlier as well. (It was 3am when I first replied.) I like to have a separate snapshot subvolume to keep the snapshots out of my root subvolume in case something happenes to my root subvolume. I would honestly prefer my snapshots to be on a separate drive in case of drive failure.

    • @kristosy
      @kristosy 3 ปีที่แล้ว

      @@linuxdabbler I believe I understand what you are saying :) here is my top-level btrfs volume: @root, @home, /snapshots. And then I just mount btrfs top-volume to @root/root/btrfs-top-volume when taking snapshots :) If that made sense :) Then I can use btrfs send and receive to make backups of the snapshots. Thank you for clarifying!

  • @patrickprucha5522
    @patrickprucha5522 ปีที่แล้ว

    Execellent! 👍

  • @asldfjkalsdfjasdf
    @asldfjkalsdfjasdf 3 ปีที่แล้ว

    Just did this with a separate boot partition and encryption of the btrfs and swap partitions with the gui expert installer.
    Worked like a charm. Thank you.
    Do you know why a separate boot is still necessary for debian while opensuse will use a 8MB boot partition to unlock the encryption before the boot selection.
    Is there a way to do this on debian as well?

    • @linuxdabbler
      @linuxdabbler  3 ปีที่แล้ว

      @Jipee Juhu. I'm glad it worked well for you.. that is awesome. As for the second part, I'm not sure about getting that to work on Debian. I did a little research on it before making the video but came up empty... If I find a good article on the subject, I will post a link and tag you in the comment.

    • @asldfjkalsdfjasdf
      @asldfjkalsdfjasdf 3 ปีที่แล้ว

      @@linuxdabbler Thank you. much appreciated!

    • @mrrogers4591
      @mrrogers4591 3 ปีที่แล้ว

      @@asldfjkalsdfjasdf @linux dabbler I got encrypted setup to also work; however, boot is on a non-encrypted partition. My understanding is GRUB through version 2.04 cannot decrypt a LUKS version 2 partition. LUKS 2 is the default encryption type for Debian 10. However, GRUB 2.06 can decrypt LUKS 2. Two options, 1) convert LUKS 2 to LUKS 1 or 2) compile from source and install GRUB 2.06. Neither option I have tried with the BTRFS subvolumes setup. I have done option 1 with a standard Debian BTRFS install and it worked for me. Sometime I have to spend a few more hours to try both options. Then I want to try to make this a RAID 1 setup. I've done it with Ubuntu. Finally run some tests with timeshift to work see how it works with FDE RAID1 BTRFS with subvolumes.

    • @asldfjkalsdfjasdf
      @asldfjkalsdfjasdf 3 ปีที่แล้ว

      ​@@mrrogers4591 Thanks a lot! That informations is helpful.

  • @seanpaul7069
    @seanpaul7069 2 ปีที่แล้ว

    nice video Mike.

  •  4 ปีที่แล้ว

    My friend can you do the same with Manjaro?

  • @michelhoude3022
    @michelhoude3022 4 ปีที่แล้ว

    Everything went fine until I installed KDE, now I am stuck with a grub> prompt only. Any ideas ?

    • @linuxdabbler
      @linuxdabbler  4 ปีที่แล้ว

      @Michael Houde. It sounds like there was a grub config error. I can't remember off hand the exact commands you need, but I used this guide in the past and have had some success.
      linoxide.com/linux-how-to/grub-rescue-commands/
      I hope this helps.

    • @michelhoude3022
      @michelhoude3022 3 ปีที่แล้ว

      @@linuxdabbler The weird thing is this is only happening with Buster, under sid it does boot normally

  • @opqriu
    @opqriu 3 ปีที่แล้ว

    Thanks. Thanks. This is the best. That is really cool.

  •  4 ปีที่แล้ว

    very informative, thanks man!

  • @jessecrockett
    @jessecrockett 3 ปีที่แล้ว

    what's that desktop environment?

    • @linuxdabbler
      @linuxdabbler  3 ปีที่แล้ว

      The host machine is running DWM. If you're not familiar... It is a dynamic tiling window manager created by the "suckless" developers/community.
      If you mean the VM... That's just XFCE... My full desktop environment of choice.

  • @Лука-п
    @Лука-п 3 ปีที่แล้ว

    Thanks, Mike, nice video as always, could you do a video of btrfs raid1 with nfs, regarding this topic the information on internet is very sparse.

  • @Aemilindore
    @Aemilindore 3 ปีที่แล้ว

    How can we also add encryption?

    • @linuxdabbler
      @linuxdabbler  3 ปีที่แล้ว

      @Paul. I haven't tried with llvm and encryption. But there is a pretty good guide for it here.
      www.paritybit.ca/blog/debian-with-btrfs

  • @peepingThomist
    @peepingThomist 4 ปีที่แล้ว

    Excellent, thanks

  • @michelhoude3022
    @michelhoude3022 3 ปีที่แล้ว

    With this method, the directories inside home for the user are not created

    • @linuxdabbler
      @linuxdabbler  3 ปีที่แล้ว +1

      @Michel Houde. That is easily corrected with the command xdg-user-dirs-update

  • @movax20h
    @movax20h 3 ปีที่แล้ว

    Nice tutorial. FYI. "rw" is a default. No need to specify it really.

  • @jx9467
    @jx9467 3 ปีที่แล้ว

    I hope they make this feature doable on Debian expert install without opening busybox.

    • @linuxdabbler
      @linuxdabbler  3 ปีที่แล้ว

      @Safiyyah Tekakwitha. I would love to see that as well. I would definitely make a video just covering that.

  • @victornecromancer
    @victornecromancer 3 ปีที่แล้ว

    Tyyy

  • @BrucesWorldofStuff
    @BrucesWorldofStuff 4 ปีที่แล้ว

    While I found this video interesting, I just don't see me doing this... :-) I'm just to lazy and I like my butter on toast...LOL
    Thanks for the video Mike... I just never plan on using BTFS or whatever you call it...
    LLAP

    • @linuxdabbler
      @linuxdabbler  4 ปีที่แล้ว

      @Bruce Scott. I understand, I just wanted to show that it could be done on Debian, because most other tutorials I have found for this uses Arch. But once I got it figured out... Man... This is pretty great. I'm going to try it on Devuan on my next off day.

    • @BrucesWorldofStuff
      @BrucesWorldofStuff 4 ปีที่แล้ว

      @@linuxdabbler HaHaHa. Yep! I understand. it's all about the conquest and seeing if I can do it thing... :-)
      I like your videos very much, there very informative and inspiring. As you know I have used some of you projects myself... Lol
      I still haven't gotten around to DWM . I have several electronic projects i'm working on inbetween all the other projects and I just started another one a week ago for xmas for the kids. I'm making clocks out of old computer parts. I will say it has blossomed into its own nightmare...Lol I was trying to make them somewhat the same but there going to be kinda the same if you get what I'm saying... Lol
      Good Luck on the Devuan project!
      Anyway thanks for you hard work and the videos. Take Care!
      LLAP

    • @linuxdabbler
      @linuxdabbler  4 ปีที่แล้ว

      @Bruce Scott. Thanks as always. The computer part clocks sound incredible...

  • @marcello4258
    @marcello4258 3 ปีที่แล้ว

    too bad timeshift does not allow different configs :/

  • @dreamyuki
    @dreamyuki 4 ปีที่แล้ว

    maybe i wanna tried this

  • @WC1376C22
    @WC1376C22 3 ปีที่แล้ว

    Please try this with antiX

  • @aaronexia3110
    @aaronexia3110 4 ปีที่แล้ว

    get the alwayscenter patch

  • @mustafababdullah2485
    @mustafababdullah2485 3 ปีที่แล้ว

    You forgot var

  • @edricusty2682
    @edricusty2682 3 ปีที่แล้ว

    Timeshift doesn't seen to use /.snapshots... The backup is stored in /mnt/timeshift/backup/timeshift-btrfs/snapshots/ for me