How to increase free disk space at root partition?

Hello,

Sorry to ask for help for the same issue again, but I’m running out of free space at root partition very often. As you can see in the thread below, previously at 2021 I was running Manjaro from a 256GB SSD EXT4, but now I upgrade to a NVME 500GB BTRFS and still having issue.

I have the feeling that Virt-Manager Qemu is part of the issue because even after deleting some virtual machines the free disk space didn’t increase too much as I expected and it was like 40GB for each virtual machine witch is around 8% of disk space.

I tried many command for maintenance and flatpak orphans, but still just a little improvement in the last days from 15% to now 22%, considering that I have a dedicated HD for personal files, another NMVE for games, and using BTRFS so even snapshots doesn’t take space using timeshift as EXT4 do so any suggestions is appreciated.

System:
  Kernel: 6.1.12-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 12.2.1
    parameters: BOOT_IMAGE=/@/boot/vmlinuz-6.1-x86_64
    root=UUID=69678a39-1940-48ee-8d02-88e765985137 rw rootflags=subvol=@ quiet
    apparmor=1 security=apparmor
    resume=UUID=b136d668-4460-4cf7-9211-93b9a5283ab3 udev.log_priority=3
  Desktop: KDE Plasma v: 5.26.5 tk: Qt v: 5.15.8 wm: kwin_wayland vt: 2
    dm: SDDM Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Desktop Mobo: N/A model: X99 serial: <superuser required>
    UEFI: American Megatrends v: 5.11 date: 07/30/2021
Battery:
  Message: No system battery data found. Is one present?
Memory:
  RAM: total: 15.53 GiB used: 4.2 GiB (27.1%)
  RAM Report: permissions: Unable to run dmidecode. Root privileges required.
CPU:
  Info: model: Intel Xeon E5-2640 v3 bits: 64 type: MT MCP arch: Haswell
    level: v3 note: check built: 2013-15 process: Intel 22nm family: 6
    model-id: 0x3F (63) stepping: 2 microcode: 0x49
  Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
    L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 2 MiB desc: 8x256 KiB L3: 20 MiB
    desc: 1x20 MiB
  Speed (MHz): avg: 1723 high: 3400 min/max: 1200/3400 scaling:
    driver: intel_cpufreq governor: schedutil cores: 1: 1200 2: 1197 3: 3400
    4: 3400 5: 1200 6: 1200 7: 1200 8: 1197 9: 2107 10: 1200 11: 1900 12: 1200
    13: 3400 14: 1197 15: 1200 16: 1374 bogomips: 83024
  Flags: abm acpi aes aperfmperf apic arat arch_perfmon avx avx2 bmi1 bmi2
    bts clflush cmov constant_tsc cpuid cpuid_fault cqm cqm_llc cqm_occup_llc
    cx16 cx8 dca de ds_cpl dtes64 dtherm dts epb ept ept_ad erms est f16c
    flexpriority flush_l1d fma fpu fsgsbase fxsr ht ibpb ibrs ida intel_ppin
    invpcid invpcid_single lahf_lm lm mca mce md_clear mmx monitor movbe msr
    mtrr nonstop_tsc nopl nx pae pat pbe pcid pclmulqdq pdcm pdpe1gb pebs pge
    pln pni popcnt pse pse36 pti pts rdrand rdtscp rep_good sdbg sep smep smx
    ss ssbd sse sse2 sse4_1 sse4_2 ssse3 stibp syscall tm tm2 tpr_shadow tsc
    tsc_adjust tsc_deadline_timer vme vmx vnmi vpid x2apic xsave xsaveopt
    xtopology xtpr
  Vulnerabilities:
  Type: itlb_multihit status: KVM: VMX disabled
  Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT
    vulnerable
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable
  Type: meltdown mitigation: PTI
  Type: mmio_stale_data mitigation: Clear CPU buffers; SMT vulnerable
  Type: retbleed status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, IBRS_FW,
    STIBP: conditional, RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: AMD Ellesmere [Radeon RX 470/480/570/570X/580/580X/590]
    vendor: Micro-Star MSI driver: amdgpu v: kernel arch: GCN-4
    code: Arctic Islands process: GF 14nm built: 2016-20 pcie: gen: 3
    speed: 8 GT/s lanes: 16 ports: active: DP-1 empty: DP-2, DP-3, DVI-D-1,
    HDMI-A-1 bus-ID: 03:00.0 chip-ID: 1002:67df class-ID: 0300 temp: 53.0 C
  Display: wayland server: X.org v: 1.21.1.7 with: Xwayland v: 22.1.8
    compositor: kwin_wayland driver: X: loaded: amdgpu unloaded: modesetting
    alternate: fbdev,vesa dri: radeonsi gpu: amdgpu display-ID: 0
  Monitor-1: DP-1 res: 2560x1440 size: N/A modes: N/A
  API: OpenGL v: 4.6 Mesa 22.3.5 renderer: AMD Radeon RX 570 Series
    (polaris10 LLVM 15.0.7 DRM 3.49 6.1.12-1-MANJARO) direct-render: Yes
