执行mount -o remount,rw /命令后无法正常启动且磁盘空间异常的问题求助
Hey there, let's break down what's probably going on here and get your system back up and running smoothly. That odd behavior where deleting files shrinks the total disk size but leaves available space stuck at zero is a classic clue—here are the most likely causes and fixes:
1. You might have run out of inodes (not just raw disk space)
Linux uses inodes to track file metadata, and even if you have free storage, if all inodes are used up, you can't create new files. This usually happens when you've got tons of tiny files (like cache entries, temporary logs, or mail queue files) cluttering up the system.
First, check your inode usage in recovery mode with this command:
df -i /Look at the
Use%column for inodes—if it's sitting at 100%, that's your culprit.To find which directories are hoarding all the inodes, run this to count files per top-level directory:
find / -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -nrHead into the directories with the highest counts (usually
/tmp,/var/cache, or/var/spool/mqueue) and delete any unnecessary tiny files. For example:rm -rf /tmp/*Just double-check you're not deleting anything critical before hitting enter!
2. Hidden mounts are hiding actual used space
Sometimes, if you mount another partition over an existing directory that already had files, those original files get "hidden" but still take up space. When you delete files from the mounted directory, you're only touching the new partition's files—not the hidden ones.
- Compare the output of these two commands to spot discrepancies:
Ifdf -h / # Shows the system's reported used space du -sh / # Calculates the actual space used by filesdushows way less space used thandf, you've got hidden mounts. Runmountto list all active mounts, then unmount non-essential ones (like/mnt/your-driveor/var/tmp) with:
After unmounting, you'll see the hidden files in the original directory—delete any you don't need.umount /mnt/your-drive
3. File system corruption is messing with space calculations
Your original mount command had a typo (mount -o remount,rw/, instead of mount -o remount,rw /), which could have triggered file system errors, leading to incorrect space reporting.
In recovery mode, run a file system check on your root partition. First, find your root partition device name with:
blkidLook for the partition labeled
/orroot(it'll look like/dev/sda1or/dev/nvme0n1p2).Then run the check (make sure the partition isn't mounted first, which it usually isn't in recovery mode):
fsck -y /dev/sda1The
-yflag auto-approves fixes—this should repair any corruption causing the wonky space stats.
4. Fix the mount command typo
Just to cover bases, make sure you're using the correct remount command if you need to re-enable read-write mode later:
mount -o remount,rw /
Once you've tried these steps, reboot your system and see if it boots normally. If you still run into issues, share the output of the commands you ran—I can help dig deeper!
备注:内容来源于stack exchange,提问作者DvdG

