Ubuntu磁盘空间显示异常求助:Disk Usage Analyzer与lsblk结果不一致
Hey there! Let's tackle this confusing disk space mismatch you're seeing. You've got a 500GB SSD, but Disk Usage Analyzer is only showing 141.9GB, while lsblk correctly recognizes the full size. Let's start by looking at the command outputs you shared:
df -h Results
Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur tmpfs 1,5G 26M 1,5G 2% /run /dev/nvme0n1p2 468G 433G 12G 98% / tmpfs 7,5G 78M 7,4G 2% /dev/shm tmpfs 5,0M 12K 5,0M 1% /run/lock efivarfs 128K 23K 101K 19% /sys/firmware/efi/efivars /dev/nvme0n1p1 1,1G 6,2M 1,1G 1% /boot/efi tmpfs 1,5G 140K 1,5G 1% /run/user/1000
lsblk Results
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS loop0 7:0 0 4K 1 loop /snap/bare/5 loop1 7:1 0 98,1M 1 loop /snap/bitwarden/120 loop2 7:2 0 35,2M 1 loop /snap/cheese/40 loop3 7:3 0 55,7M 1 loop /snap/core18/2829 loop4 7:4 0 55,4M 1 loop /snap/core18/2846 loop5 ...
First off, notice that df -h shows your main root partition (/dev/nvme0n1p2) is actually 468GB total (which makes sense for a 500GB SSD, accounting for the EFI partition and filesystem overhead) and it's 98% full. That means the Disk Usage Analyzer is probably missing a lot of space usage—here's how to fix that:
- Refresh Disk Usage Analyzer's data: Sometimes the tool caches outdated info. Close it completely, run
sudo updatedbin the terminal to refresh the system's file index, then reopen the analyzer and rescan your disk. - Show hidden/system files: By default, Disk Usage Analyzer might not display protected system files or hidden folders. Head to its settings (look for a menu icon in the top-right corner) and enable options to show these files. This will reveal space used by directories like
/root,/var, or hidden folders in your home directory. - Identify space-hogging directories: Use the command
sudo du -h / --max-depth=1to list the size of every top-level folder. This will quickly tell you which directory is eating up most of that 433GB used space. For example:- If
/varis huge, clean old logs in/var/logor clear package caches withsudo apt clean && sudo apt autoremove. - If your home directory is the culprit, check for large downloads, unused apps, or backup files you no longer need.
- If
- Check for filesystem errors: Corruption can cause incorrect space reporting. Boot into Ubuntu's recovery mode, select the
fsckoption to check and repair your root partition (you'll need to unmount it first if prompted). - Verify no partitions are unmounted: While
lsblkshows your main partition is mounted at/, double-check that no other partitions on the SSD are unmounted—Disk Usage Analyzer won't scan drives that aren't mounted.
Chances are the 141.9GB the analyzer showed was only your user-facing files, not the entire system. Enabling hidden/system file viewing should resolve that mismatch right away.
备注:内容来源于stack exchange,提问作者Hrodwolf

