BTRFS - Subvolumes for / & /home, and being able to snapshot and restore from the snapshots? ...

How did passengers keep warm on sail ships?

Currents/voltages graph for an electrical circuit

ODD NUMBER in Cognitive Linguistics of WILLIAM CROFT and D. ALAN CRUSE

How to support a colleague who finds meetings extremely tiring?

Is it safe to harvest rainwater that fell on solar panels?

How to translate "being like"?

What is this sharp, curved notch on my knife for?

Did any laptop computers have a built-in 5 1/4 inch floppy drive?

Loose spokes after only a few rides

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

"as much details as you can remember"

Is bread bad for ducks?

Can there be female White Walkers?

Deal with toxic manager when you can't quit

What do these terms in Caesar's Gallic wars mean?

Why can't devices on different VLANs, but on the same subnet, communicate?

If I can cast sorceries at instant speed, can I use sorcery-speed activated abilities at instant speed?

Correct punctuation for showing a character's confusion

writing variables above the numbers in tikz picture

Is an up-to-date browser secure on an out-of-date OS?

If a sorcerer casts the Banishment spell on a PC while in Avernus, does the PC return to their home plane?

Did Scotland spend $250,000 for the slogan "Welcome to Scotland"?

Cooking pasta in a water boiler

How come people say “Would of”?



BTRFS - Subvolumes for / & /home, and being able to snapshot and restore from the snapshots?



The 2019 Stack Overflow Developer Survey Results Are InCan btrfs handle different RAID levels for different subvolumes?btrfs confused about subvolumesPractical limit on the number of btrfs snapshots?Restore Btrfs snapshot from subdirectory to parentConceptualizing btrfs - understanding snapshots, and space usedCan I determine the exclusive space usage of groups of btrfs subvolumes?Can the original source subvolume of a btrfs snapshot be found by examining that snapshot?btrfs sync and deferred operations - is the special ioctl required?Restore single files from a btrfs snapshot without doing a full copybtrfs subvolumes not auto mounted after set-default





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















OS: Arch Linux x86_64



I have one BTRFS filesystem, both containing / & /home, how do I create subvolumes for both / & /home, and create a snapshot for each and restore from their snapshots (restore snapshots from a live CD)?










