Tag Info

Hot answers tagged

62

Deleting the filename doesn't actually delete the file. Some other process is holding the file open, causing it to not be deleted; restart or kill that process to release the file.


54

This is a common interview question and a situation that comes up in a variety of production environments. The file's directory entries have been deleted, but the logging process is still running. The space won't be reclaimed by the operating system until all file handles have been closed (e.g., the process has been killed) and all directory entries ...


41

stop the VM run qemu-img resize vmdisk.img +10G to increase image size by 10Gb start the VM, resize the partitions and LVM structure within it normally


40

Check for files on located under mount points. Frequently if you mount a directory (say a sambafs) onto a filesystem that already had a file or directories under it, you lose the ability to see those files, but they're still consuming space on the underlying disk. I've had file copies while in single user mode dump files into directories that I couldn't ...


24

Try: $ lsof +L1 This will find files that have a link count less than 1 (files removed but still beeing written to). For those times when du and df don't match up.


22

You may want to try the ncdu utility found at: http://dev.yorhel.nl/ncdu It will quicky sum the contents of a filesystem or directory tree and print the results, sorted by size. It's a really nice way to drill-down interactively and see what's consuming drive space. Additionally, it can be faster than some du combinations. The typical output looks like: ...


22

Our solution was a pit painful. One of our partner organizations (k12 education) was hit by discovery request in a lawsuit (FOIA). The costs to sort through the tons of email and redact the secret bits was huge (~$100k) because of how much email was saved that may have match the request. Our lawyers suggested, and our Superintendent put into place a ...


21

Surely there are more elaborate ways, but the one I remember is du --max-depth=1 -h / Now take the directory that uses up most space (du --max-depth=1 -h /yourdir) and go deeper until you find your culprit. If want your output sorted by size and don't care for the human-readable format, you could also do du --max-depth=1 /your_dir | sort -n


21

One simple way to get Windows Server 2008 to send low disk space e-mail alerts is to use Task Scheduler and the System Log. If the free space falls below the percentage specified in HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\DiskSpaceThreshold, an event is recorded in the System Log that can trigger a task to send an e-mail message. ...


18

Proper design I assume you are unable to simply extend the filesystem in question (using lvextend && ext2online), because you do not use LVM or use wrong filesystem type. Your approach What you've proposed might work if you signal the daemons with SIGHUP (kill -1 pid). Obviously you would need to later on "mount -o bind / /somewhere" and clean up ...


15

You generally want to leave about 10% free to avoid fragmentation, but there is a catch. Linux, by default, will reserve 5% of the disk for the root user. When you use 'df', the output doesn't include that 5% if you run it as a non-root user. Just something to keep in mind when doing your calulations. Incidentally, you can change the root reserve by ...


14

You can see the 10 largest directories with: du -cks *|sort -rn|head This will recursively add up the sizes of everything in each directory - but you would have to manually execute it at each level to get a breakdown of what's in each


14

Just stumbled on this page when trying to track down an issue on a local server. In my case the df -h and du -sh mismatched by about 50% of the hard disk size. This was caused by apache (httpd) keeping large log files in memory which had been deleted from disk. This was tracked down by running lsof | grep "/var" | grep deleted where /var was the partition ...


14

The most error-proof solution is to make the mount point unwritable. This would be your solution #3. However there is one additional step you should perform. chattr +i /mnt/backups. This is because even with no permissions, root would still be able to write to the directory. With chattr +i (sets immutable flag) not even root can write to it. Once the mount ...


14

There's still another link to the file (either hard link or open file handle). Deleting a file only deletes the directory entry; the file data and inode hang around until the last reference to it has been removed. It's somewhat common practice for a service to create a temporary file and immediately delete it while keeping the file open. This creates a file ...


13

See what 'df -i' says. It could be that you are out of inodes, which might happen if there are a large number of small files in that filesystem, which uses up all the available inodes without consuming all the available space.


13

I use this one a lot. du -kscx * It can take a while to run, but it'll tell you where the disk space is being used.


13

Use the mysqldump utility to direct the file wherever you like: mysqldump -A -u[username] -p[password] > /path/to/dest/backupname.sql If you need to, you can pipe the output through gzip: mysqldump -A -u[username] -p[password] | gzip -c > /path/to/dest/backupname.gz Further, you can send the output from gzip to another server via ssh: mysqldump ...


13

Here's my standard "find what's eating the space" regime: du -hx --max-depth=1 / -- look for what's eating the space. Examine the largest subdirectory (say du -hx --max-depth=1 /var) until you find some space hogs. Logs (in /var/log) are common culprits (which you should deal with using logrotate), as are the cruft that yum likes to keep around ...


12

Don't expect this to run quickly... cd to a directory where you suspect there might be a subdirectory with lots of inodes. If this script takes a huge amount of time, you've likely found where in the filesystem to look. /var is a good start... Otherwise, if you change to the top directory in that filesystem and run this and wait for it to finish, you'll ...


12

It sounds like the file is still open by some process. You'll need to restart that service for the disk space to be freed.


12

The file you deleted will still be open and Apache will be writing to it. You will need to restart Apache to allow it to create a new file. A graceful restart should do the trick apachctl -k graceful or apache2ctl -k graceful or whatever your distro uses.


12

Number 5 - Put a test in your backup script to ensure that the directory is mounted before continuing. The script should fail if the mount is not available or present. Or you can just make sure things are mounted prior to running the backup. Try the mountpoint command, which checks if a specified directory is a mountpoint: mountpoint -q /mnt/backups || ...


11

In Linux/Unix world file deletion does not necessarily immediately free the disk space, it merely unlinks the file from file system. If there are processes having file handles open to file being removed (as is common with syslog daemon, and in MySQL case, that mysql-slow.log), the space is not freed until the holding process is asked to reopen the file ...


11

I believe that it's not your problem. To my mind it's some manager's problem. I don't think you need to be a hardass, but it sounds like somebody needs to be. The user's unfettered email storage is costing the company money. The user wouldn't be allowed to hoard trash in their office-- why should hoarding trash on the email server be any different? IT has ...


11

This kind of problem is always really fun. My guess? You have files underneath one of your mountpoints. What does that mean? Well, du -sh will go by hand through all of the files that it can find. Let's say I have a directory, A. If I dump a bunch of files into A, and then mount, say, /dev/sdb on top of A, df -h will say I have a bunch of files that du ...


11

Try with the df -i which will show you how much free inodes you have. Basically sometimes you can run out of disk space to store metadata (data about data). That usually happens if you have a lot of small files.


11

Yes you can delete them and I recommend it as well. The docs for Puppet dashboard aren't very opinionated on the ongoing maintenance of the dashboard, but it does need maintenance. I recommend a cron that delete reports in the database after a few days, a second one to remove any orphaned records, and a third to delete processed reports. Mine looks like ...


11

NCurses Disk Usage (ncdu) is good for this. See http://dev.yorhel.nl/ncdu for details. It's available as a package for most popular distributions and lets you browse and find out where your disk space is used. It uses text characters to display a bar-chart of directory usage so you get a semi-graphical interface, in a text only environment.


11

MySQL use of DiskSpace is quite predictable. The information_schema can quickly give away how much space is used by both storage engines. However, it is far better to configure InnoDB with innodb_file_per_table. That way, you can micromanage the diskspace of individual InnoDB tables. If you do not have innodb_file_per_table, the ibdata1 will grow and NEVER, ...



Only top voted, non community-wiki answers of a minimum length are eligible