Announcement

Collapse
No announcement yet.

Btrfs, Snapper and apt-btrfs-snapshot

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

    #31
    Originally posted by dibl View Post
    I would invite you to reconsider -- this is not an "either / or" decision. The default BTRFS configuration for multi-device filesystem provides BOTH RAID 1 striping (of the data) and Raid 2 mirroring (of the metadata). That's what I have on my system, for my user data.

    https://btrfs.wiki.kernel.org/index....ltiple_Devices
    Your citation has exactly what I want to do! Thanks!
    Conversion

    A non-raid filesystem is converted to raid by adding a device and running a balance filter that will change the chunk allocation profile.
    For example, to convert an existing single device system (/dev/sdb1) into a 2 device raid1 (to protect against a single disk failure):

    mount /dev/sda4 /mnt
    btrfs device add /dev/sdb1 /mnt
    btrfs balance start -dconvert=raid1 -mconvert=raid1 /mnt
    If the metadata is not converted from the single-device default, it remains as DUP, which does not guarantee that copies of block are on separate devices. If data is not converted it does not have any redundant copies at all.

    Using my 320GB USB HD I could create a two device system using RAID1. The question I would have is "would the external USB drive boot up the btrfs system?

    Oshunluver's suggestion to use "send" & "receive" looks like it could work to make a duplicate of / and /home on an external HD without having to be connected all the time.

    At least I now have two well defined plans of attack, and I'm looking forward to the experimentation!
    "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


      #32
      Well, let me say: If your lovely bride knew btrfs was in your thoughts during your walk (isn't it freezing there?) instead of her, and the day before Valentine's day no less, well I don't know what she'd say...

      ...likely not much as she's known you for quite a spell! Not to worry - I won't tell!


      Anyway: I'm honestly not sure if the send command follows the subvolume or the mounted file structure. I'd like to know the answer.

      Please Read Me

      Comment


        #33
        Originally posted by oshunluvr View Post
        Well, let me say: If your lovely bride knew btrfs was in your thoughts during your walk (isn't it freezing there?) instead of her, and the day before Valentine's day no less, well I don't know what she'd say...

        ...likely not much as she's known you for quite a spell! Not to worry - I won't tell!


        Anyway: I'm honestly not sure if the send command follows the subvolume or the mounted file structure. I'd like to know the answer.
        My bride of 52 years knows me better than I know myself!

        I have two paths to try out. If I bust something I cal always re-install!
        "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


          #34
          I've done some research about storage mediums. I was looking at 128/256GB space on USB 3 drives, SDXC cards or external USB 3.0 HDs. In my price range on Amazon most USB and SDXC devices had about 10% failure rates, according to their respective comment sections. One's with better quality were 3X my budget allowance. I have a 320GB external USB 2..0 HD, but it has backup info on it. And, as a USB 2.0 device its I/O speed isn't the greatest. So, I decided to get a $59 320GB USB 3.0 HD, exactly like my other external drive except that it uses USB 3.0, which is supposed to be faster. I have a 7 port active USB hub into which I plug all my USB devices except my duplex printer, so I rarely use the single USB 3.0 port on this Acer. My new HD will plug in to it, and I will put the HD between the plates of my clamshell laptop support. (I was really intrigued by the 128GB USB 3.0 flash drives that protude only ¼ inch out from the port, but they were too expensive and their 10% of their ratings were 1 start.)

          So, when that HD arrives I will begin my btrfs experimentation! Fun, fun, fun!!!
          "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


            #35
            I was doing some experimenting with external btrfs devices using one of my 8GB flash drives. It is a Verbatim "Store'nGo", which reserves a 500MB partition with a label of that name that cannot be deleted. KParted cannot delete it or re-lable it, but it can reformat the remaining partition of 7.45 GB that is created when a new partition table is created. However, KParted does not offer a btrfs format option!.

            I had previously used sudo mkfs.btrfs -f /dev/sdb to format that stick and that command appeared to work. KParted shows an unformatted partition. Seems like KParted isn't useful for btrfs systems.

            I used sudo mkfs.btrfs -f -LBtrfs8GB /dev/sdb1 to force a label on the sdb1 partititon amd format it using btrfs.
            Code:
            ~$ [FONT=courier new][B]sudo btrfs filesystem show /[/B][/FONT]
            Label: none  uuid: ddf94bee-0a35-4c66-87b7-857db8d21a0c
                    Total devices 1 FS bytes used 101.57GiB
                    devid    1 size 336.66GiB used 169.06GiB path /dev/sd[B]a[/B]4
            
            
            ~$ [FONT=courier new][B]sudo btrfs filesystem show /mnt[/B][/FONT]
            Label: Btrfs8GB  uuid: 4545f82f-6e16-4f24-b53d-4727ff8936ca
                    Total devices 1 FS bytes used 192.00KiB
                    devid    1 size 7.45GiB used 799.12MiB path /dev/sdb1
            
            ~$ [FONT=courier new][B]sudo btrfs filesystem df /mnt[/B][/FONT]
            Data, single: total=8.00MiB, used=64.00KiB
            System, DUP: total=8.00MiB, used=16.00KiB
            System, single: total=4.00MiB, used=0.00
            Metadata, DUP: total=381.56MiB, used=112.00KiB
            Metadata, single: total=8.00MiB, used=0.00
            There are TWO block devices created on the 8GB flashdrive, one for sdb and one for sdb1. They both have the same label. THe green uuid is my main HD partition, on sda4. The red ones are on the 8GB flashdrive. Except for the uuid they look almost identical, as if that flashdrive were a 16GB flashdrive.
            Code:
            ~$ [FONT=courier new][B]sudo btrfs filesystem show --all-devices[/B][/FONT]
            Label: [B]none[/B]  uuid: [COLOR=#008000]ddf94bee-0a35-4c66-87b7-857db8d21a0c[/COLOR]
                    Total devices 1 FS bytes used 101.57GiB
                    devid    1 size 336.66GiB used 169.06GiB path /dev/sda4
            
            Label: '[B]Btrfs8GB[/B]'  uuid:[COLOR=#ff0000] 0e5c129b-46ac-4921-9972-a1b1f7dd23d0[/COLOR]
                    Total devices 1 FS bytes used 112.00KiB
                    devid    1 size 7.4[B]6[/B]GiB used 799.[B]50[/B]MiB path /dev/[B][COLOR=#ff0000]sdb[/COLOR][/B]
            
            Label: '[B]Btrfs8GB[/B]'  uuid: [COLOR=#ff0000]4545f82f-6e16-4f24-b53d-4727ff8936ca[/COLOR]
                    Total devices 1 FS bytes used 192.00KiB
                    devid    1 size 7.4[B]5[/B]GiB used 799.[B]12[/B]MiB path /dev/[B][COLOR=#ff0000]sdb1[/COLOR][/B]
            I'm able to overlap a btrfs partitions with no complaints? I've got some more playing to do to sort this out.
            Last edited by GreyGeek; Feb 18, 2014, 06:03 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


              #36
              You can label an entire device.

              sudo mkfs.btrfs -f -LBtrfs8GB /dev/sdb

              Would have worked. From my blkid:
              Code:
              device                 fs_type   label      mount point                UUID
              ------------------------------------------------------------------------------------------------------------
              ~~~
              /dev/sdb               btrfs     data1      (in use)                   ff5136d4-33e1-418e-80ca-d616b37bc70f
              /dev/sdg               btrfs     data1      (in use)                   ff5136d4-33e1-418e-80ca-d616b37bc70f
              /dev/sdi               btrfs     red        (in use)                   dce8ff64-d316-40df-9425-961963d8c42d
              /dev/sdj               btrfs     ssd840pro  (in use)                   8f0c1661-4e84-4512-b875-23bcfd5be1d8
              /dev/sdk               btrfs     ssd840pro  (in use)                   8f0c1661-4e84-4512-b875-23bcfd5be1d8
              I don't know what to expect from the overlapping devices.

              Please Read Me

              Comment


                #37
                That's what I found out. But I doubt nice things would happen with crossed volumes. I used KParted and deleted all partititons. Then I ran

                Code:
                :~$ [FONT=courier new][B]sudo mkfs.btrfs -f -LBtrfs8GB /dev/sdb
                [/B][/FONT]
                WARNING! - Btrfs v3.12 IS EXPERIMENTAL
                WARNING! - see http://btrfs.wiki.kernel.org before using
                
                Turning ON incompat feature 'extref': increased hardlink limit per file to 65536
                fs created label [COLOR=#ff0000]Btrfs8GB[/COLOR] on[COLOR=#ff0000] /dev/sdb[/COLOR]
                        nodesize 16384 leafsize 16384 sectorsize 4096 size 7.46GiB
                
                ~$[FONT=courier new][B] sudo fdisk -l[/B][/FONT]
                
                Disk /dev/sda: 750.2 GB, 750156374016 bytes
                255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors
                Units = sectors of 1 * 512 = 512 bytes
                Sector size (logical/physical): 512 bytes / 4096 bytes
                I/O size (minimum/optimal): 4096 bytes / 4096 bytes
                Disk identifier: 0x040a05fb
                
                   Device Boot      Start         End      Blocks   Id  System
                /dev/sda1            2048    33556479    16777216   27  Hidden NTFS WinRE
                /dev/sda2   *    33556480    33761279      102400    7  HPFS/NTFS/exFAT
                /dev/sda3        33761280   759126015   362682368    7  HPFS/NTFS/exFAT
                /dev/sda4       759126016  1465147391   353010688   83  Linux
                
                Disk [COLOR=#ff0000]/dev/sdb[/COLOR]: 8006 MB, 8006926336 bytes
                247 heads, 62 sectors/track, 1021 cylinders, total 15638528 sectors
                Units = sectors of 1 * 512 = 512 bytes
                Sector size (logical/physical): 512 bytes / 512 bytes
                I/O size (minimum/optimal): 512 bytes / 512 bytes
                Disk identifier: 0x00000000
                
                [COLOR=#ff0000]Disk /dev/sdb doesn't contain a valid partition table[/COLOR]
                
                ~$ [FONT=courier new][B]sudo mount /dev/sdb /mnt[/B][/FONT]
                
                ~$ [B][FONT=courier new]sudo btrfs filesystem show --all-devices[/FONT][/B]
                Label: none  uuid: ddf94bee-0a35-4c66-87b7-857db8d21a0c
                        Total devices 1 FS bytes used 101.57GiB
                        devid    1 size 336.66GiB used 169.06GiB path /dev/sda4
                
                Label: '[COLOR=#ff0000]Btrfs8GB[/COLOR]'  uuid: c83be28a-c757-4939-9b98-057d8dbb2ad4
                        Total devices 1 FS bytes used 192.00KiB
                        devid    1 size 7.46GiB used 799.50MiB path[COLOR=#ff0000] /dev/sdb[/COLOR]
                
                
                ~$ [B][FONT=courier new]sudo btrfs filesystem df /mnt[/FONT][/B]
                Data, single: total=8.00MiB, used=64.00KiB
                System, DUP: total=8.00MiB, used=16.00KiB
                System, single: total=4.00MiB, used=0.00
                Metadata, DUP: total=381.75MiB, used=112.00KiB
                Metadata, single: total=8.00MiB, used=0.00
                
                ~$ [FONT=courier new][B]sudo btrfs filesystem show /mnt[/B][/FONT]
                Label: Btrfs8GB  uuid: c83be28a-c757-4939-9b98-057d8dbb2ad4
                        Total devices 1 FS bytes used 192.00KiB
                        devid    1 size 7.46GiB used 799.50MiB path [COLOR=#ff0000]/dev/sdb[/COLOR]
                
                
                ~$ [FONT=courier new][B]vdir /mnt[/B][/FONT]
                total 0
                
                ~$ [FONT=courier new][B]sudo  btrfs subvolume show /mnt[/B][/FONT]
                /mnt is btrfs root
                
                ~$ [FONT=courier new][B]sudo  btrfs subvolume show /[/B][/FONT]
                /
                        Name:                   @
                        uuid:                   70593792-0f70-7c42-8e26-f1a7cae7d28e
                        Parent uuid:            -
                        Creation time:          2014-01-21 17:09:59
                        Object ID:              257
                        Generation (Gen):       45243
                        Gen at creation:        6
                        Parent:                 5
                        Top Level:              5
                        Flags:                  -
                        Snapshot(s):
                "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


                  #38
                  Btrfs send/received and device add

                  The USB 3.0 500GB HD came today and I began experimenting with btrfs send/receive.
                  Code:
                  [FONT=courier new]btrfs send [-v] [-p <parent>] [-c <clone-src>] [-f <outfile>] <subvol>
                  
                  btrfs receive [-ve] [-f <infile>] <mount>[/FONT]
                  The results were not good. Here is a small snippet of the typical results.
                  I used
                  sudo mkfs.btrfs -f /dev/sdb
                  to format the external HD, and mounted it on /mnt. That didn't work. Then I mounted it on /home/jerry/mnt because that path isn't under the "/" subvolume.

                  Code:
                  :~$ [FONT=courier new][B]sudo btrfs send / | btrfs receive /home/jerry/mnt[/B][/FONT]
                  ERROR: failed to open destination directory /home/jerry/mnt. Operation not permitted
                  ERROR: / is not read-only.
                  One can't run inside a read-only system. I thought about mounting "/" on /mnt and trying
                  sudo btrfs send /mnt/ | btrfs receive /home/jerry/mnt
                  but didn't because it didn't make sense.

                  Then I tried using a file:
                  Code:
                  :~$ [FONT=courier new][B]sudo btrfs send -f /mnt/sent_file /[/B][/FONT]
                  ERROR: / is not read-only.
                  Then I tried to use a read-only snapshot as the source.
                  Code:
                  ~$[FONT=courier new][B] sudo btrfs subvolume snapshot -r / /.snapshots/backup_0[/B][/FONT]
                  Create a readonly snapshot of '/' in '/.snapshots/backup_0'
                  :~$ [B][FONT=courier new]sync[/FONT][/B]
                  :~$ [FONT=courier new][B]sudo mkdir /mnt/backupvol[/B][/FONT]
                  :~$[FONT=courier new][B] sudo btrfs send /.snapshots/backup_0 | btrfs receive /mnt/backupvol[/B][/FONT]
                  ERROR: failed to open destination directory /mnt/backupvol. Operation not permitted
                  At subvol /.snapshots/backup_0
                  ERROR: open @/.snapshots/backup_0 failed. No such file or directory
                  
                  :~$ [FONT=courier new][B]sudo btrfs send @.snapshots/backup_0 | btrfs receive /mnt/backupvol[/B][/FONT]
                  ERROR: failed to open destination directory /mnt/backupvol. Operation not permitted
                  ERROR: unable to resolve @.snapshots/backup_0
                  
                  :~$[FONT=courier new][B] sudo btrfs send /.snapshots/backup_0 | btrfs receive /mnt/backupvol/[/B][/FONT]
                  At subvol /.snapshots/backup_0
                  ERROR: open @/.snapshots/backup_0 failed. No such file or directory
                  If send/receive is supposed to work I have more to learn on how to use it.

                  So then I turned to adding the device to my /home subvolume.
                  Code:
                  :~$ [FONT=courier new][B]sudo btrfs device add -f /dev/sdb /home[/B][/FONT]
                  :~$ [FONT=courier new][B]sudo btrfs filesystem balance start -d -m /home[/B][/FONT]
                  Done, had to relocate 170 out of 170 chunks
                  
                  
                  :~$[FONT=courier new][B] sudo btrfs subvolume show /home[/B][/FONT]
                  /home
                          Name:                   @home
                          uuid:                   c4055db3-93f1-cc4a-833d-d8d8e516ac0b
                          Parent uuid:            -
                          Creation time:          2014-01-21 17:10:00
                          Object ID:              258
                          Generation (Gen):       47830
                          Gen at creation:        9
                          Parent:                 5
                          Top Level:              5
                          Flags:                  -
                          Snapshot(s):
                  
                  :~$[FONT=courier new][B] sudo btrfs filesystem df /home[/B][/FONT]
                  Data, single: total=102.00GiB, used=101.28GiB
                  System, RAID1: total=32.00MiB, used=48.00KiB
                  Metadata, RAID1: total=48.00GiB, used=540.69MiB
                  
                  
                  :~$[FONT=courier new][B] sudo btrfs filesystem show /home[/B][/FONT]
                  Label: none  uuid: ddf94bee-0a35-4c66-87b7-857db8d21a0c
                          Total devices 2 FS bytes used 101.81GiB
                          devid    1 size 336.66GiB used 48.03GiB path /dev/sda4
                          devid    2 size 465.73GiB used 150.03GiB path /dev/sdb
                  So, I now have a "Data, single" on /home, which is almost all used.
                  And, both System and Metadata are RAID1, with 540.69GB used.
                  The fs show /home command says I've used 48GB out of 337GB on sda4 and 150GB out of 466GB on sdb.
                  Last edited by GreyGeek; Jul 03, 2014, 03: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


                    #39
                    I think I got myself into a pickle. I decided to remove my new drive from /home and issued:
                    Code:
                    :~$ [FONT=courier new][B]sudo btrfs device delete /dev/sdb /home[/B][/FONT]
                    ERROR: error removing the device '/dev/sdb' - unable to go below two devices on raid1
                    Opps!
                    Now to figure out how to remove RAID1 from /home...

                    Code:
                    :~$ sudo btrfs filesystem balance start -f -dconvert=single -mconvert=single /home
                    is now running, but there is a warning about doing this causing loss of metadata integrity. (i,e., the small files.)

                    EDIT:
                    The conversion from RAID1 to Single worked OK, and the "delete device /dev/sdb /home" took about an hour to complete. Now to do a scrub.
                    Last edited by GreyGeek; Feb 19, 2014, 10:00 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

                    Working...
                    X