Announcement

Collapse
No announcement yet.

Beginner's guide to BTRFS

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

  • GreyGeek
    replied
    Originally posted by SpecialEd View Post
    You may be missing the point. Let the install create the partitions.
    Exactly.
    If you already have a swap partition then let it alone. For the rest of your free space combine it into ONE partition and assign it to btrfs with a label of "/". Don't do any other fancy stuff. That's what is messing you up. Let the INSTALLER create @ and @home for you.

    Leave a comment:


  • SpecialEd
    replied
    Originally posted by Thomas00 View Post
    ...although this time round the partisions will all be there already...
    You may be missing the point. Let the install create the partitions.

    Leave a comment:


  • Thomas00
    replied
    Agree, something went wrong, what it is I don’t know as it looks like what I did was exactly what you guys recommend. I may try the same thing again and hope for a different outcome...although this time round the partisions will all be there already...

    Leave a comment:


  • GreyGeek
    replied
    oshunluver stated the same conclusion that I had come to. In a correct install of btrfs there is NO need to edit /etc/fstab unless you want to create OTHER subvolumes on the <ROOT_FS> and mount them at boot, as I demoed with @Data in a post above.

    My recommendation is to stop wasting any more time on this, clear your partitions as oshunluver says, and install Kubuntu Bionic with btrfs in the correct way.

    Leave a comment:


  • Thomas00
    replied
    Originally posted by oshunluvr View Post
    Here's your problem. When installing to btrfs using manual partitioning, the way to do it is to set only the location for / and then the installer will automatically create the subvolumes. When using BTRFS you do not want or need separate partitions for / and /home as this defeats half or more of the reasons to use btrfs in the first place. A "Proper" BTRFS partitioning scheme is to have a swap partition, whatever partition(s) you need to boot (efi or whatever), and a single btrfs partition.

    If you don't have a lot of time invested in this install, I would wipe the partitions, re-partition putting the separate btrfs partitions together, then re-install to just the sole btrfs partition and indicate only "/" when manually setting the installation target. Then you will get @ for / and @home for /home
    Sorry, I wasn't precise in how I wrote this, what you are proposing is exactly what I did. Both / and /home are on the same partition.
    The boot drive has got 3 partitions:
    One for the boot loader (sda1), one for the OS (/ and /home) and a third one for swap:
    Code:
    thomas@homeserver:~$ blkid | grep sda
    /dev/sda2: LABEL="OS" UUID="9c3b40b6-c716-11e8-a25e-bcaec52979b7" UUID_SUB="9de1419d-bce2-4df0-881a-18b321c698ed" TYPE="btrfs" PARTUUID="73f89684-7bb9-4719-aca5-235a51b8dd2c"
    /dev/sda3: UUID="f6a03583-3a40-404f-897e-320de7e33746" TYPE="swap" PARTUUID="03c0c5de-c4ef-4642-bdd2-9a9715bb1880"
    btrfs subvolume list comes back with nothing :-(

    thomas@homeserver:~$ sudo btrfs subvolume list /
    thomas@homeserver:~$

    Maybe I just manually create a @ and @home subvolume, move things and see what happens?

    As far as a fresh install is concerned, I spent all day yesterday to get the server and services installed, not sure if I go through the effort of a fresh install again or just leave things as they are, nothing won but also not more time wasted. This was supposed to be a quick "btrfs-convert and be done" type project...
    Last edited by Thomas00; Oct 04, 2018, 11:12 AM.

    Leave a comment:


  • oshunluvr
    replied
    Originally posted by Thomas00 View Post
    And as far as installation was concerned I didn't do anything special. Had to choose manual disk setup because I wanted to change to btrfs, one partition for / and /home with some spare space left for swap which I set up manually afterwards, and that was it. No other special bits whatsoever...
    Here's your problem. When installing to btrfs using manual partitioning, the way to do it is to set only the location for / and then the installer will automatically create the subvolumes. When using BTRFS you do not want or need separate partitions for / and /home as this defeats half or more of the reasons to use btrfs in the first place. A "Proper" BTRFS partitioning scheme is to have a swap partition, whatever partition(s) you need to boot (efi or whatever), and a single btrfs partition.

    If you don't have a lot of time invested in this install, I would wipe the partitions, re-partition putting the separate btrfs partitions together, then re-install to just the sole btrfs partition and indicate only "/" when manually setting the installation target. Then you will get @ for / and @home for /home

    Leave a comment:


  • oshunluvr
    replied
    Back to basics: the "@" is just used to help differentiate a subvolume from a regular folder. It's not a "rule" just a mnemonic device.

    Subvolumes are like folders in a file cabinet. The btrfs file system is the drawer and the subvolumes are the folders. If one folder needs more space the other just move down the drawer and make room.

    So to identify subvolumes, do what GG says and use the subvolume list command.One thing I think GG may have wrong is you may not have any subvolumes at all, which normally the *buntu installers use - so I don't know what happened. It appears that the installation went to the root BTRFS volume instead of into subvolumes. Subvolumes are important because without then you cannot use the snapshot or backup (send|receive) features of btrfs.

    Leave a comment:


  • Thomas00
    replied
    Really strange. Well, I added the subvol tag to fstab and ran the below after a reboot. No change.
    Code:
    thomas@homeserver:~$ cat /etc/fstab         
    UUID=9c3b40b6-c716-11e8-a25e-bcaec52979b7       /               btrfs defaults,ssd,autodefrag,noatime,subvol=@ 0 0
    UUID=aa3dceed-ea65-4e14-87c8-ad93810e556c       /media/data/    btrfs   defaults,autodefrag 0 0  
    UUID=e8ec2376-3087-42e4-a73d-26983ff37bbc       /media/backup   btrfs   noauto  0       0
    UUID=f6a03583-3a40-404f-897e-320de7e33746       none            swap sw 0 0 
    thomas@homeserver:~$ sudo mount -t btrfs /dev/disk/by-uuid/9c3b40b6-c716-11e8-a25e-bcaec52979b7 /mnt
    thomas@homeserver:~$ ll /mnt
    total 48
    drwxr-xr-x 1 root   root    224 Oct  3 14:16 ./
    drwxr-xr-x 1 root   root    224 Oct  3 14:16 ../
    drwxr-xr-x 1 root   root   2430 Oct  3 14:38 bin/
    drwxr-xr-x 1 root   root    620 Oct  3 14:39 boot/
    ...
    
    thomas@homeserver:~$ sudo umount /dev/disk/by-uuid/9c3b40b6-c716-11e8-a25e-bcaec52979b7
    thomas@homeserver:~$ sudo btrfs subvolume show /
    /
         Name:                   <FS_TREE>
         UUID:                   -
         Parent UUID:            -
         Received UUID:          -
         Creation time:          -
         Subvolume ID:           5
         Generation:             3565
         Gen at creation:        0
         Parent ID:              0
         Top level ID:           0
         Flags:                  -
         Snapshot(s):
    thomas@homeserver:~$ sudo btrfs subvolume show /home
    ERROR: not a subvolume: /home
    ERROR: Failed to get subvol info /home: 1
    thomas@homeserver:~$
    And as far as installation was concerned I didn't do anything special. Had to choose manual disk setup because I wanted to change to btrfs, one partition for / and /home with some spare space left for swap which I set up manually afterwards, and that was it. No other special bits whatsoever...

    Leave a comment:


  • GreyGeek
    replied
    Originally posted by Thomas00 View Post
    I see you got “subvol=@“ and @home options in your fstab. You first mount the actual drive to @ and then further down, not show in your fstab screenshot, you map @ to /mnt, correct?
    I’ll try that tomorrow...
    Yes, but I didn't write that. The Kubuntu Bionic install wrote it when I installed it.

    Leave a comment:


  • Thomas00
    replied
    I see you got “subvol=@“ and @home options in your fstab. You first mount the actual drive to @ and then further down, not show in your fstab screenshot, you map @ to /mnt, correct?
    I’ll try that tomorrow...
    Last edited by Thomas00; Oct 03, 2018, 02:54 PM.

    Leave a comment:


  • GreyGeek
    replied
    blkid:
    Code:
    # blkid
    /dev/sda1: UUID="[B]00fa8116-00d7-4611-9603-434769265d10[/B]" UUID_SUB="b7f30ed6-bdeb-4100-9c68-75d9e0fdbe32" TYPE="btrfs" PARTUUID="e00dfb49-01"
    /dev/sdb1: LABEL="sdb1" UUID="17f4fe91-5cbc-46f6-9577-10aa173ac5f6" UUID_SUB="4d5f96d5-c6c6-4183-814b-88118160b615" TYPE="btrfs" PARTUUID="5fa5762c-9d66-4fdf-ba8f-5c699763e636"
    /dev/sdc1: LABEL="sdc1" UUID="b3131abd-c58d-4f32-9270-41815b72b203" UUID_SUB="498bde29-97bd-4282-b246-c1d20368b1da" TYPE="btrfs" PARTUUID="6fe79cf9-2de8-4fab-8f68-51d6e092b2a2"
    I'll mount my system to /mnt:

    root@GreyGeek:~# mount -t btrfs /dev/disk/by-uuid/00fa8116-00d7-4611-9603-434769265d10 /mnt

    and do
    # btrfs subvolume show /mnt
    Code:
    /
            Name:                   <FS_TREE>
            UUID:                   -
            Parent UUID:            -
            Received UUID:          -
            Creation time:          -
            Subvolume ID:           5
            Generation:             102496
            Gen at creation:        0
            Parent ID:              0
            Top level ID:           0
            Flags:                  -
            Snapshot(s):
    However, when I do
    # btrfs subvolume show /
    I get:
    Code:
    @
            Name:                   @
            UUID:                   76717daa-fcda-824a-b3cb-324e68742ad4
            Parent UUID:            f7f19158-6625-d548-8b60-174fb1fc22b5
            Received UUID:          -
            Creation time:          2018-09-15 10:32:32 -0500
            Subvolume ID:           841
            Generation:             109789
            Gen at creation:        85003
            Parent ID:              5
            Top level ID:           5
            Flags:                  -
            Snapshot(s):
                                    snapshots/@20180927

    And when I do:
    # btrfs subvolume show /home
    I get:
    Code:
    @home
            Name:                   @home
            UUID:                   c53c690d-869a-4e40-89c0-5f83130e193c
            Parent UUID:            63924e8d-0ce2-5b46-ae6d-8aa4ec3a98c3
            Received UUID:          -
            Creation time:          2018-09-15 10:32:44 -0500
            Subvolume ID:           842
            Generation:             109799
            Gen at creation:        85004
            Parent ID:              5
            Top level ID:           5
            Flags:                  -
            Snapshot(s):
                                    snapshots/@home20180927
    because @ and @home are mounted to / and /home in /etc/fstab. The disk is not mounted in /etc/fstab, only the subvolumes. Note that the uuid's given in the show command are not the ones in the /etc/fstab file or given by blkid.

    BUT, not giving an argument to the show command
    # btrfs subvolume show
    gives:
    Code:
    btrfs subvolume show: too few arguments
    usage: btrfs subvolume show [options] <subvol-path>|<mnt>
    
        Show more information about the subvolume
    
        -r|--rootid   rootid of the subvolume
        -u|--uuid     uuid of the subvolume
    
        If no option is specified, <subvol-path> will be shown, otherwise
        the rootid or uuid are resolved relative to the <mnt> path.
    which is NOT what you get.

    My /etc/fstab contains
    Code:
    #
    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    # / was on /dev/sda1 during installation
    UUID=[B]00fa8116-00d7-4611-9603-434769265d10[/B] /               btrfs   defaults,ssd,autodefrag,noatime,subvol=@ 0       1
    # /home was on /dev/sda1 during installation
    UUID=[B]00fa8116-00d7-4611-9603-434769265d10[/B] /home           btrfs   defaults,ssd,autodefrag,noatime,subvol=@home 0       2
    #/swapfile                                 none            swap    sw              0       0
    Last edited by GreyGeek; Oct 03, 2018, 02:45 PM.

    Leave a comment:


  • Thomas00
    replied
    I think I still haven't understood this @ business. How can you tell it's a subvolume? There is no mentioning of it in the btrfs filesystem output?
    I do have other btrfs drives which I converted a while back, maybe they get in the way?

    UUID=9c3b40b6-c716-11e8-a25e-bcaec52979b7 / btrfs defaults 0 0
    UUID=aa3dceed-ea65-4e14-87c8-ad93810e556c /media/data/ btrfs defaults,autodefrag 0 0
    UUID=e8ec2376-3087-42e4-a73d-26983ff37bbc /media/backup btrfs noauto 0 0
    UUID=f6a03583-3a40-404f-897e-320de7e33746 none swap sw 0 0
    Edit1: I tried the sudo btrfs filesystem usage / command on my laptop and it shows similar output to the one on my server, no mentioning of @ or @/home.
    Edit2: Ran btrfs subvolume show / and btrfs subvolume show /media/data and both show the same output:
    root@homeserver:~# btrfs subvolume show /media/data
    /
    Name: <FS_TREE>
    UUID: -
    Parent UUID: -
    Received UUID: -
    Creation time: -
    Subvolume ID: 5
    Generation: 41930
    Gen at creation: 0
    Parent ID: 0
    Top level ID: 0
    Flags: -
    Snapshot(s):
    Here's btrfs filesystem show
    root@homeserver:~# btrfs filesystem show
    Label: 'OS' uuid: 9c3b40b6-c716-11e8-a25e-bcaec52979b7
    Total devices 1 FS bytes used 2.89GiB
    devid 1 size 45.90GiB used 3.52GiB path /dev/sde2

    Label: 'Data' uuid: aa3dceed-ea65-4e14-87c8-ad93810e556c
    Total devices 3 FS bytes used 3.12TiB
    devid 1 size 3.64TiB used 2.09TiB path /dev/sda
    devid 2 size 3.64TiB used 2.09TiB path /dev/sdb
    devid 3 size 3.64TiB used 2.09TiB path /dev/sdc

    Label: 'Backup' uuid: e8ec2376-3087-42e4-a73d-26983ff37bbc
    Total devices 1 FS bytes used 494.88GiB
    devid 1 size 1.82TiB used 597.02GiB path /dev/sdd1
    Last edited by Thomas00; Oct 03, 2018, 01:38 PM.

    Leave a comment:


  • GreyGeek
    replied
    Well, it's a btrfs subvolume alright, but it is missing @ and @home in the root file system. What's in your /etc/fstab file?

    Leave a comment:


  • Thomas00
    replied
    Here you go:

    root@homeserver:~# btrfs filesystem usage /
    Overall:
    Device size: 45.90GiB
    Device allocated: 3.52GiB
    Device unallocated: 42.38GiB
    Device missing: 0.00B
    Used: 2.80GiB
    Free (estimated): 42.69GiB (min: 42.69GiB)
    Data ratio: 1.00
    Metadata ratio: 1.00
    Global reserve: 16.00MiB (used: 0.00B)

    Data,single: Size:3.01GiB, Used:2.69GiB
    /dev/sde2 3.01GiB

    Metadata,single: Size:520.00MiB, Used:112.23MiB
    /dev/sde2 520.00MiB

    System,single: Size:4.00MiB, Used:16.00KiB
    /dev/sde2 4.00MiB

    Unallocated:
    /dev/sde2 42.38GiB
    root@homeserver:~#

    Leave a comment:


  • GreyGeek
    replied
    What does
    sudo btrfs filesystem usage /
    show you?

    Leave a comment:

Users Viewing This Topic

Collapse

There are 0 users viewing this topic.

Working...
X