Btrfs Unalloacted Space

Hi,

After installing a few libs, I start getting issues of no disk space even when there is more than enough unallocated space on disk.

There is no specific information on how to resolve this issue & I dont want to take any risk of trying out solution that if found online (btrfs balance, btrfs resize etc.)

Question: What is right way to configure os to reclaim the unallocated space.

Disk usage details

 λ sudo btrfs fi show /
Label: none  uuid: 0f591629-dac9-451a-b168-cf64c3e8cdbc
        Total devices 1 FS bytes used 18.83GiB
        devid    1 size 681.56GiB used 29.02GiB path /dev/sda1

 λ sudo btrfs filesystem usage -T /
Overall:
    Device size:                 681.56GiB
    Device allocated:             29.02GiB
    Device unallocated:          652.54GiB
    Device missing:                  0.00B
    Used:                         19.75GiB
    Free (estimated):            659.63GiB      (min: 333.37GiB)
    Free (statfs, df):           659.63GiB
    Data ratio:                       1.00
    Metadata ratio:                   2.00
    Global reserve:               52.39MiB      (used: 0.00B)
    Multiple profiles:                  no

             Data     Metadata  System
Id Path      single   DUP       DUP      Unallocated
-- --------- -------- --------- -------- -----------
 1 /dev/sda1 25.01GiB   4.00GiB 16.00MiB   652.54GiB
-- --------- -------- --------- -------- -----------
   Total     25.01GiB   2.00GiB  8.00MiB   652.54GiB
   Used      17.91GiB 942.00MiB 16.00KiB
