btrfs says @ is @home without subvolume

Discussion in 'Technical' started by Mark_in_Hollywood, Oct 16, 2013.

  1. Mark_in_Hollywood

    Mark_in_Hollywood New Member

    In June 2013, I reformatted my disk drive as btrfs. From June to October no problem. Then about 2 weeks ago, I get a boot time message about the / being nearly full. Usually the amount of free space being reported is under a gig. As I keep /home on it's own partition, and / on it's own partition, and the / partition is 18 gig, I knew this message to be inaccurate.

    I have put the output of:

    sudo du -schx /* -- and other relevant information, e.g., fstab,

    at

    http://paste.ubuntu.com/6246498/

    there you can see that /home is in / and /home uses 85 gig.

    I read HaraldWeber's post about how to fix the problem at:

    http://ubuntuforums.org/archive/index.php/t-2003556.html

    but I'm not able to understand enough to do what he did. Then I found your

    http://www.howtoforge.com/a-beginners-guide-to-btrfs

    and that helped but I have a few question remaining.

    Harald Weber said:

    "Boot from a live usb drive. Make two subvolumes, @ and @home like in my post, on your big volume (i call it /dev/sda5 here). These subvolumes appears as simple directories in /dev/sda5. Copy your root partition to @ (don't copy the subvolumes and your home directory). Move /home to @home (take care to not copy the @ subvolume too)"

    I plead for some help with the command structure of this. I am not a programmer, only an end user.
     
  2. HaraldWeber

    HaraldWeber New Member

    Hi

    I just stumbled across this post.

    Your command "btrfs subvolume list /" lists massive snapshots.
    I assume that apt creates snapshots before every update process but never deletes them. So all old files are kept in these snapshots and fill up your hdd.

    To get rid of them you have to delete these snapshots (snapshots are simply subvolumes).
    btrfs subvolume delete @apt-snapshot-*
    or more selective
    btrfs subvolume delete @apt-snapshot-2013-08*
    for all snapshots in august.
    or multiple months
    btrfs subvolume delete @apt-snapshot-2013-{08..10}*

    By the way whats the content of your /etc/fstab file?
     
  3. Mark2013

    Mark2013 New Member

    Trying to delete the snapshots using:

    " To get rid of them you have to delete these snapshots (snapshots are simply subvolumes).

    btrfs subvolume delete @apt-snapshot-* "

    the terminal returns:

    ERROR: 'subvolume delete' requires 1 arg(s)

    Netsearching for the above line, I found:

    How can I delete a apt-btrfs-snapshot when the error is “Directory not empty?”

    Problem was there was a subvolume within a subvolume. You need to delete all inner subvols before deleting containing vol.

    btrfs subvol delete /tmp/foo/@apt-snapshot-2013-04-XX_1X:3X:XX/@ btrfs subvol delete /tmp/foo/@apt-snapshot-2013-04-XX_1X:3X:XX

    but am unable to delete the snapshots as yet.
     
  4. Mark_in_Hollywood

    Mark_in_Hollywood New Member

    While in LiveUSB, I found

    Deleting an Apt-snapshot Btrfs Subvolume Is Hard

    and following it, I was able to delete about 25 @apt-snapshot- one at a time. For some reason:

    root@ubuntu:~#/ btrfs subvol delete /mnt/tmp/@apt-snapshot-*

    would not work in a Live session (LiveCD or Live USB). And I had to be in the /dev directory to make deletions. The snapshots could only be deleted by copying the snapshot line from within the terminal and pasting them into the end of the delete argument.

    But having manually deleted 2 pages of snapshots from seeing them in ls -l /mnt/tmp/, I was able to reboot in a regular manner, obtaining a working OS & Desktop.

    Returning to the Deleting ... is Hard post, in a regular OS session, I was able to completely remove approx. 160 of the snapshots remaining, using

    btrfs subvolume delete @apt-snapshot-*

    There were some odd lines leftover:

    Delete subvolume '/mnt/tmp/@apt-snapshot-2013-08-26_19:55:19'
    ERROR: cannot delete '/mnt/tmp/@apt-snapshot-2013-08-26_19:55:19' - Directory not empty

    Delete subvolume '/mnt/tmp/@apt-snapshot-2013-09-09_10:13:00'
    ERROR: cannot delete '/mnt/tmp/@apt-snapshot-2013-09-09_10:13:00' - Directory not empty
    Delete subvolume '/mnt/tmp/@apt-snapshot-2013-09-09_10:13:01'
    ERROR: cannot delete '/mnt/tmp/@apt-snapshot-2013-09-09_10:13:01' - Directory not empty

    Delete subvolume '/mnt/tmp/@apt-snapshot-2013-09-19_08:35:07'
    ERROR: cannot delete '/mnt/tmp/@apt-snapshot-2013-09-19_08:35:07' - Directory not empty
    Delete subvolume '/mnt/tmp/@apt-snapshot-2013-09-19_08:35:42'
    ERROR: cannot delete '/mnt/tmp/@apt-snapshot-2013-09-19_08:35:42' - Directory not empty
    Delete subvolume '/mnt/tmp/@apt-snapshot-2013-09-19_08:35:43'
    ERROR: cannot delete '/mnt/tmp/@apt-snapshot-2013-09-19_08:35:43' - Directory not empty
    Delete subvolume '/mnt/tmp/@apt-snapshot-2013-09-19_08:38:35'

    Delete subvolume '/mnt/tmp/@apt-snapshot-2013-09-24_09:11:04'
    ERROR: cannot delete '/mnt/tmp/@apt-snapshot-2013-09-24_09:11:04' - Directory not empty
    Delete subvolume '/mnt/tmp/@apt-snapshot-2013-09-24_09:11:05'
    ERROR: cannot delete '/mnt/tmp/@apt-snapshot-2013-09-24_09:11:05' - Directory not empty
    Delete subvolume '/mnt/tmp/@apt-snapshot-2013-09-25_08:36:59'

    and a double check of that:

    mark@Lexington:/$ sudo btrfs subvol list /
    ID 256 gen 105872 top level 5 path @
    ID 317 gen 105688 top level 5 path @apt-snapshot-2013-08-26_19:55:19
    ID 318 gen 43813 top level 5 path @apt-snapshot-2013-08-26_19:55:19/@
    ID 352 gen 105683 top level 5 path @apt-snapshot-2013-09-09_10:13:00
    ID 353 gen 60062 top level 5 path @apt-snapshot-2013-09-09_10:13:00/@
    ID 354 gen 105683 top level 5 path @apt-snapshot-2013-09-09_10:13:01
    ID 355 gen 60064 top level 5 path @apt-snapshot-2013-09-09_10:13:01/@
    ID 378 gen 71723 top level 5 path @apt-snapshot-2013-09-19_08:35:07
    ID 379 gen 71724 top level 5 path @apt-snapshot-2013-09-19_08:35:07/@
    ID 380 gen 71729 top level 5 path @apt-snapshot-2013-09-19_08:35:42
    ID 381 gen 71730 top level 5 path @apt-snapshot-2013-09-19_08:35:42/@
    ID 382 gen 71731 top level 5 path @apt-snapshot-2013-09-19_08:35:43
    ID 383 gen 71732 top level 5 path @apt-snapshot-2013-09-19_08:35:43/@
    ID 395 gen 77954 top level 5 path @apt-snapshot-2013-09-24_09:11:04
    ID 396 gen 77955 top level 5 path @apt-snapshot-2013-09-24_09:11:04/@
    ID 397 gen 77956 top level 5 path @apt-snapshot-2013-09-24_09:11:05
    ID 398 gen 77957 top level 5 path @apt-snapshot-2013-09-24_09:11:05/@

    Now on to fixing the @ seeing a @home incorrectly.

    After the deletions this is the reported free space. This seems extraordinary to me, that 50% of 19gig is used.

    mark@Lexington:~$ df -hT | egrep -i "file|^/"
    Filesystem Type Size Used Avail Use% Mounted on
    /dev/sda1 btrfs 19G 7.8G 8.1G 50% /
    /dev/sda6 btrfs 347G 87G 259G 26% /home

    Is it necessary to keep all those snapshots for the btrfs? And since I can't delete them anyway, why does btrfs want them? Seems like a lot. In practical matters, I would have to find a significant reason to expand a boot time partition to more than 18 gig. Most Ubuntu uses 8 to 10 gig.
     
    Last edited: Oct 18, 2013

Share This Page