Announcement

Collapse
No announcement yet.

Maintenance on Btrfs

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

    #16
    I've been a dufus! A real

    Working out all these plans for making backup snapshots on my 2nd HD and a USB HD.
    Then it hit me .... both of my HDs are identical. Why not convert the pair to a raid 1 setup and continue to use the USB HD as the off-site archival location for "btrfs send -f ..." backups.
    Back to the manuals ....

    EDIT: And then I run across this, which was followed by a howto in the same thread.
    Last edited by GreyGeek; Apr 25, 2017, 09:23 PM.
    "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


      #17
      Well, I'm getting ready to upgrade my btrfs from a single to a raid1.
      First, I am going to plug in my USB HD and send&receive my @ and @home snapshots to it.
      Then, I will delete on the snapshots, directories and files on the 2nd HD, which also uses btrfs, and then I will repartition it to create sdb1 and mkfs.btrfs sdb1.
      After that I will turn swap off so that the 10Gb sda5 partition wasted by it can be deleted, and then use the "btrfs fi resize max /" to give sda1 the same size as sdb1.
      Next I'll delete on the snapshots on my rootfs and also the snapshots directory, then run balance on sda1.
      Then I'll run "btrfs device add /dev/sdb1 /", followed by using balance again but this time with the -dconvert=raid1 -mconvert=raid1 -sconvert=raid1 parameters.

      My drives are 750Gb WD's. As a single "btrfs fi usage /" shows 90Gb used and about 598Gb free. With 2 disks running as a raid1 those numbers will stay at about the same values. I expect some speed penalty for making two copies of everything, even with COW because changes will be written twice. My archival copies will be on my 320gb WD Passport drive, which will be my weak link because WD's USB HD's are notoriously unreliable. That means that a 256Gb USB SSD is in my future because ro snapshots of @ and @home will, combined, take about 100Gb.

      If things work out I'll sign on later today. If not, I'm going fishing.
      "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


        #18
        The 2nd HD was added to the pool and the balance started

        Code:
        [FONT=monospace][B][COLOR=#000000]btrfs device add -f /dev/sdb /  [/COLOR][/B][COLOR=#000000](the -f was used to force the add because sdb was already formated with btrfs)[/COLOR]
        
        [/FONT]
        [FONT=monospace][FONT=courier new][B][COLOR=#000000]btrfs balance start -dconvert=raid1 -mconvert=raid1 -sconvert=raid1 /[/COLOR][/B][/FONT]
        (I was going to add -sconvert=raid1 but was given a warning so I decided to do more research on that aspect)
        (The convert took 33 minutes.)
        
        [/FONT][FONT=monospace][COLOR=#000000]:~# [B]btrfs fi show /[/B][/COLOR]
        Label: none  uuid: 12980ae8-4117-4cc5-bbb8-8065e82af93d
                Total devices 2 FS bytes used 90.33GiB
                devid    1 size 691.19GiB used 97.03GiB path /dev/sda1
                devid    2 size 698.64GiB used 97.03GiB path /dev/sdb
        
        [/FONT][FONT=monospace][COLOR=#000000]:~# [B]btrfs fi usage /[/B][/COLOR]
        Overall:
            Device size:                   1.36TiB
            Device allocated:            194.06GiB
            Device unallocated:            1.17TiB
            Device missing:                  0.00B
            Used:                        180.67GiB
            Free (estimated):            603.23GiB      (min: 603.23GiB)
            Data ratio:                       2.00
            Metadata ratio:                   2.00
            Global reserve:              146.84MiB      (used: 0.00B)
        
        Data,RAID1: Size:95.00GiB, Used:89.65GiB
           /dev/sda1      95.00GiB
           /dev/sdb       95.00GiB
        
        Metadata,RAID1: Size:2.00GiB, Used:704.03MiB
           /dev/sda1       2.00GiB
           /dev/sdb        2.00GiB
        
        System,RAID1: Size:32.00MiB, Used:16.00KiB
           /dev/sda1      32.00MiB
           /dev/sdb       32.00MiB
        
        Unallocated:
           /dev/sda1     594.15GiB
           /dev/sdb      601.61GiB
        
        [/FONT]
        RAID1 on data, metadata and systems.
        AND, I kept using the system live while all that was going on. (I would have had to boot into my btrfs LiveUSB in order to expand the sda1 to absorb the freed up 7.45Gb swap sda5 partition, and I decided against that. I'll think of something else to use sda5 for.)

        Last edited by GreyGeek; Apr 26, 2017, 10:29 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


          #19
          I've never seen a reference to -sconvert, only -d and -m. My belief is (undocumented) that the system data takes care of itself.

          @here;
          a RAID1 pool shows "System, RAID1"
          a RAID0 pool shows "System, RAID1"
          a single device shows "System, single"

          Please Read Me

          Comment


            #20
            Originally posted by oshunluvr View Post
            I've never seen a reference to -sconvert, only -d and -m. My belief is (undocumented) that the system data takes care of itself.

            @here;
            a RAID1 pool shows "System, RAID1"
            a RAID0 pool shows "System, RAID1"
            a single device shows "System, single"
            As you would suspect, my single drive btrfs installation had data, metadata and system as "single" or DUP.

            I didn't use the -sconvert=raid1 because it wanted me to force the conversion with "--force". As it turned out, the "System" became RAID1 as well without using -s...".

            I just did my first ro snapshot of @, which took a fraction of a second, and then the send & receive to my usb HD mounted at /backup, and it took 10 minutes. I am now doing the send & receive of the @home backup and I suspect that it will take about 30 minutes.


            Interestingly, on my sdb drive, before I added it to the pool, the Data was single and the Metadata and System were DUP. When my S&R's are done I'll see what the data, metadata and system settings are on my USB HD.
            Last edited by GreyGeek; Apr 26, 2017, 01:12 PM.
            "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


              #21
              I finished the backups to my USB 320Gb HD mounted at /dev/sdc1 as /backup.
              Code:
              [FONT=monospace][FONT=courier new][B][COLOR=#000000]btrfs fi usage /backup[/COLOR][/B][/FONT]
              Overall:
                  Device size:                 297.43GiB
                  Device allocated:            179.02GiB
                  Device unallocated:          118.41GiB
                  Device missing:                  0.00B
                  Used:                        176.34GiB
                  Free (estimated):            118.51GiB      (min: 59.30GiB)
                  Data ratio:                       1.00
                  Metadata ratio:                   2.00
                  Global reserve:              267.95MiB      (used: 0.00B)
              
              Data,single: Size:174.00GiB, Used:173.90GiB
                 /dev/sdc1     174.00GiB
              
              Metadata,DUP: Size:2.50GiB, Used:1.22GiB
                 /dev/sdc1       5.00GiB
              
              System,DUP: Size:8.00MiB, Used:48.00KiB
                 /dev/sdc1      16.00MiB
              
              Unallocated:
                 /dev/sdc1     118.41GiB
              
              
              :/# [FONT=courier new][B]btrfs fi du -s /backup[/B][/FONT]
                   Total   Exclusive  Set shared  Filename
               173.86GiB   173.86GiB       0.00B  /backup
              [/FONT]


              "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


                #22
                Cool -- I didn't even know I could do that!

                Code:
                root@Hibiscus:/# btrfs fi usage /mnt/DATA
                Overall:
                   Device size:                   1.82TiB
                   Device allocated:            772.04GiB
                   Device unallocated:            1.06TiB
                   Device missing:                  0.00B
                   Used:                        742.66GiB
                   Free (estimated):              1.09TiB      (min: 570.64GiB)
                   Data ratio:                       1.00
                   Metadata ratio:                   2.00
                   Global reserve:              512.00MiB      (used: 0.00B)
                
                Data,single: Size:8.00MiB, Used:7.85MiB
                  /dev/sdc        8.00MiB
                
                Data,RAID0: Size:766.00GiB, Used:740.85GiB
                  /dev/sdc      383.00GiB
                  /dev/sdd      383.00GiB
                
                Metadata,single: Size:8.00MiB, Used:0.00B
                  /dev/sdc        8.00MiB
                
                Metadata,RAID1: Size:3.00GiB, Used:924.41MiB
                  /dev/sdc        3.00GiB
                  /dev/sdd        3.00GiB
                
                System,single: Size:4.00MiB, Used:0.00B
                  /dev/sdc        4.00MiB
                
                System,RAID1: Size:8.00MiB, Used:80.00KiB
                  /dev/sdc        8.00MiB
                  /dev/sdd        8.00MiB
                
                Unallocated:
                  /dev/sdc      545.49GiB
                  /dev/sdd      545.50GiB

                Comment


                  #23
                  It is!
                  Oshunluver found a neat little command in the 4.9 version of btrfs-progs:
                  Code:
                  [COLOR=#000000]:[/COLOR][COLOR=#5454FF][B]~[/B][/COLOR][COLOR=#000000]$ [B]sudo btrfs fi du -s /  [/B][/COLOR]
                       Total   Exclusive  Set shared  Filename
                    87.93GiB     1.01GiB    86.91GiB  /
                  
                  
                  [That was on my sda1 when it was a single.  After I converted to RAID1 using two identical HDs I got:[/FONT]
                  
                  
                  [B] sudo btrfs fi du -s /[/B]
                   
                       Total   Exclusive  Set shared  Filename
                    85.44GiB   653.07MiB    84.80GiB  /
                  The btrfs-progs package is found here and it updates btrfs-tools (which is now a dummy transitional package. The 4.9 version has the "du" switch in it, the 4.4 version of btrfs-tools in the repository does not. I used btrfs-progs to convert my system to raid1.
                  Last edited by GreyGeek; Apr 26, 2017, 04:30 PM.
                  "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


                    #24
                    The btrfs-progs package is in Debian sid:

                    Code:
                    root@hp-350g:/# apt policy btrfs-progs
                    btrfs-progs:
                    Installed: 4.9.1-1
                    Candidate: 4.9.1-1
                    Version table:
                    *** 4.9.1-1 500
                          500 http://httpredir.debian.org/debian unstable/main amd64 Packages
                          100 /var/lib/dpkg/status

                    Comment


                      #25
                      Originally posted by GreyGeek View Post
                      Interestingly, on my sdb drive, before I added it to the pool, the Data was single and the Metadata and System were DUP. When my S&R's are done I'll see what the data, metadata and system settings are on my USB HD.
                      I think, for a file system, btrfs is pretty smart. When you have a single drive, by default it duplicates the metadata and system areas. If a sector containing a file were to get trashed or die, you'd lose a file. If a metadata sector fails, you might loose a whole lot more. When you add a second drive, the second copies of meta and sys are moved to the second device. Automatic redundancy.

                      Please Read Me

                      Comment


                        #26
                        I did my first reboot this morning after converting my single to a RAID1 using two internal HDs.
                        Here are the results:
                        :~$ systemd-analyze
                        Startup finished in 8.868s (kernel) + 3min 2.314s (userspace) = 3min 11.182s



                        You read that right. Six minutes + to boot to the desktop. BUT, that's not all. I opened a Konsole to run systemd-analyse:

                        :~$ systemd-analyze blame
                        Bootup is not yet finished. Please try again later.


                        THAT is an error msg that I have never seen before in 19 years of using Linux!

                        "Systemd-anlyze blame" produced normal results.

                        I consulted the system logs and noted:
                        4/27/17 7:51 AM systemd Timed out waiting for device dev-disk-by\x2duuid-5702affa\x2d252a\x2d4020\x2d9f46\x2d59461618b8aa.d evice.

                        A quick check of /etc/fstab revealed that although I had turned swap off and deleted its sda5 partition, I FORGOT to comment out the section in /etc/fstab that loads the swap disk.


                        Doing that and rebooting gave:
                        :~$ systemd-analyze
                        Startup finished in 8.516s (kernel) + 23.338s (userspace) = 31.855s
                        I timed 33 seconds from grub to the login screen and 15 seconds from the login screen to a functional desktop.

                        Ah.... things back to normal!







                        Last edited by GreyGeek; Apr 27, 2017, 09:34 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


                          #27
                          IMO, that's a bug. systemd shouldn't hang for 6+ minutes and then never complete because swap is missing.

                          Please Read Me

                          Comment


                            #28
                            Probably a kernel bug and not a Btrfs bug, since Btrfs doesn't use swap?
                            "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


                              #29
                              Yeah,

                              Please Read Me

                              Comment


                                #30
                                Originally posted by GreyGeek View Post
                                I timed 33 seconds from grub to the login screen and 15 seconds from the login screen to a functional desktop.
                                I suggest you consider getting an SSD, perhaps a smallish one just for the OS. I get about 2 s from grub to login prompt, and 3 s from login screen to desktop on a bad day. (It's 8 s for the POST, power on to grub, too much, so now I suspend.)
                                Regards, John Little

                                Comment

                                Working...
                                X