Disk Details:
 λ sudo smartctl -a /dev/sda
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.15.13-zen1-1-zen] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Scorpio Black (AF)
Device Model:     WDC WD7500BPKT-75PK4T0
Serial Number:    WD-WX91A61X8495
LU WWN Device Id: 5 0014ee 2b0b1c9a1
Firmware Version: 01.01A01
User Capacity:    750,156,374,016 bytes [750 GB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA8-ACS (minor revision not indicated)
SATA Version is:  SATA 2.6, 3.0 Gb/s
Local Time is:    Sat Jan  8 02:15:25 2022 IST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                                        was never started.
                                        Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever
                                        been run.
Total time to complete Offline
data collection:                (12780) seconds.
Offline data collection
capabilities:                    (0x7b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine
recommended polling time:        (   2) minutes.
Extended self-test routine
recommended polling time:        ( 127) minutes.
Conveyance self-test routine
recommended polling time:        (   5) minutes.
SCT capabilities:              (0x7035) SCT Status supported.
                                        SCT Feature Control supported.
                                        SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   200   200   051    Pre-fail  Always       -       2
  3 Spin_Up_Time            0x0027   183   171   021    Pre-fail  Always       -       1825
  4 Start_Stop_Count        0x0032   089   089   000    Old_age   Always       -       11402
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002e   200   200   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   032   032   000    Old_age   Always       -       49992
 10 Spin_Retry_Count        0x0032   100   100   000    Old_age   Always       -       0
 11 Calibration_Retry_Count 0x0032   100   100   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   091   091   000    Old_age   Always       -       9957
191 G-Sense_Error_Rate      0x0032   001   001   000    Old_age   Always       -       29244
192 Power-Off_Retract_Count 0x0032   199   199   000    Old_age   Always       -       889
193 Load_Cycle_Count        0x0032   095   095   000    Old_age   Always       -       316321
194 Temperature_Celsius     0x0022   106   082   000    Old_age   Always       -       41
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   100   253   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x0008   100   253   000    Old_age   Offline      -       0
240 Head_Flying_Hours       0x0032   038   038   000    Old_age   Always       -       45964
241 Total_LBAs_Written      0x0032   200   200   000    Old_age   Always       -       73256548706
242 Total_LBAs_Read         0x0032   200   200   000    Old_age   Always       -       72252938955
254 Free_Fall_Sensor        0x0032   001   001   000    Old_age   Always       -       921

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%     36808         -
# 2  Short offline       Completed without error       00%     23497         -
# 3  Short offline       Completed without error       00%         0         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

System Details:

inxi -Faz
System:
  Kernel: 5.15.13-zen1-1-zen x86_64 bits: 64 compiler: gcc v: 11.1.0
    parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
    root=UUID=0f591629-dac9-451a-b168-cf64c3e8cdbc rw [email protected]
    quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0
    resume=UUID=dc444f61-1cfe-4000-8498-14636d67d3e3 loglevel=3
  Desktop: GNOME 41.2 tk: GTK 3.24.31 wm: gnome-shell dm: GDM 41.0
    Distro: Garuda Linux base: Arch Linux
Machine:
  Type: Portable System: Dell product: Dell System XPS L702X v: N/A
    serial: <superuser required> Chassis: type: 8 v: 0.1
    serial: <superuser required>
  Mobo: Dell model: N/A v: FAB1 serial: <superuser required>
    UEFI-[Legacy]: Dell v: A19 date: 09/07/2012
Battery:
  ID-1: BAT0 charge: 0% condition: 2.0/57.7 Wh (3.5%) volts: 8.7 min: 11.1
    model: SANYO Dell type: Li-ion serial: <filter> status: N/A
CPU:
  Info: model: Intel Core i7-2630QM bits: 64 type: MT MCP arch: Sandy Bridge
    family: 6 model-id: 0x2A (42) stepping: 7 microcode: 0x2F
  Topology: cpus: 1x cores: 4 tpc: 2 threads: 8 smt: enabled cache:
    L1: 256 KiB desc: d-4x32 KiB; i-4x32 KiB L2: 1024 KiB desc: 4x256 KiB
    L3: 6 MiB desc: 1x6 MiB
  Speed (MHz): avg: 952 high: 1257 min/max: 800/2900 scaling:
    driver: intel_cpufreq governor: schedutil cores: 1: 828 2: 1257 3: 938
    4: 854 5: 866 6: 1081 7: 939 8: 859 bogomips: 31926
  Flags: avx ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  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: 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: Full generic retpoline, IBPB: conditional,
    IBRS_FW, STIBP: conditional, RSB filling
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel 2nd Generation Core Processor Family Integrated Graphics
    vendor: Dell driver: i915 v: kernel bus-ID: 00:02.0 chip-ID: 8086:0116
    class-ID: 0300
  Device-2: NVIDIA GF106M [GeForce GT 550M] vendor: Dell driver: nvidia
    v: 390.147 alternate: nouveau,nvidia_drm bus-ID: 01:00.0 chip-ID: 10de:0dd6
    class-ID: 0300
  Device-3: Quanta Laptop_Integrated_Webcam_2HDM type: USB driver: uvcvideo
    bus-ID: 1-1.4:3 chip-ID: 0408:2fb1 class-ID: 0e02
  Display: x11 server: X.Org 1.21.1.3 compositor: gnome-shell driver:
    loaded: intel display-ID: :1 screens: 1
  Screen-1: 0 s-res: 3520x1080 s-dpi: 96 s-size: 931x286mm (36.7x11.3")
    s-diag: 974mm (38.3")
  Monitor-1: LVDS1 res: 1600x900 hz: 60 dpi: 107
    size: 380x220mm (15.0x8.7") diag: 439mm (17.3")
  Monitor-2: VIRTUAL1 res: 1920x1080 hz: 60
  OpenGL: renderer: Mesa DRI Intel HD Graphics 3000 (SNB GT2)
    v: 3.3 Mesa 21.3.3 compat-v: 3.0 direct render: Yes
Audio:
  Device-1: Intel 6 Series/C200 Series Family High Definition Audio
    vendor: Dell driver: snd_hda_intel v: kernel bus-ID: 00:1b.0
    chip-ID: 8086:1c20 class-ID: 0403
  Device-2: NVIDIA GF106 High Definition Audio vendor: Dell
    driver: snd_hda_intel v: kernel bus-ID: 01:00.1 chip-ID: 10de:0be9
    class-ID: 0403
  Device-3: Philips s SAA7231 vendor: Avermedia driver: N/A bus-ID: 02:00.0
    chip-ID: 1131:7231 class-ID: 0480
  Sound Server-1: ALSA v: k5.15.13-zen1-1-zen running: yes
  Sound Server-2: JACK v: 1.9.19 running: no
  Sound Server-3: PulseAudio v: 15.0 running: no
  Sound Server-4: PipeWire v: 0.3.43 running: yes
Network:
  Device-1: Intel Centrino Wireless-N 1030 [Rainbow Peak] driver: iwlwifi
    v: kernel bus-ID: 03:00.0 chip-ID: 8086:008a class-ID: 0280
  IF: wlp3s0 state: down mac: <filter>
  Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Dell driver: r8169 v: kernel port: 2000 bus-ID: 0a:00.0
    chip-ID: 10ec:8168 class-ID: 0200
  IF: enp10s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
Bluetooth:
  Device-1: Intel Centrino Advanced-N 6230 Bluetooth adapter type: USB
    driver: btusb v: 0.8 bus-ID: 2-1.5:4 chip-ID: 8086:0189 class-ID: e001
  Report: bt-adapter ID: hci0 rfk-id: 1 state: up address: <filter>
Drives:
  Local Storage: total: 1.59 TiB used: 19.8 GiB (1.2%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/sda maj-min: 8:0 vendor: Western Digital
    model: WD7500BPKT-75PK4T0 size: 698.64 GiB block-size: physical: 4096 B
    logical: 512 B speed: 3.0 Gb/s type: HDD rpm: 7200 serial: <filter>
    rev: 1A01 scheme: MBR
  ID-2: /dev/sdb maj-min: 8:16 vendor: Samsung model: SSD 860 EVO 1TB
    size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
    type: SSD serial: <filter> rev: 2B6Q scheme: MBR
Partition:
  ID-1: / raw-size: 681.56 GiB size: 681.56 GiB (100.00%)
    used: 19.8 GiB (2.9%) fs: btrfs dev: /dev/sda1 maj-min: 8:1
  ID-2: /home raw-size: 681.56 GiB size: 681.56 GiB (100.00%)
    used: 19.8 GiB (2.9%) fs: btrfs dev: /dev/sda1 maj-min: 8:1
  ID-3: /var/log raw-size: 681.56 GiB size: 681.56 GiB (100.00%)
    used: 19.8 GiB (2.9%) fs: btrfs dev: /dev/sda1 maj-min: 8:1
  ID-4: /var/tmp raw-size: 681.56 GiB size: 681.56 GiB (100.00%)
    used: 19.8 GiB (2.9%) fs: btrfs dev: /dev/sda1 maj-min: 8:1
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
  ID-1: swap-1 type: zram size: 15.52 GiB used: 0 KiB (0.0%) priority: 100
    dev: /dev/zram0
  ID-2: swap-2 type: partition size: 17.07 GiB used: 0 KiB (0.0%)
    priority: -2 dev: /dev/sda2 maj-min: 8:2
Sensors:
  System Temperatures: cpu: 77.0 C mobo: 46.0 C sodimm: SODIMM C
  Fan Speeds (RPM): cpu: 3906
Info:
  Processes: 308 Uptime: 1h 14m wakeups: 1 Memory: 15.52 GiB
  used: 2.84 GiB (18.3%) Init: systemd v: 250 tool: systemctl Compilers:
  gcc: 11.1.0 Packages: pacman: 1328 lib: 360 Shell: fish v: 3.3.1
  running-in: tmux: inxi: 3.3.11

Before you open a new help request, read relevant sections of the Arch and Garuda wiki.
Thoroughly search your issue and any error messages in the forum and on the web.

Report everything you have already attempted to solve your problem.

What are you doing when you see this message?

If you're installing AUR packages using e.g. Pamac then it will be building in /tmp and you could be running out of space in the tmpfs filesystem (which will be 2GB in size by default).

2 Likes

jonathon: What are you doing when you see this message?

The system just freezes and I have to restart. For now, i deleted my entire initial configuration (~ 20 GB space ) since my system was behaving very slow.

------------------------------------------------------------------------------

I am using a HPC package manager spack which I believe, also uses /tmp directory for building applications. A typical application build size goes upto ~0.5 / 1 GB space. Building more complicated applications (is when i am getting the errors) can go upto ~3 / 5 GB.

You may be right about the /tmpfs

But, I tend to set /opt as the install location for the libs (usage ~ 20 GB)

I wanted to reclaim all unallocated space into the root folder /, to resolve the issue completely.

If the btrfs filesystem mounted at / is smaller than the partition it is in (and you want to expand the filesystem to take up the rest of the partition), use

sudo btrfs filesystem resize max /

It's one of those weird btrfs commands that goes by mountpoint instead of device name.

1 Like

This is not what I meant. I meant: what are you doing before the issue is triggered?

However, I think the cause is likely to be this:

Keep in mind that spack (and I do so very much hate that name) doesn't remove everything after it builds, so there will remain various files under /tmp. For example, a CUDA installer script I used recently will leave a copy of the CUDA installer in place for each run of the script.

This is not actually what you want to do, it's what you think you want to do. Here, "unallocated space" means the space is not used, that is, it is empty and available, and therefore can't be "reclaimed". (You could also check df -h to confirm the amount of free space, inaccurate as it may be due to BTRFS features).

Your issue lies elsewhere, for example running out of RAM.

It's also possible that your system is simply overheating:

In which case, clean fans and vents. Or, just do that anyway because your laptop is old. :grin:

4 Likes

Hi there, welcome to the community.

Unallocated space is the space that is not assigned to any partition. This means that you cannot use it in your currently installed filesystem, as you did not allocate storage to it.

Also post output of

lsblk

To get further help.

Are you sure?

On my system the "unallocated" space on my BTRFS partitions matches their "free" space.

Well, if there is unallocated space on partition table, then it is not allocated to any partition. I am pretty sure about this. At least in Gparted / parted and gnome-disk-utility naming convention.

But never heard unallocated space on BTRFS or any other partition. It is referred to as free space, in all the naming conventions I have heard before.

2 Likes

BTRFS is like entering a crazy dimension where your gas tank reads 1/2 empty and 3/4 full at the same time, (and both are correct). :rofl:

5 Likes

The lsblk output doesn't agree with that.

 λ lsblk /dev/sda
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0 698.6G  0 disk
├─sda1   8:1    0 681.6G  0 part /var/tmp
│                                /var/log
│                                /var/cache
│                                /srv
│                                /root
│                                /home
│                                /
└─sda2   8:2    0  17.1G  0 part [SWAP]

This does not explains the issue of no space left.

Looking at the df -h output, the /tmp has a size of ~8Gb. I Guess the right question would be
how do i increase the size of my /tmp directory

 λ df -h
Filesystem      Size  Used Avail Use% Mounted on
dev             7.8G     0  7.8G   0% /dev
run             7.8G  1.8M  7.8G   1% /run
/dev/sda1       682G   18G  662G   3% /
tmpfs           7.8G   59M  7.8G   1% /dev/shm
tmpfs           7.8G   12M  7.8G   1% /tmp
/dev/sda1       682G   18G  662G   3% /home
/dev/sda1       682G   18G  662G   3% /root
tmpfs           7.8G  416K  7.8G   1% /home/guest
/dev/sda1       682G   18G  662G   3% /srv
/dev/sda1       682G   18G  662G   3% /var/cache
/dev/sda1       682G   18G  662G   3% /var/log
/dev/sda1       682G   18G  662G   3% /var/tmp

I mean, by definition that's what it is. It has not been allocated for use. A filesystem on a partition table is assigned to a start and end point on the device. Anything outside of those bounds is not in play.

If you want to increase /tmp I believe you can just add it to your fstab and declare the size of it.

1 Like

I'm puzzled because it looks like you have tons of space left. It looks like your disk is mostly empty in fact. Even your /tmp directory that you are saying you want to be larger is 99% empty.

What is giving you the impression that you are running out of space?

What exactly is the error message you are getting? Can you copy/paste the output, or take a picture of the screen?

https://wiki.archlinux.org/title/Tmpfs#Examples

3 Likes