Audio:
  Device-1: Intel 8 Series/C220 Series High Definition Audio
    driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 chip-ID: 8086:8c20
    class-ID: 0403
  Device-2: AMD Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590]
    vendor: Micro-Star MSI driver: snd_hda_intel v: kernel pcie: gen: 3
    speed: 8 GT/s lanes: 16 bus-ID: 03:00.1 chip-ID: 1002:aaf0 class-ID: 0403
  Sound API: ALSA v: k6.1.12-1-MANJARO running: yes
  Sound Server-1: JACK v: 1.9.22 running: no
  Sound Server-2: PulseAudio v: 16.1 running: yes
  Sound Server-3: PipeWire v: 0.3.65 running: yes
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: d000
    bus-ID: 06:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: enp6s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  IP v4: <filter> type: dynamic noprefixroute scope: global
    broadcast: <filter>
  IP v6: <filter> type: noprefixroute scope: global
  IP v6: <filter> type: noprefixroute scope: link
  IF-ID-1: virbr0 state: down mac: <filter>
  IP v4: <filter> scope: global broadcast: <filter>
  WAN IP: <filter>
Bluetooth:
  Message: No bluetooth data found.
Logical:
  Message: No logical block device data found.
RAID:
  Message: No RAID data found.
Drives:
  Local Storage: total: 2.73 TiB used: 2.05 TiB (75.1%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:1 vendor: Western Digital
    model: WD Blue SN570 500GB size: 465.76 GiB block-size: physical: 512 B
    logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter>
    rev: 234100WD temp: 39.9 C scheme: GPT
  ID-2: /dev/nvme1n1 maj-min: 259:0 vendor: Western Digital
    model: WDS500G2B0C-00PXH0 size: 465.76 GiB block-size: physical: 512 B
    logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter>
    rev: 233010WD temp: 33.9 C scheme: GPT
  ID-3: /dev/sda maj-min: 8:0 vendor: Western Digital model: WD20PURZ-85GU6Y0
    size: 1.82 TiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
    type: HDD rpm: 5400 serial: <filter> rev: 0A80 scheme: MBR
  Message: No optical or floppy data found.
Partition:
  ID-1: / raw-size: 448.38 GiB size: 448.38 GiB (100.00%)
    used: 346.67 GiB (77.3%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:4
    label: LINUX uuid: 69678a39-1940-48ee-8d02-88e765985137
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
    used: 568 KiB (0.2%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:3
    label: NO_LABEL uuid: CDC5-157E
  ID-3: /home raw-size: 448.38 GiB size: 448.38 GiB (100.00%)
    used: 346.67 GiB (77.3%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:4
    label: LINUX uuid: 69678a39-1940-48ee-8d02-88e765985137
  ID-4: /home/<filter>/GAMES raw-size: 465.76 GiB size: 457.38 GiB (98.20%)
    used: 163.79 GiB (35.8%) fs: ext4 dev: /dev/nvme1n1p1 maj-min: 259:2
    label: GAMES uuid: 9467047a-a0d0-46ff-859d-67a1bfff2456
  ID-5: /home/<filter>/HDD-2TB raw-size: 1.82 TiB size: 1.79 TiB (98.37%)
    used: 1.55 TiB (86.6%) fs: ext4 dev: /dev/sda1 maj-min: 8:1 label: 2TB-EXT4
    uuid: b9d4d0f9-d1ce-425d-8fe4-e2f830005289
  ID-6: /var/cache raw-size: 448.38 GiB size: 448.38 GiB (100.00%)
    used: 346.67 GiB (77.3%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:4
    label: LINUX uuid: 69678a39-1940-48ee-8d02-88e765985137
  ID-7: /var/log raw-size: 448.38 GiB size: 448.38 GiB (100.00%)
    used: 346.67 GiB (77.3%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:4
    label: LINUX uuid: 69678a39-1940-48ee-8d02-88e765985137
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default)
  ID-1: swap-1 type: partition size: 17.09 GiB used: 1.2 GiB (7.0%)
    priority: -2 dev: /dev/nvme0n1p3 maj-min: 259:5 label: swap
    uuid: b136d668-4460-4cf7-9211-93b9a5283ab3
Unmounted:
  Message: No unmounted partitions found.
USB:
  Hub-1: 1-0:1 info: Full speed or root hub ports: 2 rev: 2.0 speed: 480 Mb/s
    chip-ID: 1d6b:0002 class-ID: 0900
  Hub-2: 1-1:2 info: Intel Integrated Rate Matching Hub ports: 6 rev: 2.0
    speed: 480 Mb/s chip-ID: 8087:8008 class-ID: 0900
  Hub-3: 2-0:1 info: Full speed or root hub ports: 2 rev: 2.0 speed: 480 Mb/s
    chip-ID: 1d6b:0002 class-ID: 0900
  Hub-4: 2-1:2 info: Intel Integrated Rate Matching Hub ports: 6 rev: 2.0
    speed: 480 Mb/s chip-ID: 8087:8000 class-ID: 0900
  Hub-5: 3-0:1 info: Hi-speed hub with single TT ports: 12 rev: 2.0
    speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900
  Device-1: 3-7:2 info: [Maxxter] USB GAMING MOUSE type: Mouse,Keyboard
    driver: hid-generic,usbhid interfaces: 2 rev: 1.1 speed: 1.5 Mb/s
    power: 100mA chip-ID: 18f8:0fc0 class-ID: 0301
  Device-2: 3-8:3 info: SINO WEALTH Gaming KB type: Keyboard,HID
    driver: hid-generic,usbhid interfaces: 2 rev: 1.1 speed: 12 Mb/s power: 500mA
    chip-ID: 258a:002a class-ID: 0300
  Hub-6: 4-0:1 info: Super-speed hub ports: 6 rev: 3.0 speed: 5 Gb/s
    chip-ID: 1d6b:0003 class-ID: 0900
Sensors:
  System Temperatures: cpu: 36.0 C mobo: N/A gpu: amdgpu temp: 53.0 C
  Fan Speeds (RPM): N/A gpu: amdgpu fan: 194
Info:
  Processes: 389 Uptime: 23m wakeups: 0 Init: systemd v: 252 default: graphical
  tool: systemctl Compilers: gcc: 12.2.1 clang: 15.0.7 Packages: 1608
  pm: pacman pkgs: 1569 libs: 446 tools: pamac pm: flatpak pkgs: 32 pm: snap
  pkgs: 7 Shell: Zsh v: 5.9 default: Bash v: 5.1.16 running-in: konsole
  inxi: 3.3.25

Aren’t the replies to your previous thread still relevant?

They are and I already run all of them.

Then you should have all the information you need about your storage usage.
So unless it doesn’t add up, you can clean in consequence…
:person_shrugging:

I would not ask for help if I had all information, right?

pac/pamac/flatpak many caches were cleaned, orphans and duplicate installation in flatpak removed.

first time using BTRFS, I was expecting to get 8% free disk space for each virtual machine I delete and I deleted 2, but I don’t more then 4%, it’s a bit strange. I had the same software installed in all those virtual machines that I have in my main system in just 40GB.

I also tried to use Filelight but scanning Root it shows 65GB in the center of the image while I was expecting it to show 352GB once this is the current space used from root.

How is your system partitioned?

WD Blue SN570 500GB (nvme)
BOOT
SWAP
ROOT

   ~  lsblk -fa                                                                                                                                                                                      ✔ 
LANG=C sudo parted -l
NAME        FSTYPE   FSVER LABEL    UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
loop0       squashfs 4.0                                                       0   100% /var/lib/snapd/snap/snapd/18357
loop1       squashfs 4.0                                                       0   100% /var/lib/snapd/snap/core/14784
loop2       squashfs 4.0                                                       0   100% /var/lib/snapd/snap/core/14447
loop3       squashfs 4.0                                                       0   100% /var/lib/snapd/snap/bare/5
loop4       squashfs 4.0                                                       0   100% /var/lib/snapd/snap/gtk2-common-themes/13
loop5       squashfs 4.0                                                       0   100% /var/lib/snapd/snap/snapd/17950
loop6       squashfs 4.0                                                       0   100% /var/lib/snapd/snap/core18/2679
loop7       squashfs 4.0                                                       0   100% /var/lib/snapd/snap/core18/2697
loop8       squashfs 4.0                                                       0   100% /var/lib/snapd/snap/gtk-common-themes/1535
loop9                                                                                   
sda                                                                                     
└─sda1      ext4     1.0   2TB-EXT4 b9d4d0f9-d1ce-425d-8fe4-e2f830005289  151,9G    87% /home/lordsansui/HDD-2TB
nvme1n1                                                                                 
└─nvme1n1p1 ext4     1.0   GAMES    9467047a-a0d0-46ff-859d-67a1bfff2456  270,3G    36% /home/lordsansui/GAMES
nvme0n1                                                                                 
├─nvme0n1p1 vfat     FAT32 NO_LABEL CDC5-157E                             298,8M     0% /boot/efi
├─nvme0n1p2 btrfs          LINUX    69678a39-1940-48ee-8d02-88e765985137     96G    77% /var/log
│                                                                                       /var/cache
│                                                                                       /home
│                                                                                       /
└─nvme0n1p3 swap     1     swap     b136d668-4460-4cf7-9211-93b9a5283ab3                [SWAP]
[sudo] password for lordsansui: 
Model: ATA WDC WD20PURZ-85G (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  2000GB  2000GB  primary  ext4


Model: WD Blue SN570 500GB (nvme)
Disk /dev/nvme0n1: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size    File system     Name  Flags
 1      2097kB  317MB  315MB   fat32                 boot, esp
 2      317MB   482GB  481GB   btrfs           root
 3      482GB   500GB  18,3GB  linux-swap(v1)        swap


Model: WDC WDS500G2B0C-00PXH0 (nvme)
Disk /dev/nvme1n1: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size   File system  Name  Flags
 1      1049kB  500GB  500GB  ext4

The difference in reporting may come from the use of Btrfs:

General linux userspace tools such as df(1) will inaccurately report free space on a Btrfs partition.
[…]
The same limitations apply to tools which analyze space usage for some subset of the filesystem, such as du(1) or ncdu(1), as they do not take into account reflinks, snapshots and compression. Instead, see btduAUR and compsize for btrfs-aware alternatives.
Btrfs - ArchWiki

I just tried the the command line below from the post you shared and it reports 85% use. I’m not planning to do a new fresh install again, I hope we can find where the issue is.

$ btrfs filesystem usage /

Overall:
    Device size:                 448.38GiB
    Device allocated:            413.02GiB
    Device unallocated:           35.35GiB
    Device missing:                  0.00B
    Device slack:                  2.00KiB
    Used:                        347.77GiB
    Free (estimated):             95.25GiB      (min: 77.58GiB)
    Free (statfs, df):            95.25GiB
    Data ratio:                       1.00
    Metadata ratio:                   2.00
    Global reserve:              491.89MiB      (used: 0.00B)
    Multiple profiles:                  no

Data,single: Size:401.01GiB, Used:341.11GiB (85.06%)
   /dev/nvme0n1p2        401.01GiB

Metadata,DUP: Size:6.00GiB, Used:3.33GiB (55.52%)
   /dev/nvme0n1p2         12.00GiB

System,DUP: Size:8.00MiB, Used:64.00KiB (0.78%)
   /dev/nvme0n1p2         16.00MiB

Unallocated:
   /dev/nvme0n1p2         35.35GiB

Yes !
Snapshots do not use space. But old snapshots with different data (like complete VMs) do use space :wink:
So be sure to:

a) not make snapshots of VMs

or

b) remove old snapshots where VMs are included

or

c) make only 2 or 3 snapshots of a subvolume with VMs

( I do have all VMs in a separate subvolume)

Do delete old snapshots automatically !

Be aware that btrfs needs space to breath ! ( see@wiki )

Btrfs will need time to cleanup after you removed a snapshot. This may take 30min or more. After that time the free space is visible
:footprints:
P.S. : Familiarize yourself with btrfs. Then it will serve you well

Today I decided to delete all BTRFS snapshots from Timeshift and my free disk space increased from 19% to 75% witch is crazy, different from EXT4 I didn’t think that BTRFS snapshot could achieve such high disk space even cap the snapshot at 4.

Thank you for all suggestions. If someone could let a good explanation why VM consumes a lot of space in the snapshot even using BTRFS it would be good for the ones that may read this thread in the future.

It all depends on the snapshot content.

Since Timeshift makes incremental snapshots, through either RSYNC or Btrfs, only modified files are “duplicated”. But depending on what and when you make those, you may have a duplicate of a big file because of even a byte modified, or many files modified.
Also, even if Btrfs supports filesystem encryption, AFAIK it still needs to be explicitly enabled in your mount parameters.

To understand why snapshot can take so much disk space you need to understand what snapshots are technically…

A very simple but to the point explanation:

  • Every filesystem uses a table to notate which sectors are “used” by the filesystem, these tables are part of the filesystem itself and won’t showup in directory listings.
  • Every file and directory you normally see in a directory listing, has “pointers” to entries in those tables mentioned above.
  • BTRFS snapshots duplicate those “pointers” at the moment you create said snapshot.
  • When you modify a file those “pointers” will become different for that file, but will stay same for the snapshot version.
  • When entries in those tables have no “pointers” referring to them, they are/can be re-used for new allocations needed for files.
  • Because the “pointers” in a snapshot are still referring to entries in those tables, those entries (sectors) are not freed for re-use, and thus your total available disk space will get less and less untill those snapshots are removed…
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.