Announcement

Collapse
No announcement yet.

New install using btrfs backups

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    New install using btrfs backups

    After an unsuccessful attempt to upgrade from 24.04 to 24.10, I decided to re-install the LTS, which I succeeded after several problems. Now I want to roll back to my previous setup. I have both @ and @home from my previous setup on an external hard disk, and want to incorporate them into my OS. I tried this before, and something went wrong, so I'm asking for help. What I did before was the following: I 'moved' @ and @ home into @old and @homeold, and then sent (using the send command) the saved @ and @home snapshots on an external hard drive to /mnt on my computers HD. This took awhile, but terminated successfully. However, when I rebooted, my computer got stuck at Grub. Did I do something wrong by replacing the newly installed @ with my previous @? How should I go about replacing @ and @home on the newly installed OS with the previous snapshots of my anterior configuration? Any suggestions from the local btrfs experts on this forum would be appreciated!

    #2
    I think my mistake was in not changing the ro subvolumes to rw. I'm going to try again.

    Comment


      #3
      AAAARRRRGGGGHHHH! Now I have a new problem. After mounting my system hard drive to /mnt, it does not show up at all on Dolphin. The external HD does show up, however. So I can't copy @ and @home to my hard disk from the external one. Can someone help me please?

      Comment


        #4
        More specifics - like how and what you mounted and what you expect to see there would be helpful.

        Also, if you have RO subvols the easiest way to make them RW is to snapshot them. Snapshots are always RW by default. So let's assume you do in fact have @ and @home on your internal drive and they are RO. Just mount the internal drive (sounds like that's what your trying to do) then:
        Code:
        sudo mv @ @-ro
        sudo mv @home @home-ro
        sudo btrfs su sn @-ro @
        sudo btrfs su sn @home-ro @home
        and reboot

        Please Read Me

        Comment


          #5
          Originally posted by oldgeek View Post
          AAAARRRRGGGGHHHHAfter mounting my system hard drive to /mnt, it does not show up at all on Dolphin. The external HD does show up, however. So I can't copy @ and @home
          How was the system drive mounted? By default, only @ and @home are mounted, but not their parent directory. For a long time I was confused by the fact that the OS root, /, is not the filesystem root.

          Now, mounting the external drive on /mnt is IMO not a good idea; any place already mounted somewhere in /mnt gets hidden. I suggest creating a directory in /mnt, with the name of the external drive, and mounting it on that. And, maybe make a directory, called, say, top, mount the btrfs top level on /mnt/top (if you mount the drive without specifying the subvolume, you get the top).

          For this kind of surgery, it can be simpler to work having booted from an iso.
          Regards, John Little

          Comment


            #6
            Thanks to both who answered. What I mean is on the list on the left in Dolphin, my hard drive does not appear at all--just the external HD I have connected. I mount not the whole hard disk but just this: mount /dev/sda1 /mnt, where sda1 is where the btrfs partition is located. This has always worked for me before, so I don't know why I can't even see the hard disk of my system listed in Dolphin. Obviously I can't enter into the mounted sda1 and thus can't do anything with @ or @home.

            Comment


              #7
              Originally posted by oldgeek View Post
              However, when I rebooted, my computer got stuck at Grub. Did I do something wrong by replacing the newly installed @ with my previous @?
              I think what went wrong was that the release upgrade updated grub to point at the new kernels (and also possibly a new EFI set up, though this is usually not the case). Also, if you used send/receive, the new @ and @home will be read only, and you'd have to sort that as oshunluvr points out.

              After copying over @ and @home, grub has to be told about it. There's lots of ways to do that, at least:
              1. You could restore the ESP from a backup that matched the old system. That would be really quick, but I suspect you don't have such. (I've never done this, though I do have a backup of the ESP somewhere).
              2. Boot Repair can do it; I did that once quite a while, many years, ago.
              3. You could chroot into the system in @, and run grub-install from that. I'd have to look up the commands needed for the chroot; I suspect there's posts here on KFN with the commands, and many places on the web.
              4. At the grub rescue prompt, you could type the arcane grub commands needed to boot into the new @. Then, you could run grub-install from there.
              5. You could run grub-install telling it where to go. One can do this booted from an iso ("Try Kubuntu"). Say you have the ESP mounted on /boot/efi, and the system drive mounted on /mnt/top:
              Code:
              sudo grub-install --boot-directory=/mnt/top/@/boot --efi-directory=/boot/efi
              The last time I had to do that, grub-mkconfig was not run properly, I didn't understand why, but your existing config in /mnt/top/@/boot/grub/grub.cfg would be good.

              I'll spare the rant about how grub in its usual set up in *buntus always lets you down, sooner or later, as it has for you. I use a much simpler, manually maintained, independent, grub setup where I am in control, but if you don't have multiple Linux installs learning how to do that may not be worth your time.
              Regards, John Little

              Comment


                #8
                I downloaded the latest Boot-repair, burned it to a USB and booted from it. It got as far as Grub, then gave me two error messages: invalid magic number, you have to load the kernel first. So I guess something is wrong with Grub, and I feel out of my element in being able to fix it. Would it be easier to try to install 24.10 instead?

                Comment


                  #9
                  Not trying to muddy the waters, but a quick search indicates that the boot manager rEFInd works with btrfs.
                  It's a thought.
                  As jlittle indicates, IF you can boot into your OS, you can run grub-install.
                  And rEFInd could offer some insurance in the future.
                  rEFInd can be run from a live USB.
                  An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                  Comment


                    #10
                    My problem, I'm still at the copy/paste level of btrfs commands, and use only what I have used before. I have never dealt with Grub before and am hesitant to muck with it, especially considering my recent attempts to upgrade from 24.04 to 24.10; I still don't understand why I lost my graphic drivers in the process and since then I've been trying to regress to my previous state without much success. That's why I wonder if I should just do a clean install of 24.10 instead.

                    Comment


                      #11
                      Generally, when you install an app that has a /home/<your name>/component, it is divided between your home account and some root files. (Ya, there are some files, like appimages, that are self-contained and have no external or root-based components) For that reason the first thing I did when switching to BTRFS was to merge my @home subvolume into my @ subvolume, so I only have to back up @.

                      I sudo'd to root and created /mnt/snapshots. In that directory I store snapshots of @ as @yyyymmddhhmm. I wrote a bash script, make_snapshots.sh, to create and store them, which adds the latest snapshot and deletes the oldest one, keeping 5 of the latest snapshots. If I make a mistake and delete a file or folder I can use a file manager to open a snapshot and drag & drop the files back into my active subvolume.
                      Code:
                      root@jerry-hplaptop17cn1xxx:~# vdir /mnt
                      total 0
                      root@jerry-hplaptop17cn1xxx:~# mount /dev/sda1 /mnt
                      root@jerry-hplaptop17cn1xxx:~# vdir /mnt
                      total 0
                      drwxr-xr-x 1 root root 340 Oct 23 17:49 @
                      drwxr-xr-x 1 root root 130 Oct 24 20:24 snapshots
                      root@jerry-hplaptop17cn1xxx:~# vdir /mnt/snapshots/
                      total 0
                      drwxr-xr-x 1 root root 340 Oct 17 18:36 @202410171903
                      drwxr-xr-x 1 root root 340 Oct 17 18:36 @202410181823
                      drwxr-xr-x 1 root root 340 Oct 22 16:08 @202410221915
                      drwxr-xr-x 1 root root 340 Oct 23 17:49 @202410232107
                      drwxr-xr-x 1 root root 340 Oct 23 17:49 @202410242024
                      root@jerry-hplaptop17cn1xxx:~#
                      ​
                      @ is my active system. It contains / (root) and /home. If I delete it I'v sawed off the limb I'm setting on. Better have an external copy to restore it just in case. That's the nice thing about BTRFS. You can do surgery on the system you are running on without having to stop it.
                      Last edited by GreyGeek; Oct 25, 2024, 11:31 AM.
                      "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                      – John F. Kennedy, February 26, 1962.

                      Comment


                        #12
                        Thanks for the information. My problem is that my hard disk is not listed on the left in Dolphin, so I can't access my btrfs partition visually, and thus can't see what I'm doing. I've never had this problem before, and I think it may have been caused by not partitioning correctly for EFI when I re-installed 24.01. That means I can't see what I'm doing in order to send @ and @home files from my external hard drive. That is a big problem. I tried installing 24.10, but ran into the same problem on manual partitioning. So that's why I'm stuck and frustrated.

                        Comment

                        Working...
                        X