Hi everyone,
I find myself having to administer a linux web proxy server, and I have hardly any knowledge of linux whatsoever. So far google has given me a huge helping hand, but I've come across a little problem I cannot get round, so I desperately need your help now.

When I try to modify a file with vi editor, I get the following errors
E297 Write error in swapfile
E303 Unable to open swapfile for "resolv.conf" (which is the file i'm trying to modify)

After googling the topic I realised that it might be a full disk issue, which would be quite likely analysing the circumsntances, but I was completely unable to check the free/used space in my disk.
df command only displays the headings to the columns, but nothing below. Nor do df -h or df -k.
df -a returns the following output:
Filesystem / 1K-blocks / Used / Available / Use% / Mounted on
proc / 0 / 0 / 0 / - / /proc

Distro is Slackware 9.1.0

How can I check the free space without the df command? Or how can I make df work?
Couldn't find anything on the topic.

Sorry if the thread is in the wrong category - appreciate if you move it to the right one. Just couldn't find a more suitable one.

Any help will be greatly appreciated !!!!

Thanks in advance

Lenni.

Dani AI

Generated

Brief expert addendum referencing this thread: 's symptoms (vi swapfile failures and a df that prints only headers) commonly stem from one of three causes — the kernel/utilities cannot read the mount table, the filesystem has exhausted usable blocks or inodes, or large files have been deleted but remain held open by running processes. was correct to look for oversized files; the commands below provide additional, low-risk ways to identify which condition applied and how to release space safely.

Useful checks (do these from a shell on the affected host):

cat /proc/mounts
stat -f /
find / -xdev -type f -size +100M -printf "%s\t%p\n" | sort -nr | head -n 20
lsof +L1
tune2fs -l /dev/sda1 | grep -i reserved

Notes on the checks:

  • /proc/mounts shows the kernel view of mounted filesystems (useful if /etc/mtab is stale or missing).
  • stat -f / reports block and inode counts for the filesystem containing / without using df.
  • The find line locates large files on the same filesystem; adjust size and path as needed.
  • lsof +L1 lists open files with link count < 1 (deleted-but-still-open files that continue to consume space); restarting the owning service releases that space.
  • tune2fs (ext2/3/4 only) shows reserved-block info; the reserved percentage can be reduced with caution (for example tune2fs -m 1 /dev/XXX), but confirm the device and backup critical data first.

Prevention and safety:
Use a separate partition or remote store for backups, enable rotation/compression, monitor free blocks and inodes (stat -f in a cron job or a standard monitoring tool), and avoid emergency deletes while services hold files open — consider a controlled service restart or using rescue media if the system cannot be safely altered online.

Can you list directories with ls -l or du? These will show space used. If you can find a large file you do not need, you can free up space. Most file systems will have space reserved for "root". If you have used that up you may have to boot with SystemRescueCD and delete files from there.

It can happen that you run out of space as you are trying to add stuff to a PC. There is almost certainly a solution. The rm command will remove files you do not need. You may also be able to clear out the /tmp directory. Boot to "single" and clear it out. cd /tmp;rm -fr [a-z]* will remove all files and directories in /tmp starting with "a" to "z".

Look for old .iso or useless backups and .tar or .tgz files in /root or your /home/user directory. Delete unneeded accounts and their /home directories. Empty caches that may be stale. Some packaging systems keep the downloads. Empty them. In apt, apt-get clean does it. I have not used RPM for years but there is probably a similar option. You may also be able to delete old /var/log/files.

With updates there may be some old kernels hanging around. If you find one you know you do not need, uninstall it.

Thanks a lot for your help !!
The server runs a daily backup and stores it in the disk, and the disk was full indeed. I removed a few thousands of tar backups and I got rid of the error to open files with vi.
The tip on how to use the rm command was really helpful!
Only after rebooting did df start to work again.
Cheers!
Lenni.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.