我最近在 240 GB 的 SSD 上安装了 Ubuntu 22.04,使用几天后,我收到磁盘空间不足警报。经过一番调查,我发现根文件系统/
仅使用了 25 GB。
root@my-computer:/var/lib/snapd/cache# df /dev/sda2
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 26200532 22271844 2552420 90% /
root@my-computer:/var/lib/snapd/cache# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 4K 1 loop /snap/bare/5
loop1 7:1 0 55.6M 1 loop /snap/core18/2751
loop2 7:2 0 55.7M 1 loop /snap/core18/2785
loop3 7:3 0 63.4M 1 loop /snap/core20/1950
loop4 7:4 0 63.4M 1 loop /snap/core20/1974
loop5 7:5 0 73.8M 1 loop /snap/core22/750
loop6 7:6 0 73.9M 1 loop /snap/core22/766
loop7 7:7 0 244.5M 1 loop /snap/firefox/2800
loop8 7:8 0 245M 1 loop /snap/firefox/2850
loop9 7:9 0 346.3M 1 loop /snap/gnome-3-38-2004/119
loop10 7:10 0 349.7M 1 loop /snap/gnome-3-38-2004/140
loop11 7:11 0 466.5M 1 loop /snap/gnome-42-2204/111
loop12 7:12 0 485.5M 1 loop /snap/gnome-42-2204/120
loop13 7:13 0 81.3M 1 loop /snap/gtk-common-themes/1534
loop14 7:14 0 91.7M 1 loop /snap/gtk-common-themes/1535
loop15 7:15 0 45.9M 1 loop /snap/snap-store/599
loop16 7:16 0 12.3M 1 loop /snap/snap-store/959
loop17 7:17 0 53.3M 1 loop /snap/snapd/19361
loop18 7:18 0 53.3M 1 loop /snap/snapd/19457
loop19 7:19 0 284K 1 loop /snap/snapd-desktop-integration/14
loop20 7:20 0 452K 1 loop /snap/snapd-desktop-integration/83
loop21 7:21 0 295.7M 1 loop /snap/vlc/2344
loop22 7:22 0 320.4M 1 loop /snap/vlc/3078
sda 8:0 0 223.6G 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
└─sda2 8:2 0 223.1G 0 part /
root@my-computer:/var/lib/snapd/cache# df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 1.6G 2.1M 1.6G 1% /run
/dev/sda2 25G 22G 2.5G 90% /
tmpfs 7.7G 0 7.7G 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
/dev/sda1 511M 54M 458M 11% /boot/efi
tmpfs 1.6G 108K 1.6G 1% /run/user/1000
我已经经历过了此主题df
这解释了和之间 1000 与 1024 的计算差异lsblk
,我不认为这是这里的问题。
更新 添加更精细的细节,
user@my-computer:~$ sudo parted -l
Model: ATA CT240BX500SSD1 (scsi)
Disk /dev/sda: 240GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 538MB 537MB fat32 EFI System Partition boot, esp
2 538MB 240GB 240GB ext4
user@my-computer:~$ lsblk -e 7 -o name,fstype,size,fsused,label,partlabel,mountpoint,parttype
NAME FSTYPE SIZE FSUSED LABEL PARTLABEL MOUNTPOINT PARTTYPE
sda 223.6G
├─sda1 vfat 512M 53.1M EFI System Partition /boot/efi c12a7328-f81f-11d2-ba4b-00a0c93ec93b
└─sda2 ext4 223.1G 21.4G / 0fc63daf-8483-4772-8e79-3d69d8477de4
答案1
看起来您的分区是 240GB,但您的文件系统认为它更小。
对于您的情况,只需运行它sudo resize2fs /dev/sda2
,它就会增长到适合分区的大小。无需重新启动。