简体   繁体   中英

How do you locate which files are on which partition with linux ubuntu

I have a linux box with a partition full, the partition being full is stopping SQL from being started. I Need to work out what files I need to delete in order to free up space on the partition, I have tried deleting backup database files from mysql by hand using rm, and deleting old log files, but this just frees up more space from sda8 - which has plenty of space. Does anyone know how to find out which files are in sda7?

Here is the output of df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda6             4.6G  1.2G  3.2G  27% /
tmpfs                 1.8G     0  1.8G   0% /lib/init/rw
varrun                1.8G   92K  1.8G   1% /var/run
varlock               1.8G     0  1.8G   0% /var/lock
udev                  1.8G  168K  1.8G   1% /dev
tmpfs                 1.8G     0  1.8G   0% /dev/shm
lrm                   1.8G  2.5M  1.8G   1% /lib/modules/2.6.28-19-generic/volatile
/dev/sda5              76M   20M   53M  27% /boot
/dev/sda8             220G  7.4G  202G   4% /home
/dev/sda7             4.6G  4.4G     0 100% /var

Thanks

/dev/sda7             4.6G  4.4G     0 100% /var
varrun                1.8G   92K  1.8G   1% /var/run
varlock               1.8G     0  1.8G   0% /var/lock

I re-arranged your df -h output a little and trimmed it to the most meaningful lines.

You need to remove content in /var/ that is not in /var/run or /var/lock . A very fast way to free up a giant pile of free space on Debian-derived systems (including Ubuntu) is to run apt-get autoclean -- this will remove old packages from /var/cache/apt/archives/ . apt-get clean will free up even more space by removing all packages from that directory. (These packages are kept around for your troubleshooting.) If you're not sure which to run, apt-get clean is my suggestion -- you'll almost never need those packages anyway.

But that's not a long-term solution to your problem. You should probably store your SQL databases in /home instead. You have 202 gigabytes free there and you probably have a backup solution of some sort in place on your /home partition -- right? -- that you might not have thought to back up from /var/ . Make a new directory in /home/ for your SQL databases, make it owned by the user and group accounts for your SQL server, move your databases, and configure the database server to use the new locations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM