Announcement

Collapse
No announcement yet.

How to install Kubuntu 21.10 with BTRFS on root?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #46
    Well, I had a partial success. I went through the steps below and they all seemed to work. But when I booted, I was at the grub command line with nothing to edit. I booted the Kubuntu ISO and went to "Try Kubuntu" and opened a terminal. When I looked at /dev/sdc1 which was my EFI partition, there no boot directory or what should have been in the boot directory after it was mounted on the / file system. I also mounted /dev/sdc3 which was my partition containing the rootfs. There was no @ or @home. There was @old and @homeold, and snapshots. I was also expecting to find @ and @home.
    So I took a chance and did
    Code:
    btrfs su sn /mnt/snapshots/@_basic_install /mnt/@
    btrfs su sn /mnt/snapshots/@home_basic_install /mnt/@home
    Then I did
    Code:
     grub-install /dev/sdc1
    and rebooted. I was back to where I was expecting to be. Prior to installing the extra packages.

    Here's the sequence of commands I did.

    Code:
    mount /dev/sdc3 /mnt
    mkdir /mnt/snapshots
    mount /dev/sda1 /backup
    btrfs su snapshot -r /mnt/@ /mnt/snapshots/@_basic_install
    btrfs su snapshot -r /mnt/@home /mnt/snapshots/@home_basic_install
    btrfs send /mnt/snapshots/@_basic_install | btrfs receive /backup
    btrfs send /mnt/snapshots/@home_basic_install | btrfs receive /backup
    Install some extra stuff

    To simulate new drive but same UUIDs, delete old snapshots.

    Code:
    btrfs su de /mnt/snapshots/@_basic_install
    btrfs su de /mnt/snapshots/@home_basic_install
    Restore images from external backup to /mnt/snapshots directory

    Code:
    btrfs send /backup/@_basic_install | btrfs receive /mnt/snapshots/
    btrfs send /backup/@home_basic_install | btrfs receive /mnt/snapshots/
    make it read-write and put it at /mnt@ and /mnt/@home
    Code:
    btrfs su sn /mnt/snapshots/@_basic_install /mnt/@
    btrfs su sn /mnt/snapshots/@home_basic_install /mnt/@home
    ​​​​​​​
    Not sure why grub was not there. Must have something to do with the EFI partition being mounted on /boot which is part of the @ subvolume.

    Maybe all of this restore stuff should be done from the Kubuntu install ISO terminal?

    Comment


      #47
      Originally posted by jfabernathy View Post
      ...

      Maybe all of this restore stuff should be done from the Kubuntu install ISO terminal?
      My second test I did the same procedure as before, but didn't do any restore while running normally. I boot the Kubuntu Live ISO and opened a terminal.
      I mounted both the rootfs partition on /mnt and the external backup drive on /backup

      I then reversed the send/receive from the /backup to /mnt/snapshots directory.
      Next I moved /mnt/@ to /mnt/@old, and /mnt/@home to /mnt/@homeold.
      Finally did the
      Code:
      btrfs su sn /mnt/snapshots/@_basic_install /mnt/@
      btrfs su sn /mnt/snapshots/@home_basic_install /mnt/@home
      Umounted everything and rebooted.

      This worked without any other changes. The file system was read-write as expected.

      Next test is using one of the suggested methods to handle UUIDs or labels with a new HD

      Comment


        #48
        IIUC the ESP partition for UEFI is not and cannot be btrfs. For a restore to an empty volume that partition should be recreated and copied separately.

        btrfs subvolumes may be mounted inside other subvolumes, but are not part of them. (This just like other, non-btrfs mounts; for example, if one mounts /dev/sdb1 in /mnt/foo where / is on /dev/sda1, one doesn't expect /dev/sdb1 to be "in" /dev/sda1.) So the contents of /boot/efi are not part of @. A send/receive of @ does not include any other subvolumes.

        IMO it's confusing that for most commands we have no other way to identify and address them than by the path. Well, it confused me, anyway.

        I would worry about using /mnt to mount the btrfs root-fs. In principle it wouldn't stop the normal use of /mnt, but those ancient Unix directories are encumbered with historical misuse. I started using /mnt/top, but laziness made me change to /top, then to /t. (I might switch to /f or /j to save ~15 mm of finger movement .)
        Regards, John Little

        Comment


          #49
          Well I have something that works but I'm going to refine it in the next few days. Using some of the tricks previously suggested. This worked.

          I took a snapshot of a working system then send/receive that snapshot to an external drive.

          I reinstalled Kubuntu and after first boot I saved the working fstab to my backup drive and printed it out.

          I then mounted the rootfs on /mnt and created the directory, /mnt/snapshots.

          Mounted the external drive to /backup and reversed the send/receive of the external snapshot back to /mnt/snapshots.

          I renamed /mnt/@ and /mnt/@home to /mnt/@old and /mnt/@homeold

          Then I did
          Code:
          btrfs su sn /mnt/snapshots/@yymmdd /mnt/@
          btrfs su sn /mnt/snapshots/@homeyymmdd /mnt/@home
          Before rebooting I edited /mnt/@etc/fstab and put in the new UUIDs replacing the ones saved from the original install.

          Then I rebooted and edited the grub entries during boot and replaced the old UUIDs with the new one and booted.

          As soon as I logged in, I did
          Code:
          sudo upgrade-grub.
          I'm working on a cleaner way, but so far this at least works for replacing a failed drive.




          Comment


            #50
            I've done enough experimenting that I've decided on just doing my own snapshots manually and sending them to an external drive. I played with snapper a lot over the last several days instead of going out and playing in the snow. In one test case, after I rolled back a snapshot it for some reason didn't have the old /etc/fstab. Everything else was rolled back but that. There's no explaining it but doing it manually works just like the Beginner's Guide shows.

            So moving forward, My new media server will have BTRFS boot SSD and a couple of 4TB HD's in BTRFS RAID 1 mirror. I'll do manually snapshots regularly and send/receive them to a snapshot backup folder on the Mirror where the media is.

            Then I'll have a Clonezilla image of the boot drive done before any major changes.

            I think they call that belt and suspenders.

            Comment


              #51
              Sounds like a plan!

              Have you researched using incremental send for the backups? It saves a lot of time.

              https://btrfs.wiki.kernel.org/index....emental_Backup

              Please Read Me

              Comment


                #52
                Originally posted by oshunluvr View Post
                Sounds like a plan!

                Have you researched using incremental send for the backups? It saves a lot of time.

                https://btrfs.wiki.kernel.org/index....emental_Backup
                For my media server, I probably will not because once the software is setup it will not change for a year at least. Just the data, but that is on a mirror. Plus I forgot to mention that all the boot drive and media drive files are stored in the Cloud and synced every night.

                Now for my daily driver where I'm always experimenting the incremental snapshots makes sense and I'll be exploring that next.

                Comment

                Working...
                X