Announcement

Collapse
No announcement yet.

Reinstall on btrfs with just home folder

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

    [SOLVED] Reinstall on btrfs with just home folder

    If I decide to re-install Kubuntu 18.04 with btrfs in order to clear out junk files in my settings (left over from upgrade to 16.04 and Neon repositories on 16.04 and maybe other problems) can I do this with just the @home subvolume on my external hd? Will it affect the running of the computer in any way? In other words, if I re-install and then send my @home subvolume on the hardisk to replace the new @home on the re-install without replacing the new @ subvolume, will the computer run properly? Or is there a better way to do this?

    #2
    To answer that question you have to ask yourself "Is there any links between my home folder and any file in @?"
    For example, is the Google Earth icon in your menu linked to /opt/google/earth/pro/google-earth-pro?
    Is the Steam icon linked to /usr/games/steam
    Anything linked to /usr/bin ?

    Answer yes to all of those and more. So, is everything in your old @home kde menu linked to anything in your new @ ?

    Do this in a konsole after running "sudo -i" and mounting /mnt (or whatever) and /backup (or whatever)
    mv /mnt/@home /mnt/@home_new
    btrfs send /backup/@home_old | btrfs receive /mnt
    mv /mnt/@home_old /mnt/@home

    unmount, exit and reboot.

    After you get your desktop back you can check your KDE menu to see if all your options run. If not, install what is missing.

    It is because of this reason that I always take snapshots in pairs, @ and @home, using the same date suffix to mark them.

    I use a LOT of appimages. They have no connection to @ and reside entirely withing my home account. I am toying with the idea of creating /mnt/@data and mounting it as /home/jerry/data in /etc/fstab, and backing it and my documents separately.
    "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


      #3
      I'm not sure I understand your response. What I want to know is if I can just replace the new @home folder after re-installation with my backup and not @ without crashing my system. I don't mind re-installing Universe Sandbox or Ksudoku or any other programs that I've downloaded from the repositories as there aren't that many. I also try to use Appimages and also do my snapshots in pairs. What I don't know is how to check the links between the home folder and @.

      Comment


        #4
        Originally posted by oldgeek View Post
        I'm not sure I understand your response. What I want to know is if I can just replace the new @home folder after re-installation with my backup and not @ without crashing my system. I don't mind re-installing Universe Sandbox or Ksudoku or any other programs that I've downloaded from the repositories as there aren't that many. I also try to use Appimages and also do my snapshots in pairs. What I don't know is how to check the links between the home folder and @.
        Yes, you can. But don't be surprised if some apps under / are no longer accessible in the KDE Menu because it no longer contains links to them. And, visa versa.
        "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


          #5
          OK, thanks.

          Comment


            #6
            Originally posted by GreyGeek View Post
            Do this in a konsole after running "sudo -i" and mounting /mnt (or whatever) and /backup (or whatever)
            mv /mnt/@home /mnt/@home_new
            btrfs send /backup/@home_old | btrfs receive /mnt
            mv /mnt/@home_old /mnt/@home

            unmount, exit and reboot.
            Just so I get this straight, if I wanted to restore my system from a snapshot which is still sitting in my /mnt/snapshots folder I will have to use btrfs send instead of OS level mv, correct?
            In my case:
            Code:
            btrfs send /mnt/snapshots/@_20180920 | btrfs receive /mnt/@
            btrfs send /mnt/snapshots/@_home_20180920 | btrfs receive /mnt/@_home
            Reboot
            I was not paying attention today when mounting a new drive which led to my /home filled up to 100%, And now I am dealing with some strange effects, probably due to inconsistent config files. First time I need my btrfs rollback

            Edit: After reading this again, no I am wrong. You need the btrfs send because the snapshot sat on a different drive. In my case it‘s a simple mv, but I did try this earlier and ran into a read-only error. Do I first have to make the snapshot editable? And if so how?

            Edit2: Did some further research today and found this https://unix.stackexchange.com/questions/149932/how-to-make-a-btrfs-snapshot-writable
            Unfortunately this didn't work either?
            Code:
            /mnt$ sudo btrfs property set -ts snapshots/@home_2018-09-20 ro false
            /mnt$ sudo mv snapshots/@home_2018-09-20 /mnt/@home 
            mv: cannot remove 'snapshots/@home_2018-09-20': Operation not permitted
            
            /mnt$ sudo btrfs property set -ts snapshots/@home_2018-09-20 ro false
            /mnt$ sudo btrfs property list snapshots/@home_2018-09-20
            ro                  Set/get read-only flag of subvolume.
            compression         Set/get compression for a file or directory
            Somehow I don't seem to be able to change to rw which means I am stuck?

            Edit3: Feels like I am talking to myself :-) But wanted to share the good news that I finally figured it out!
            Looks like I wasn't fully awake this morning as I tried to mv my backup to ~/@home rather than /mnt. Which it partly did but because of the ro error mentioned above I didn't notice that I did the wrong thing initially . After I moved what ended up in ~/@home to /mnt/@home and a reboot I was back to where I wanted to be. BTRFS delivered and I am a happy chap again :-)
            Last edited by Thomas00; Sep 21, 2018, 01:34 AM.

            Comment


              #7
              Originally posted by Thomas00 View Post
              .....
              But wanted to share the good news that I finally figured it out!
              Looks like I wasn't fully awake this morning as I tried to mv my backup to ~/@home rather than /mnt. Which it partly did but because of the ro error mentioned above I didn't notice that I did the wrong thing initially . After I moved what ended up in ~/@home to /mnt/@home and a reboot I was back to where I wanted to be. BTRFS delivered and I am a happy chap again :-)
              Good job!

              Hints: mv allows one to move subvolumes around within the <root_filesystem> they are in, but not outside of it. Send & Receive allow moving subvolumes between different <root_filesystems>, but it seems you figured that out already!

              My memory being what it is, I keep a printout that contains all the commands I use for btrfs on the msg board next to my computer chair. I consult it every time because I no longer trust my memory.
              "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


                #8
                I did indeed :-)
                The confusing bit was that the mv to ~/@home was able to move all sub directories but not the top level folder, and all I got was the ro error and an empty (minor shock) @home in the original location. But after I had my what-the-hell-is-@home-doing-in-my-home-folder moment I quickly figured out what went wrong :-)

                Comment

                Working...
                X