Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: The size of / with btrfs filesystem

  1. #1

    Default The size of / with btrfs filesystem

    UPDATE: Oh, sorry, I just realized this is a wrong group. Could anybody move the thread to the right category please?

    I ran out of space when doing "zypper dup" recently, and hence I started investigating what the cause is. I deleted btrfs snapshots, /tmp, /var/log, rpm cache,..., ran btrfs balance and restarted the system. This is what I get now. Note that / is mounted on /dev/sda6.

    Running the df:
    Code:
    sudo df /dev/sda6 -h
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda6        41G   32G  8.0G  80% /
    Running the btrfs df:
    Code:
    sudo btrfs filesystem df -h /
    Data, single: total=30.00GiB, used=28.97GiB
    System, DUP: total=32.00MiB, used=16.00KiB
    Metadata, DUP: total=1.50GiB, used=803.84MiB
    GlobalReserve, single: total=512.00MiB, used=0.00B
    Running the du:
    Code:
    sudo du -sh -x / 
    16G    /
    Running the btrfs du:
    Code:
    sudo btrfs filesystem du -s --human-readable /
         Total   Exclusive  Set shared  Filename
      32.24GiB    25.38GiB     3.43GiB  /
    I called the above commands within the time interval of 30 seconds. In addition, running the last command a couple of times it always gives a different output. I would like to emphasize that the balance is finished, the system was restarted and I am not doing anything else than running these commands and writing on this forum:

    Code:
    sudo btrfs filesystem du -s --human-readable /
         Total   Exclusive  Set shared  Filename
      32.24GiB    14.30GiB    14.51GiB  /
    pavel@linux-97ls:~> sudo btrfs filesystem du -s --human-readable /
         Total   Exclusive  Set shared  Filename
      32.24GiB    25.33GiB     3.48GiB  /
    pavel@linux-97ls:~> sudo btrfs filesystem du -s --human-readable /
         Total   Exclusive  Set shared  Filename
      32.24GiB    21.57GiB     7.24GiB  /
    pavel@linux-97ls:~> sudo btrfs balance status /
    No balance found on '/'
    pavel@linux-97ls:~> sudo btrfs filesystem du -s --human-readable /
         Total   Exclusive  Set shared  Filename
      32.24GiB    25.38GiB     3.43GiB  /
    pavel@linux-97ls:~> sudo btrfs filesystem du -s --human-readable /
         Total   Exclusive  Set shared  Filename
      32.24GiB    14.28GiB    14.53GiB  /
    For completeness the current list of btrfs snapshots is

    Code:
    sudo snapper list
    Type   | # | Pre # | Date                             | User | Cleanup | Description           | Userdata
    -------+---+-------+----------------------------------+------+---------+-----------------------+---------
    single | 0 |       |                                  | root |         | current               |         
    single | 1 |       | Sat 16 Apr 2016 07:49:27 AM CEST | root |         | first root filesystem |
    and I used the following command to balance
    Code:
    sudo btrfs filesystem balance start -dusage=100 /
    Could anybody explain to me why the outputs of these programs differ?
    Could anybody suggest how to increase the free space so that I do not run into problems when doing zypper dup or making new snapshots?
    To sum up, according to the df command I only have 8GB of free space. However, just 12GB are actually used according to du. The / partition has size 41GB. It seems like that there is 21GB of some "filesystem metadata" which I can not control.

    Thank you very much for your comments!

  2. #2
    Join Date
    Feb 2016
    Location
    Berlin
    Posts
    357

    Default Re: The size of / with btrfs filesystem

    if your check space soon after clearing snapshots, it takes a while to clean up.
    check if you have any 'rouge' snapshots not listed in snapper using-
    Code:
    sudo btrfs subvolume list /
    

  3. #3

    Default Re: The size of / with btrfs filesystem

    The command ndc33 suggested gives the following (Although I do not know have any idea what this data mean... I have to study btrfs more):

    Code:
    sudo btrfs subvolume list /
    ID 257 gen 484545 top level 5 path .snapshots
    ID 258 gen 484882 top level 257 path .snapshots/1/snapshot
    ID 259 gen 484712 top level 5 path boot/grub2/i386-pc
    ID 260 gen 484550 top level 5 path boot/grub2/x86_64-efi
    ID 261 gen 484831 top level 5 path opt
    ID 262 gen 484551 top level 5 path srv
    ID 263 gen 484880 top level 5 path tmp
    ID 264 gen 484839 top level 5 path usr/local
    ID 265 gen 484554 top level 5 path var/crash
    ID 266 gen 484554 top level 5 path var/lib/libvirt/images
    ID 267 gen 484554 top level 5 path var/lib/mailman
    ID 268 gen 484554 top level 5 path var/lib/mariadb
    ID 269 gen 484554 top level 5 path var/lib/mysql
    ID 270 gen 484554 top level 5 path var/lib/named
    ID 271 gen 484554 top level 5 path var/lib/pgsql
    ID 272 gen 484880 top level 5 path var/log
    ID 273 gen 484554 top level 5 path var/opt
    ID 274 gen 484882 top level 5 path var/spool
    ID 275 gen 484878 top level 5 path var/tmp
    ID 1030 gen 484375 top level 5 path var/lib/machines
    ID 1912 gen 484712 top level 257 path .snapshots/3/snapshot
    I also tried the following:

    Code:
    sudo du -hs /.snapshots/
    31G    /.snapshots/
    The commands from my previous post still (ca 6 hours after cleaning the snapshots with snapper and doing balance) return the same values (except for btrfs du where Exclusive and Set Shared change).

  4. #4
    Join Date
    Feb 2016
    Location
    Berlin
    Posts
    357

    Default Re: The size of / with btrfs filesystem

    trying to get the size of snapshots using standard tooling is impossible and misleading.
    best command (if you have quotas enabled) is
    Code:
    sudo btrfs qgroup show /
    
    before you removed snapshots approximately what number where you up to? Have you ever done a full rollback? what is result of
    Code:
    sudo btrfs subvolume get-default /
    
    i dont understand why you dont have @ for root, when did you install?

    The snapshot number 3 looks suspicious (when i compare to output from my system). but id wait for more knowledgeable person to confirm! [for info: 'sudo btrfs sub delete' to remove snapshots not indexed by snapper]

  5. #5
    Join Date
    Sep 2012
    Posts
    7,107

    Default Re: The size of / with btrfs filesystem

    Quote Originally Posted by 135246 View Post
    Code:
    ID 1912 gen 484712 top level 257 path .snapshots/3/snapshot
    This snapshot is not listed by snapper. What so content of /.snapshots/3? Is there info.xml file? And what is "btrfs sub get-default /"?

  6. #6
    Join Date
    Feb 2016
    Location
    Berlin
    Posts
    357

    Default Re: The size of / with btrfs filesystem

    > This snapshot is not listed by snapper.
    which is why it looks susicoius

    > What so content of /.snapshots/3?
    im guessing a rouge snapshot

    you didnt answer the question regards last snapshot number. (only old snapshot have large size)

    > Is there info.xml file?
    ?

    And what is "btrfs sub get-default /"?
    shows your default, try and see.

  7. #7

    Default Re: The size of / with btrfs filesystem

    1) Before I deleted the last snapshot I think I was around ~275
    2) I installed Thumbleweed almost two years ago. Since then I created a couple of snapshots myself and I think I rolled back at least once. All using snapper only.
    3) There is no info.xml in /.snapshots/3/.
    4) There is info.xml in /.snapshots/1/. Its content is
    Code:
    <?xml version="1.0"?>
    <snapshot>
      <type>single</type>
      <num>1</num>
      <date>2016-04-16 05:49:27</date>
      <description>first root filesystem</description>
    </snapshot>
    5) The default snapshot is
    Code:
    sudo btrfs sub get-default /ID 258 gen 485039 top level 257 path .snapshots/1/snapshot
    6) The sizes of snapshots are
    Code:
    sudo btrfs qgroup show /
    qgroupid         rfer         excl 
    --------         ----         ---- 
    0/5          16.00KiB     16.00KiB 
    0/257        16.00KiB     16.00KiB 
    0/258        14.94GiB     11.54GiB 
    0/259         2.38MiB      2.38MiB 
    0/260        16.00KiB     16.00KiB 
    0/261         2.38GiB      2.38GiB 
    0/262         1.19MiB      1.19MiB 
    0/263       773.79MiB    773.79MiB 
    0/264         1.31MiB      1.31MiB 
    0/265        16.00KiB     16.00KiB 
    0/266        16.00KiB     16.00KiB 
    0/267        16.00KiB     16.00KiB 
    0/268        16.00KiB     16.00KiB 
    0/269        16.00KiB     16.00KiB 
    0/270        16.00KiB     16.00KiB 
    0/271        16.00KiB     16.00KiB 
    0/272        82.38MiB     82.38MiB 
    0/273        16.00KiB     16.00KiB 
    0/274        48.00KiB     48.00KiB 
    0/275        21.73MiB     21.73MiB 
    0/1030       16.00KiB     16.00KiB 
    0/1912       14.93GiB     11.53GiB 
    1/0          14.93GiB     11.53GiB 
    255/1030     16.00KiB     16.00KiB

    What snapshots are safe to delete using the command btrfs sub delete? I would like to delete as many as possible (except for the current one of course :-)), then make balance + defragment, and eventually I would like to do zypper dup.

  8. #8
    Join Date
    Feb 2016
    Location
    Berlin
    Posts
    357

    Default Re: The size of / with btrfs filesystem

    you say you have rolled back but you still on default 1? are you sure it was full rollback? (i thought the default number changed after rollback?)

    so the reason i suspect a rouge snapshot can be seen in this thread https://forums.opensuse.org/showthre...uming-my-space

    for the quota size you can look up qgroup id and compare to the subvolume list to see the size of each snapshot. number 3 is:

    0/1912 14.93GiB 11.53GiB

    old snapshots get huge (all space consumed will become exclusive - i.e. have no relation to you present files).

    the only snapshot thats safe to delete using btrfs subvolume (i assume) would be ones not in snappers index (unless you want issues with snapper).

    No 3 looks and sounds (from the number being very low 3) that this is a rouge snapshot.

    i would create another snapshot... list with snapper and btrfs subvolumes, inspect the space using qgroups then compare ; try and judge why you have a number 3?, and if you think its rouge - nuke it (but dont blame me if you break you system )

  9. #9
    Join Date
    Apr 2016
    Location
    North America
    Posts
    537

    Default Re: The size of / with btrfs filesystem

    findmnt
    will also show what snapshot you're starting from (at the top).

    Checking for space I've been using:
    btrfs fi usage /

    Having snapshot 1 after more than a year of tumbleweed was eating 15-20gb for me.

    I had to roll back because of something unrelated, which allowed me to: snapper rm 1

    I wonder if you can just create a snapshot and rollback to it, thus allowing you to remove #1.

    For phantom snapshots, see the last two posts here:
    https://forums.opensuse.org/showthre...hours-straight

  10. #10

    Default Re: The size of / with btrfs filesystem

    EDIT: I wrote the text below before I read your newest posts. I will study your posts now.

    I am reading a little bit about btrfs... Is my understanding correct?:

    The btrfs filesystem on /dev/sda6 consists of a tree of subvolumes. The root subvolume is denoted by 5 by a convention.There is a parameter "default subvolume" of the filesystem which is the
    subvolume (currently 258) which gets mounted on Folder when /dev/sda6 is mounted on Folder (in our case Folder=/). Every subvolume has as parameters its "parent subvolume" and the "relative path" with respect to the parent subvolume (e.g. subvolume 263 has relative path /tmp with respect to its parent subvolume 5, which as a convention points to Folder). When the parent subvolume is mounted, the subvolumes contained in it are accessible in their relative paths as normal directories. In fstab there is a line mounting /dev/sda6 to /, and then various lines mounting subvolumes like 263,etc to /tmp, etc.

    As far as I understand, after a clean installation the subvolume 5 is set as default, and hence contains the data. At some point I did a rollback to snapshot 258 (which is a subvolume with parent subvolume 257 and relative path /1/. Here 257 is a subvolume whose parent subvolume is 5 and the relative path is .snapshots) which effectively set the default subvolume to be 258 and (maybe?) created a new snapshot e.g. 259, with the content of 5 in 257. Then I must have deleted 259. After this subvolume 5 still remains as the root subvolume by convention but now empty (?). Then I created some other snapshot 1912 (parent 257, relative path /3/) which somehow got lost from snapper. I conclude that it is safe to remove 1912 but I have to keep all other. OK?

    How could 1912 got lost from snapper?

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •