Btrfs 和缺乏可用磁盘空间

Btrfs 和缺乏可用磁盘空间

下午好!

我正在通过写入文件,rsync并且有足够的可用磁盘空间,但我正在使用 btrfs,btrfs 显示可用空间已用完。您能告诉我如何处理这种情况吗?我删除了不必要的文件,但没有帮助。

您能告诉我如何让系统再次运行吗?从 du 实用程序的输出来看,我应该还有大约 150 GB 的空间。

附加信息:

❯ df -h | grep "sda"
/dev/sda4          515G         513G  5,6M          100% /
/dev/sda4          515G         513G  5,6M          100% /var/log
/dev/sda4          515G         513G  5,6M          100% /home
/dev/sda4          515G         513G  5,6M          100% /var/cache
/dev/sda1          996M         1,5M  995M            1% /boot/efi

❯ mount | egrep "sda"
/dev/sda4 on / type btrfs (rw,noatime,compress=zstd:3,space_cache,autodefrag,subvolid=815,subvol=/@)
/dev/sda4 on /var/log type btrfs (rw,noatime,compress=zstd:3,space_cache,autodefrag,subvolid=260,subvol=/@log)
/dev/sda4 on /home type btrfs (rw,noatime,compress=zstd:3,space_cache,autodefrag,subvolid=814,subvol=/@home)
/dev/sda4 on /var/cache type btrfs (rw,noatime,compress=zstd:3,space_cache,autodefrag,subvolid=259,subvol=/@cache)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)

[root@localhost]# du -sh / 2> /dev/null
346G    /

[root@localhost]# btrfs fi df /
Data, single: total=506.52GiB, used=506.51GiB
System, DUP: total=8.00MiB, used=80.00KiB
Metadata, DUP: total=4.00GiB, used=2.71GiB
GlobalReserve, single: total=512.00MiB, used=0.00B

[root@localhost]# btrfs fi usage /
Overall:
    Device size:         514.53GiB
    Device allocated:        514.53GiB
    Device unallocated:        1.03MiB
    Device missing:          0.00B
    Used:            511.92GiB
    Free (estimated):          5.31MiB  (min: 5.31MiB)
    Free (statfs, df):         5.31MiB
    Data ratio:               1.00
    Metadata ratio:           2.00
    Global reserve:      512.00MiB  (used: 0.00B)
    Multiple profiles:              no

Data,single: Size:506.52GiB, Used:506.51GiB (100.00%)
   /dev/sda4     506.52GiB

Metadata,DUP: Size:4.00GiB, Used:2.71GiB (67.64%)
   /dev/sda4       8.00GiB

System,DUP: Size:8.00MiB, Used:80.00KiB (0.98%)
   /dev/sda4      16.00MiB

Unallocated:
   /dev/sda4       1.03MiB

更新:

[root@localhost]# echo "     Total   Exclusive  Set shared  Filename"; find . -maxdepth 1 -type d | grep './' | xargs -I{} btrfs filesystem du -s {} 2> /dev/null | grep -v 'Total'
     Total   Exclusive  Set shared  Filename
 266.01GiB    67.92GiB   189.58GiB  ./home
  64.89GiB     7.96GiB    56.93GiB  ./var
 111.59MiB    34.20MiB    77.39MiB  ./boot
   6.76MiB     2.52MiB     3.79MiB  ./etc
     0.00B       0.00B       0.00B  ./mnt
   1.06GiB   113.59MiB   582.69MiB  ./opt
     0.00B       0.00B       0.00B  ./srv
   8.77GiB     5.28GiB     2.34GiB  ./usr

[root@localhost]# btrfs subvolume list -t --sort=path /
ID  gen top level   path    
--  --- ---------   ----    
815 235310  5       @
259 235014  5       @cache
814 235315  5       @home
260 235315  5       @log
450 233611  5       timeshift-btrfs/snapshots/2021-10-18_19-59-20/@
451 5639    5       timeshift-btrfs/snapshots/2021-10-18_19-59-20/@home
536 233611  5       timeshift-btrfs/snapshots/2021-11-23_22-48-30/@
537 13984   5       timeshift-btrfs/snapshots/2021-11-23_22-48-30/@home
545 233611  5       timeshift-btrfs/snapshots/2021-12-12_18-12-40/@
546 17778   5       timeshift-btrfs/snapshots/2021-12-12_18-12-40/@home
257 233611  5       timeshift-btrfs/snapshots/2022-05-02_13-10-31/@
258 229392  5       timeshift-btrfs/snapshots/2022-05-02_13-10-31/@home
894 233611  5       timeshift-btrfs/snapshots/2022-06-08_20-38-08/@
895 215821  5       timeshift-btrfs/snapshots/2022-06-08_20-38-08/@home
896 233611  5       timeshift-btrfs/snapshots/2022-06-08_21-09-00/@
897 215918  5       timeshift-btrfs/snapshots/2022-06-08_21-09-00/@home
923 233611  5       timeshift-btrfs/snapshots/2022-06-28_19-06-50/@
924 229388  5       timeshift-btrfs/snapshots/2022-06-28_19-06-50/@home

[root@localhost]# timeshift --list
Mounted '/dev/sda4' at '/run/timeshift/3351/backup'
Device : /dev/sda4
UUID   : d0a8bc03-a8d9-470e-8868-ec49b1d4f9dc
Path   : /run/timeshift/3351/backup
Mode   : BTRFS
Status : OK
7 snapshots, 2.3 GB free

