我的根驱动器有 143.9 GB 的空间。我有一个 60GB 的 vbox vdi 和操作系统,这应该又占了 30 GB... 还剩下 54GB 的可用空间。
问题:
今天早上,我随机收到根驱动器的“磁盘空间已满”错误消息。
我立即删除了几 GB 的旧日志...但是这些空间被吃掉(没有释放)并且仍然出现错误...
我无法找到 54GB 的磁盘空间。
这是:root@machine:/# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 4K 1 loop /snap/bare/5
loop1 7:1 0 9M 1 loop /snap/canonical-livepatch/146
loop2 7:2 0 114.9M 1 loop /snap/core/14056
loop3 7:3 0 8.9M 1 loop /snap/pdfmixtool/864
loop4 7:4 0 17.9M 1 loop /snap/pdftk/9
loop5 7:5 0 91.7M 1 loop /snap/gtk-common-themes/1535
loop6 7:6 0 55.6M 1 loop /snap/core18/2632
loop7 7:7 0 55.6M 1 loop /snap/core18/2620
loop8 7:8 0 260.7M 1 loop /snap/kde-frameworks-5-core18/32
loop9 7:9 0 115M 1 loop /snap/core/13886
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 95.9G 0 part
└─sda2 8:2 0 835.6G 0 part /home
sdb 8:16 0 1.8T 0 disk
└─sdb1 8:17 0 1.8T 0 part
└─luks-8b6272af-069d-4f00-9a33-57472f0aed47 253:0 0 1.8T 0 crypt /run/timeshift/340930/backup
nvme0n1 259:0 0 238.5G 0 disk
├─nvme0n1p1 259:1 0 100M 0 part /boot/efi
├─nvme0n1p2 259:2 0 16M 0 part
├─nvme0n1p3 259:3 0 100.7G 0 part
├─nvme0n1p4 259:4 0 1G 0 part
└─nvme0n1p5 259:5 0 136.7G 0 part /
这是root@machine:/# df -h
Filesystem Size Used Avail Use% Mounted on
udev 9.7G 0 9.7G 0% /dev
tmpfs 2.0G 35M 1.9G 2% /run
/dev/nvme0n1p5 135G 134G 0 100% /
tmpfs 9.7G 611M 9.1G 7% /dev/shm
tmpfs 5.0M 8.0K 5.0M 1% /run/lock
tmpfs 9.7G 0 9.7G 0% /sys/fs/cgroup
/dev/nvme0n1p1 96M 31M 66M 32% /boot/efi
/dev/sda2 822G 443G 338G 57% /home
/dev/loop0 128K 128K 0 100% /snap/bare/5
/dev/loop1 9.0M 9.0M 0 100% /snap/canonical-livepatch/146
/dev/loop2 115M 115M 0 100% /snap/core/14056
/dev/loop3 8.9M 8.9M 0 100% /snap/pdfmixtool/864
/dev/loop5 92M 92M 0 100% /snap/gtk-common-themes/1535
/dev/loop4 18M 18M 0 100% /snap/pdftk/9
/dev/loop6 56M 56M 0 100% /snap/core18/2632
/dev/loop7 56M 56M 0 100% /snap/core18/2620
/dev/loop8 261M 261M 0 100% /snap/kde-frameworks-5-core18/32
/dev/loop9 115M 115M 0 100% /snap/core/13886
tmpfs 2.0G 388K 2.0G 1% /run/user/1000
tmpfs 2.0G 20K 2.0G 1% /run/user/125
/dev/dm-0 1.8T 1.6T 192G 89% /media/user/WebMade
这root@machine:/# sudo bash -c 'du -xh / | sort -rhk 1 | head -n 50'
du: cannot access '/tmp/.mount_Nextcl0CMkgy': Permission denied
86G /
59G /root
58G /root/VDI-Files
16G /usr
11G /usr/lib
4.2G /usr/lib/modules
3.7G /var
3.7G /opt
3.1G /usr/share
2.8G /usr/lib/x86_64-linux-gnu
1.6G /var/log
1.5G /var/lib
1.2G /var/log/journal/989dbf66577645979de1e1ceab4cc143
1.2G /var/log/journal
897M /usr/lib/modules/5.15.0-53-generic
897M /usr/lib/modules/5.15.0-52-generic
896M /usr/lib/modules/5.15.0-46-generic
888M /usr/lib/modules/5.15.0-53-generic/kernel
888M /usr/lib/modules/5.15.0-52-generic/kernel
888M /usr/lib/modules/5.15.0-46-generic/kernel
874M /usr/lib/modules/5.15.0-43-generic
867M /usr/lib/modules/5.15.0-43-generic/kernel
861M /usr/src
847M /opt/baidunetdisk
746M /usr/bin
731M /var/lib/snapd
730M /var/lib/snapd/snaps
712M /usr/lib/firmware
683M /root/.config/VirtualBox
683M /root/.config
678M /usr/lib/i386-linux-gnu
638M /usr/share/atom
606M /opt/apps
528M /opt/deepinwine
525M /opt/deepinwine/runtime-i386
489M /boot
487M /opt/deepin-wine6-stable
484M /opt/deepinwine/runtime-i386/usr/lib
484M /opt/deepinwine/runtime-i386/usr
460M /opt/zoom
446M /usr/share/atom/resources
443M /usr/lib/x86_64-linux-gnu/wine-development
435M /usr/lib/modules/5.15.0-53-generic/kernel/nvidia-470
435M /usr/lib/modules/5.15.0-52-generic/kernel/nvidia-470
435M /usr/lib/modules/5.15.0-46-generic/kernel/nvidia-470
434M /usr/lib/modules/5.15.0-43-generic/kernel/nvidia-470
390M /usr/lib/modules/5.13.0-52-generic
387M /opt/deepinwine/runtime-i386/usr/lib/i386-linux-gnu
384M /usr/lib/modules/5.13.0-52-generic/kernel
373M /usr/lib/chromium
这是root@machine:/# tune2fs -l /dev/nvme0n1p5
tune2fs 1.45.5 (07-Jan-2020)
Filesystem volume name: <none>
Last mounted on: /
Filesystem UUID: 06ed954b-3750-49d3-b02d-43943788697f
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags: signed_directory_hash
Default mount options: user_xattr acl
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 8962048
Block count: 35840256
Reserved block count: 1792011
Free blocks: 11323026
Free inodes: 8420105
First block: 0
Block size: 4096
Fragment size: 4096
Group descriptor size: 64
Reserved GDT blocks: 1018
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8192
Inode blocks per group: 512
Flex block group size: 16
Filesystem created: Tue Jan 25 02:18:18 2022
Last mount time: Tue Nov 29 04:42:51 2022
Last write time: Tue Nov 29 04:42:50 2022
Mount count: 142
Maximum mount count: -1
Last checked: Fri Jul 29 15:02:27 2022
Check interval: 0 (<none>)
Lifetime writes: 5873 GB
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 256
Required extra isize: 32
Desired extra isize: 32
Journal inode: 8
First orphan inode: 3276903
Default directory hash: half_md4
Directory Hash Seed: 2fd3d5f1-ff71-4868-be52-17ed7551c56a
Journal backup: inode blocks
Checksum type: crc32c
Checksum: 0x9ad82476
这是root@machine:/home/user# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
udev 2522846 637 2522209 1% /dev
tmpfs 2532540 1315 2531225 1% /run
/dev/nvme0n1p5 8962048 650714 8311334 8% /
tmpfs 2532540 1322 2531218 1% /dev/shm
tmpfs 2532540 7 2532533 1% /run/lock
tmpfs 2532540 19 2532521 1% /sys/fs/cgroup
/dev/nvme0n1p1 0 0 0 - /boot/efi
/dev/sda2 54763520 910197 53853323 2% /home
/dev/loop0 29 29 0 100% /snap/bare/5
/dev/loop1 24 24 0 100% /snap/canonical-livepatch/146
/dev/loop2 12848 12848 0 100% /snap/core/14056
/dev/loop3 238 238 0 100% /snap/pdfmixtool/864
/dev/loop5 76208 76208 0 100% /snap/gtk-common-themes/1535
/dev/loop4 370 370 0 100% /snap/pdftk/9
/dev/loop6 10873 10873 0 100% /snap/core18/2632
/dev/loop7 10873 10873 0 100% /snap/core18/2620
/dev/loop8 35005 35005 0 100% /snap/kde-frameworks-5-core18/32
/dev/loop9 12845 12845 0 100% /snap/core/13886
tmpfs 2532540 166 2532374 1% /run/user/1000
tmpfs 2532540 45 2532495 1% /run/user/125
/dev/dm-0 122093568 2735363 119358205 3% /media/user/WebMade
这是root@machine:/home/user# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/nvme0n1p5 during installation
UUID=06ed954b-3750-49d3-b02d-43943788697f / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=1C0E-0739 /boot/efi vfat umask=0077 0 1
# swap was on /dev/nvme0n1p6 during installation
#UUID=5fc4b948-a7d5-454c-a0d8-7160f260d09f none swap sw 0 0
#DP Edits: Move Home to partition
UUID=b659bc0b-8105-4e5f-8402-89208c74620c /home ext4 defaults 0 2
#DP Edits: 4GB swapfile
/swapfile none swap sw 0 0
更多输出
我启动了 LiveUSB 来检查我的磁盘是否有坏块并进行修复...什么也没发现...但我的所有空间都已被使用:
root@ubuntu:/dev# e2fsck -fc /dev/nvme0n1p5
e2fsck 1.45.5 (07-Jan-2020)
Checking for bad blocks (read-only test): 0.00% done, 0:00 elapsed. (0/0/0 errdone
/dev/nvme0n1p5: Updating bad block inode.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/nvme0n1p5: ***** FILE SYSTEM WAS MODIFIED *****
/dev/nvme0n1p5: 650571/8962048 files (1.7% non-contiguous), 35823756/35840256 blocks
root@ubuntu:/dev# e2fsck -vfcp /dev/nvme0n1p5
/dev/nvme0n1p5: Updating bad block inode.
650571 inodes used (7.26%, out of 8962048)
10434 non-contiguous files (1.6%)
903 non-contiguous directories (0.1%)
# of inodes with ind/dind/tind blocks: 0/0/0
Extent depth histogram: 603342/1743
35823756 blocks used (99.95%, out of 35840256)
0 bad blocks
3 large files
525726 regular files
74110 directories
10 character device files
1 block device file
0 fifos
74 links
50668 symbolic links (45420 fast symbolic links)
47 sockets
------------
650636 files
有人知道如何恢复我的 54GB 空间吗?
答案1
我发现问题了……又一个“幽灵坐骑”……
我启动 LiveUSB 会话并运行上述命令来检查我的磁盘...所有命令都表示磁盘“正常”但已满。
在 liveUSB 会话中,我通过 nautilus 挂载了我的磁盘,但在终端中我再次运行
root@ubuntu:/dev# du -xh /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f | sort -rhk 1 | head -n 100
(作为我在 liveUSB 会话中的06ed954b-3750-49d3-b02d-43943788697f
挂载根分区。/
这次它表明root@ubuntu:/dev# du -xh /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f | sort -rhk 1 | head -n 100
86G /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f
59G /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f/root
58G /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f/root/VDI-Files
49G /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f/media/user/external_drive
16G /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f/usr
11G /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f/usr/lib
4.2G /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f/usr/lib/modules
3.7G /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f/var
3.7G /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f/opt
3.1G /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f/usr/share
2.8G /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f/usr/lib/x86_64-linux-gnu
1.7G /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f/var/log
1.5G /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f/var/lib
1.2G /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f/var/log/journal/989dbf66577645979de1e1ceab4cc143
1.2G /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f/var/log/journal
这49G /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f/media/user/external_drive
是不可能的,因为我没有在 liveUSB 会话期间安装它。
所以我rm -rf /media/ubuntu/06ed954b-3750-49d3-b02d-43943788697f/media/user/external_drive
然后瞧!
我又获得了 49GB 的空间,终于可以完成一些真正的工作了。
因此,在非推荐的硬重启后,似乎可能出现两种类型的“幽灵挂载”。
我遇到的“路径错误”ghost mount这里,现在是“磁盘空间”幽灵挂载(注意,我的脚本都没有出问题,因为即使存在“幽灵挂载”,作为普通用户和 root 用户,我的外部驱动器的路径都是正确的)
在 liveUSB 会话中,gparted 和其他应用程序现在确认我的可用磁盘空间。