share|improve this question





























    1















    OS: Arch Linux x86_64



    I have one BTRFS filesystem, both containing / & /home, how do I create subvolumes for both / & /home, and create a snapshot for each and restore from their snapshots (restore snapshots from a live CD)?










    share|improve this question

























      1












      1








      1








      OS: Arch Linux x86_64



      I have one BTRFS filesystem, both containing / & /home, how do I create subvolumes for both / & /home, and create a snapshot for each and restore from their snapshots (restore snapshots from a live CD)?










      share|improve this question














      OS: Arch Linux x86_64



      I have one BTRFS filesystem, both containing / & /home, how do I create subvolumes for both / & /home, and create a snapshot for each and restore from their snapshots (restore snapshots from a live CD)?







      arch-linux btrfs






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 13 hours ago









      ZethexZethex

      83




      83






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Creating subvolumes for / and /home



          Assuming / is currently the root subvolume of your BTRFS filesystem, you need to first create the subvolumes and then move the directories into their respective subvolumes.



          WARNING: Before using any of the following commands, ensure you read about them and understand how they work.



          cd /
          btrfs subvol create rootfs
          btrfs subvol create homefs
          cp -a --reflink=always bin usr root var rootfs/ # This is just a sample of directories to copy. But DON'T copy home.
          cp -a --reflink=always home/* homefs/


          Then, edit /etc/fstab and change the / mountpoint so that it uses the rootfs subvolume. This is done by adding the option (-o) subvol=rootfs. Then, add a mountpoint for /home using the homefs subvolume. You'll also need to update the root filesystem configured in your bootloader.



          Finally, reboot and confirm the new mountpoints are being used. If all is well, you can temporarily mount the root subvolume (in a directory such as /root/btrfs) and delete the original directories you copied.



          Creating snapshots



          Personally, I have a subvolume containing my snapshots. That way I'm able to mount the snapshots at, say. /mnt/snapshots and have easy access to a file I may have accidently deleted.



          Setup



          mkdir /root/btrfs
          mount /dev/WHATEVER /root/btrfs
          cd /root/btrfs
          btrfs subvol create snapshots


          Example of taking a read-only snapshot



          mount /dev/WHATEVER /root/btrfs
          cd /root/btrfs
          btrfs subvol snapshot -r rootfs snapshots/rootfs-2019-04-11


          Restoring from a snapshot



          No LiveCD needed to restore from a snapshot. The process is quite simple: rename the subvolume and then create a read-write snapshot from the snapshot of your choosing.



          Example of restoring the rootfs snapshot.



          mount /dev/WHATEVER /root/btrfs
          cd /root/btrfs
          mv rootfs rootfs-old # Even though rootfs would be mounted, you can still rename it without affecting the running system.
          btrfs subvol snapshot snapshots/rootfs-2019-04-10 rootfs


          Reboot for the restore to take effect.






          share|improve this answer
























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f511885%2fbtrfs-subvolumes-for-home-and-being-able-to-snapshot-and-restore-from-th%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            Creating subvolumes for / and /home



            Assuming / is currently the root subvolume of your BTRFS filesystem, you need to first create the subvolumes and then move the directories into their respective subvolumes.



            WARNING: Before using any of the following commands, ensure you read about them and understand how they work.



            cd /
            btrfs subvol create rootfs
            btrfs subvol create homefs
            cp -a --reflink=always bin usr root var rootfs/ # This is just a sample of directories to copy. But DON'T copy home.
            cp -a --reflink=always home/* homefs/


            Then, edit /etc/fstab and change the / mountpoint so that it uses the rootfs subvolume. This is done by adding the option (-o) subvol=rootfs. Then, add a mountpoint for /home using the homefs subvolume. You'll also need to update the root filesystem configured in your bootloader.



            Finally, reboot and confirm the new mountpoints are being used. If all is well, you can temporarily mount the root subvolume (in a directory such as /root/btrfs) and delete the original directories you copied.



            Creating snapshots



            Personally, I have a subvolume containing my snapshots. That way I'm able to mount the snapshots at, say. /mnt/snapshots and have easy access to a file I may have accidently deleted.



            Setup



            mkdir /root/btrfs
            mount /dev/WHATEVER /root/btrfs
            cd /root/btrfs
            btrfs subvol create snapshots


            Example of taking a read-only snapshot



            mount /dev/WHATEVER /root/btrfs
            cd /root/btrfs
            btrfs subvol snapshot -r rootfs snapshots/rootfs-2019-04-11


            Restoring from a snapshot



            No LiveCD needed to restore from a snapshot. The process is quite simple: rename the subvolume and then create a read-write snapshot from the snapshot of your choosing.



            Example of restoring the rootfs snapshot.



            mount /dev/WHATEVER /root/btrfs
            cd /root/btrfs
            mv rootfs rootfs-old # Even though rootfs would be mounted, you can still rename it without affecting the running system.
            btrfs subvol snapshot snapshots/rootfs-2019-04-10 rootfs


            Reboot for the restore to take effect.






            share|improve this answer




























              1














              Creating subvolumes for / and /home



              Assuming / is currently the root subvolume of your BTRFS filesystem, you need to first create the subvolumes and then move the directories into their respective subvolumes.



              WARNING: Before using any of the following commands, ensure you read about them and understand how they work.



              cd /
              btrfs subvol create rootfs
              btrfs subvol create homefs
              cp -a --reflink=always bin usr root var rootfs/ # This is just a sample of directories to copy. But DON'T copy home.
              cp -a --reflink=always home/* homefs/


              Then, edit /etc/fstab and change the / mountpoint so that it uses the rootfs subvolume. This is done by adding the option (-o) subvol=rootfs. Then, add a mountpoint for /home using the homefs subvolume. You'll also need to update the root filesystem configured in your bootloader.



              Finally, reboot and confirm the new mountpoints are being used. If all is well, you can temporarily mount the root subvolume (in a directory such as /root/btrfs) and delete the original directories you copied.



              Creating snapshots



              Personally, I have a subvolume containing my snapshots. That way I'm able to mount the snapshots at, say. /mnt/snapshots and have easy access to a file I may have accidently deleted.



              Setup



              mkdir /root/btrfs
              mount /dev/WHATEVER /root/btrfs
              cd /root/btrfs
              btrfs subvol create snapshots


              Example of taking a read-only snapshot



              mount /dev/WHATEVER /root/btrfs
              cd /root/btrfs
              btrfs subvol snapshot -r rootfs snapshots/rootfs-2019-04-11


              Restoring from a snapshot



              No LiveCD needed to restore from a snapshot. The process is quite simple: rename the subvolume and then create a read-write snapshot from the snapshot of your choosing.



              Example of restoring the rootfs snapshot.



              mount /dev/WHATEVER /root/btrfs
              cd /root/btrfs
              mv rootfs rootfs-old # Even though rootfs would be mounted, you can still rename it without affecting the running system.
              btrfs subvol snapshot snapshots/rootfs-2019-04-10 rootfs


              Reboot for the restore to take effect.






              share|improve this answer


























                1












                1








                1







                Creating subvolumes for / and /home



                Assuming / is currently the root subvolume of your BTRFS filesystem, you need to first create the subvolumes and then move the directories into their respective subvolumes.



                WARNING: Before using any of the following commands, ensure you read about them and understand how they work.



                cd /
                btrfs subvol create rootfs
                btrfs subvol create homefs
                cp -a --reflink=always bin usr root var rootfs/ # This is just a sample of directories to copy. But DON'T copy home.
                cp -a --reflink=always home/* homefs/


                Then, edit /etc/fstab and change the / mountpoint so that it uses the rootfs subvolume. This is done by adding the option (-o) subvol=rootfs. Then, add a mountpoint for /home using the homefs subvolume. You'll also need to update the root filesystem configured in your bootloader.



                Finally, reboot and confirm the new mountpoints are being used. If all is well, you can temporarily mount the root subvolume (in a directory such as /root/btrfs) and delete the original directories you copied.



                Creating snapshots



                Personally, I have a subvolume containing my snapshots. That way I'm able to mount the snapshots at, say. /mnt/snapshots and have easy access to a file I may have accidently deleted.



                Setup



                mkdir /root/btrfs
                mount /dev/WHATEVER /root/btrfs
                cd /root/btrfs
                btrfs subvol create snapshots


                Example of taking a read-only snapshot



                mount /dev/WHATEVER /root/btrfs
                cd /root/btrfs
                btrfs subvol snapshot -r rootfs snapshots/rootfs-2019-04-11


                Restoring from a snapshot



                No LiveCD needed to restore from a snapshot. The process is quite simple: rename the subvolume and then create a read-write snapshot from the snapshot of your choosing.



                Example of restoring the rootfs snapshot.



                mount /dev/WHATEVER /root/btrfs
                cd /root/btrfs
                mv rootfs rootfs-old # Even though rootfs would be mounted, you can still rename it without affecting the running system.
                btrfs subvol snapshot snapshots/rootfs-2019-04-10 rootfs


                Reboot for the restore to take effect.






                share|improve this answer













                Creating subvolumes for / and /home



                Assuming / is currently the root subvolume of your BTRFS filesystem, you need to first create the subvolumes and then move the directories into their respective subvolumes.



                WARNING: Before using any of the following commands, ensure you read about them and understand how they work.



                cd /
                btrfs subvol create rootfs
                btrfs subvol create homefs
                cp -a --reflink=always bin usr root var rootfs/ # This is just a sample of directories to copy. But DON'T copy home.
                cp -a --reflink=always home/* homefs/


                Then, edit /etc/fstab and change the / mountpoint so that it uses the rootfs subvolume. This is done by adding the option (-o) subvol=rootfs. Then, add a mountpoint for /home using the homefs subvolume. You'll also need to update the root filesystem configured in your bootloader.



                Finally, reboot and confirm the new mountpoints are being used. If all is well, you can temporarily mount the root subvolume (in a directory such as /root/btrfs) and delete the original directories you copied.



                Creating snapshots



                Personally, I have a subvolume containing my snapshots. That way I'm able to mount the snapshots at, say. /mnt/snapshots and have easy access to a file I may have accidently deleted.



                Setup



                mkdir /root/btrfs
                mount /dev/WHATEVER /root/btrfs
                cd /root/btrfs
                btrfs subvol create snapshots


                Example of taking a read-only snapshot



                mount /dev/WHATEVER /root/btrfs
                cd /root/btrfs
                btrfs subvol snapshot -r rootfs snapshots/rootfs-2019-04-11


                Restoring from a snapshot



                No LiveCD needed to restore from a snapshot. The process is quite simple: rename the subvolume and then create a read-write snapshot from the snapshot of your choosing.



                Example of restoring the rootfs snapshot.



                mount /dev/WHATEVER /root/btrfs
                cd /root/btrfs
                mv rootfs rootfs-old # Even though rootfs would be mounted, you can still rename it without affecting the running system.
                btrfs subvol snapshot snapshots/rootfs-2019-04-10 rootfs


                Reboot for the restore to take effect.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 8 hours ago









                Emmanuel RosaEmmanuel Rosa

                3,4251612




                3,4251612






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f511885%2fbtrfs-subvolumes-for-home-and-being-able-to-snapshot-and-restore-from-th%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

                    The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

                    Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...