Num     Name                 Tags  Description    
------------------------------------------------------------------------------
0    >  2021-10-18_19-59-20  O     {timeshift-autosnap} {created before upgrade}     
1    >  2021-11-23_22-48-30  O     {timeshift-autosnap} {created before upgrade}
2    >  2021-12-12_18-12-40  O     {timeshift-autosnap} {created before upgrade}
3    >  2022-05-02_13-10-31  O     {timeshift-autosnap} {created before upgrade}
4    >  2022-06-08_20-38-08  O     {timeshift-autosnap} {created before upgrade}    
5    >  2022-06-08_21-09-00  O     {timeshift-autosnap} {created before upgrade}    
6    >  2022-06-28_19-06-50  O     {timeshift-autosnap} {created before upgrade}    


Found stale mount for device '/dev/sda4' at path '/run/timeshift/3351/backup'
Unmounted successfully

22 年 7 月 17 日更新:

在此输入图像描述

[root@localhost]# btrfs filesystem du -s / 2> /dev/null
     Total   Exclusive  Set shared  Filename
 340.59GiB    81.30GiB   249.14GiB  /

我如何知道 511.92GiB 由什么组成?

[root@localhost]# btrfs fi usage /
Overall:
    Device size:         514.53GiB
    Device allocated:        514.53GiB
    Device unallocated:        1.03MiB
    Device missing:          0.00B
    Used:            511.92GiB

编辑 22 年 7 月 23 日:

我删除了一些时移快照后,使用的磁盘空间减少,现在显示以下数据:

% # df -h | grep '/dev/s'
/dev/sda4          515G         393G  118G           77% /
tmpfs              7,8G          22M  7,8G            1% /dev/shm
/dev/sda4          515G         393G  118G           77% /var/cache
/dev/sda4          515G         393G  118G           77% /var/log
/dev/sda4          515G         393G  118G           77% /home
/dev/sda1          996M         1,5M  995M            1% /boot/efi
/dev/sda4          515G         393G  118G           77% /mnt/sda4

% btrfs filesystem df -h /
Data, single: total=439.01GiB, used=388.90GiB
System, DUP: total=8.00MiB, used=80.00KiB
Metadata, DUP: total=4.00GiB, used=1.49GiB
GlobalReserve, single: total=512.00MiB, used=0.00B

% mkdir /mnt/sda4 && mount -o subvol=/ /dev/sda4 /mnt/sda4 && btdu /mnt/sda4
--- /<SINGLE>/<DATA> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  ~572.9 KiB [          ]  <NO_INODE>
  ~111.2 MiB [          ] /<ROOT_TREE>
   ~50.1 GiB [#         ]  <SLACK>
   ~18.4 GiB [          ] /<UNREACHABLE>
   ~62.7 GiB [##        ] /@
   ~6.26 GiB [          ] /@cache
  ~284.5 GiB [##########] /@home
  ~480.8 MiB [          ] /@log
   ~16.4 GiB [          ] /timeshift-btrfs

--- Details: ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Full path: /mnt/sda4
- Average query duration: 0.0003639 seconds
- Represented size: ~439.0 GiB (68296505 samples), ±10.1 MiB
- Logical offsets: ..., 485646549606, 442831113925, 525544520914

--- Explanation:
This node holds samples from chunks in the DATA block group, which mostly contains file data.

一般来说,删除一些快照会有所帮助,之后时移显示繁忙的磁盘空间。附上截图: 在此输入图像描述

很遗憾,雙方位没有回答 388 Gb 占用磁盘空间由什么组成的问题,如上面的结论所示:

--- /<SINGLE>/<DATA> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  ~572.9 KiB [          ]  <NO_INODE>
  ~111.2 MiB [          ] /<ROOT_TREE>
   ~50.1 GiB [#         ]  <SLACK>
   ~18.4 GiB [          ] /<UNREACHABLE>
   ~62.7 GiB [##        ] /@
   ~6.26 GiB [          ] /@cache
  ~284.5 GiB [##########] /@home
  ~480.8 MiB [          ] /@log
   ~16.4 GiB [          ] /timeshift-btrfs

--- Details: ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Full path: /mnt/sda4
- Average query duration: 0.0003639 seconds
- Represented size: ~439.0 GiB (68296505 samples), ±10.1 MiB
- Logical offsets: ..., 485646549606, 442831113925, 525544520914

% echo "62.7+6.26+284.5+0.48+16.4"|bc
370.34

也许问题在于雙方位给出近似结果?我没等程序结束就跑了几分钟。

答案1

雙方位是一个有用的工具,可以直观地显示您的 btrfs 空间的使用情况:

--- /RAID0/DATA -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ~1.5 GiB [          ] /<ERROR>
   ~20.7 MiB [          ] /<UNREACHABLE>
   ~76.4 GiB [          ] /Something
    ~1.0 TiB [##        ] /Something else
  ~273.9 GiB [          ] /Nothing
  ~154.9 MiB [          ] /Private
    ~4.7 TiB [##########] /Linux ISOs
  ~173.9 GiB [          ] /Snapshots                                                                                                                                                                                   
   ~31.8 GiB [          ] /tmp

--- Details: ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Full path: /mnt/data
- Average query duration: 0.0004393 seconds
- Represented size: ~6.3 TiB (1929378 samples), ±539.9 MiB
- Logical offsets: ..., 5037530244057, 1797729456912, 5371666300696

--- Explanation:
This node holds samples from chunks in the DATA block group, which mostly contains file data.

您的空间可能已在这些快照中使用。删除一些较旧的文件以释放此后删除的文件的空间。

相关内容