How to Diagnose and Fix Disk‑Full, Read‑Only, and Inode Issues on Linux
This guide explains why Linux systems report "no space left on device" or read‑only file systems, shows how to inspect disk usage, inodes, and hardware health with commands like df, du, mount, smartctl, hddtemp, and provides step‑by‑step remediation techniques such as cleaning files, compressing logs, remounting, and repairing filesystems.
1. No space left on device
When a UNIX‑like system runs out of disk space, commands such as fallocate -l 1G test4.img fail with the error "No space left on device". Use df -h to view total and available space for each mounted filesystem.
# fallocate -l 1G test4.img
fallocate: test4.img: No space left on device
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 117G 54G 57G 49% /
... (other partitions) ...Fixing a full disk
Compress logs or large files with gzip /ftpusers/tmp/*.log or bzip2 /ftpusers/tmp/large.file.name.
Delete unwanted files using rm -rf /ftpusers/tmp/*.bmp.
Move files to another system or external drive with
rsync --remove-source-files -azv /ftpusers/tmp/*.mov /mnt/usbdisk/.
Find the biggest directories or files: du -a /ftpusers/tmp | sort -nr | head -n 10 or du -cks *.
Truncate large log files: truncate -s 0 /ftpusers/ftp.upload.log.
Identify and delete deleted but still open files using lsof -nP | grep '(deleted)' or find /proc/*/fd -ls | grep '(deleted)'.
2. Filesystem is read‑only
If creating or saving a file yields "Read‑only file system", check the mount options with mount. Remount the filesystem as read‑write:
# mount -o remount,rw /ftpusers/tmpOn FreeBSD, remount the root filesystem with mount -o rw /dev/ad0s1a /. If the read‑only state is caused by hardware failure, replace the drive instead of forcing a write‑able mount.
3. Running out of inodes
Even when df -h shows free space, the filesystem may be out of inodes. Check inode usage with df -i:
$ df -i /ftpusers
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda8 6250496 11568 6238928 1% /ftpusersIf inode usage reaches 100%, delete unnecessary small files or combine them into larger archives, or repartition with a higher inode count.
4. Disk health monitoring
Use smartctl -a /dev/sda to view SMART data and detect hardware errors. The hddtemp utility can report drive temperature:
$ hddtemp /dev/sda
/dev/sda: 35°CExample output from smartctl -d ata -A /dev/sda filtered for temperature:
# smartctl -d ata -A /dev/sda | grep -i temperature
...CPU temperature
Install lm-sensors and run sensors to see CPU core temperatures.
5. Repairing a corrupted filesystem
Unmount the affected partition and run fsck -y /dev/sda8 to fix errors.
6. Managing Linux software RAID (mdadm)
Check RAID status with mdadm --detail /dev/md0 or cat /proc/mdstat. To replace a failed drive:
# mdadm --manage /dev/md0 --fail /dev/sdb1
# mdadm --manage /dev/md0 --remove /dev/sdb1
# sfdisk -d /dev/sda | sfdisk /dev/sdb
# mdadm --manage /dev/md0 --add /dev/sdb1Monitor synchronization progress with watch cat /proc/mdstat.
7. Managing hardware RAID controllers
Use vendor‑specific tools such as smartctl -d scsi --all /dev/sgX, /usr/StorMan/arcconf getconfig 1, or tw_cli /c0 show to query and replace failed disks.
Conclusion
These tips help resolve common disk‑related problems on Linux/UNIX servers, from full filesystems and read‑only mounts to inode exhaustion and hardware failures. Implement regular backups and monitoring to recover from disk failures, accidental deletions, or catastrophic system loss.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
