Ubuntu Server 20.04.5 LTS根文件系统需手动执行fsck问题排查求助
Ubuntu Server 20.04.5 LTS根文件系统需手动执行fsck问题排查求助
Hey there, let's break down the possible causes and troubleshooting steps for this frustrating issue you're facing with your Ubuntu server:
Common Root Causes
- Unresolved File System Corruption: The occasional read-only mode your system enters is a red flag—this usually happens when the OS detects potential file system damage and switches to read-only to prevent further data loss. If automatic repair during boot fails, it prompts for manual
fsck. This is often triggered by unexpected shutdowns (like power outages), process crashes that leave file system metadata inconsistent, or incomplete writes. - Storage Hardware Issues: This is one of the most frequent culprits. Faulty hard drives (mechanical or SSD) with bad sectors, failing RAID components, or degraded storage can cause file system errors. The OS will remount the drive as read-only to protect data, and on reboot, it can't fix the damage automatically.
- LVM Configuration Problems: Since your root filesystem is on an LVM volume (
/dev/mapper/ubuntu--vg-ubuntu--lv), issues with physical volume metadata, logical volume corruption, or misconfigured snapshots (if you use them) could lead to this boot-time fsck prompt. - Fstab Misconfiguration: While less likely, incorrect mount options in
/etc/fstabfor your root partition might prevent automatic repair. For example, missing theerrors=remount-rooption or incorrect fsck order values (the last number in the fstab entry should be1for root). - Memory Issues: Faulty RAM or insufficient memory can cause corrupted file system cache writes, leading to filesystem damage over time.
Troubleshooting Steps
- Check Hardware Health:
- Run
smartctl -a /dev/sdX(replace/dev/sdXwith your actual disk device, e.g.,/dev/sda) to view SMART data. Look for warnings in metrics likeReallocated_Sector_Ct,Current_Pending_Sector, or for SSDs,Percentage_Used—these indicate hardware degradation.
- Run
- Inspect LVM Status:
- Execute
vgscanandlvscanto verify your volume groups and logical volumes are active with no errors. - Run a read-only file system check first (to avoid accidental changes) with
e2fsck -n /dev/mapper/ubuntu--vg-ubuntu--lv—this will show you the specific errors that need fixing.
- Execute
- Review System Logs:
- After a reboot, check
/var/log/syslogor usedmesgto look for error messages related to your disk, LVM, or file system. Look for keywords likeI/O error,mount failed, orfsck failed—these will give you detailed clues about what's going wrong.
- After a reboot, check
- Verify Fstab Settings:
- Open
/etc/fstaband confirm your root partition entry looks something like this:/dev/mapper/ubuntu--vg-ubuntu--lv / ext4 errors=remount-ro 0 1 - Ensure the last number (fsck order) is
1(meaning it's checked first on boot).
- Open
- Check Memory Health:
- Use
memtester(install withsudo apt install memtester) to run a memory test, or checkmceloglogs for hardware-related memory errors.
- Use
If you find specific errors during these checks, you can narrow down the fix—for example, replacing a failing drive, repairing LVM metadata, or correcting fstab entries.
备注:内容来源于stack exchange,提问作者El3ctro4ndre
相关产品推荐
相关产品推荐

