문서의 이전 판입니다!


Diskfull Ubuntu

journal

you can delete everything inside of /var/log/journal/* but do not delete the directory itself.

https://unix.stackexchange.com/questions/130786/can-i-remove-files-in-var-log-journal-and-var-cache-abrt-di-usr

plex

mysql

innodb 조카튼 것이 테이블 참조파일을 계속 늘리기 때문에 db좀 돌렸다 하면

/var/lib/mysql

에 수십기가 크기의 ibdata1 파일을 볼 수 있다.

innodb_file_per_table=1

을 설정하면, 각 db 마다 따로 생성되므로, db 삭제시 같이 지워버리면 된다. mysql 5.6.6 부터는 기본적으로 켜져 있슴.

이것은 자동으로 해결되지 않으며 db를 삭제하는 방법으로만 크기를 줄일 수 있다. 다음 순서대로 백업 후 삭제하고 복구한다.

  1. Do a mysqldump of all databases, procedures, triggers etc except the mysql and performance_schema databases
  2. Drop all databases except the above 2 databases
  3. Stop mysql
  4. Delete ibdata1 and ib_log files
  5. Start mysql
  6. Restore from dump
mysqldump -u [username] -p[root_password] [database_name] >
dumpfilename.sql
DROP DATABASE [database_name];
sudo /etc/init.d/mysqld stop
sudo rm /var/lib/mysql/ibdata1
sudo rm /var/lib/mysql/ib_logfile (and delete any other ib_logfile's that may be named ib_logfile0, ib_logfile1 etc...)
sudo /etc/init.d/mysqld start
create database [database_name];
mysql -u [username]-p[root_password] [database_name] < dumpfilename.sql

php session

/var/lib/php/sessions

옛날 것이 그냥 남아잇는 경우가 있다.

삭제되었지만 살아있는 경우

du 보고서에는 삭제되었지만 일부 프로세스에서 여전히 열려있는 파일도 표시되지 않습니다. 이 파일을 찾으려면 lsof 를 실행해야합니다.

https://serverfault.com/questions/315181/df-says-disk-is-full-but-it-is-not

It's possible that a process has opened a large file which has since been deleted. You'll have to kill that process to free up the space. You may be able to identify the process by using lsof. On Linux deleted yet open files are known to lsof and marked as (deleted) in lsof's output.

  sudo lsof +L1
COMMAND     PID     USER   FD   TYPE DEVICE    SIZE/OFF NLINK    NODE NAME
php-fpm7.  1753     root    3u   REG  253,0           0     0 2752541 /tmp/.ZendSem.M08g00 (deleted)
php-fpm7.  1767     root    3u   REG  253,0           0     0 2752562 /tmp/.ZendSem.9qycSi (deleted)
php-fpm7.  2136 www-data    3u   REG  253,0           0     0 2752562 /tmp/.ZendSem.9qycSi (deleted)
php-fpm7.  2138 www-data    3u   REG  253,0           0     0 2752562 /tmp/.ZendSem.9qycSi (deleted)
mysqld     2261    mysql    1w   REG  253,0       32768     0 1179986 /var/log/mysql/error.log.1 (del                                     eted)
mysqld     2261    mysql    2w   REG  253,0       32768     0 1179986 /var/log/mysql/error.log.1 (del                                     eted)
mysqld     2261    mysql    7u   REG  253,0           0     0 2752569 /tmp/ibi1TokU (deleted)
mysqld     2261    mysql    8u   REG  253,0           0     0 2752698 /tmp/ibH6nbH1 (deleted)
mysqld     2261    mysql    9u   REG  253,0       16384     0 2752724 /tmp/ib4rDJRg (deleted)
mysqld     2261    mysql   13u   REG  253,0           0     0 2752725 /tmp/ibK1pekp (deleted)
mysqld     2261    mysql   19w   REG  253,0 60472987686     0 1179983 /var/log/mysql/mysql.log.1 (del                                     eted)
php-fpm7. 27064 www-data    3u   REG  253,0           0     0 2752541 /tmp/.ZendSem.M08g00 (deleted)
php-fpm7. 27065 www-data    3u   REG  253,0           0     0 2752541 /tmp/.ZendSem.M08g00 (deleted)
php-fpm7. 29223 www-data    3u   REG  253,0           0     0 2752541 /tmp/.ZendSem.M08g00 (deleted)
andy@code64:/home/www/seat/storage/eseye$ sudo service mysql restart
andy@code64:/home/www/seat/storage/eseye$ sudo lsof +L1
COMMAND     PID     USER   FD   TYPE DEVICE SIZE/OFF NLINK    NODE NAME
php-fpm7.  1753     root    3u   REG  253,0        0     0 2752541 /tmp/.ZendSem.M08g00 (deleted)
php-fpm7.  1767     root    3u   REG  253,0        0     0 2752562 /tmp/.ZendSem.9qycSi (deleted)
php-fpm7.  2136 www-data    3u   REG  253,0        0     0 2752562 /tmp/.ZendSem.9qycSi (deleted)
php-fpm7.  2138 www-data    3u   REG  253,0        0     0 2752562 /tmp/.ZendSem.9qycSi (deleted)
php-fpm7. 27064 www-data    3u   REG  253,0        0     0 2752541 /tmp/.ZendSem.M08g00 (deleted)
php-fpm7. 27065 www-data    3u   REG  253,0        0     0 2752541 /tmp/.ZendSem.M08g00 (deleted)
php-fpm7. 29223 www-data    3u   REG  253,0        0     0 2752541 /tmp/.ZendSem.M08g00 (deleted)
mysqld    29934    mysql    7u   REG  253,0        0     0 2752569 /tmp/ibzQHRhy (deleted)
mysqld    29934    mysql    8u   REG  253,0        0     0 2752698 /tmp/ibA8S1ru (deleted)
mysqld    29934    mysql    9u   REG  253,0        0     0 2752724 /tmp/ibRAFJNm (deleted)
mysqld    29934    mysql   13u   REG  253,0        0     0 2752725 /tmp/ibma5E4i (deleted)
andy@code64:/home/www/seat/storage/eseye$ f
-=-------------=-
              total        used        free      shared  buff/cache   available
Mem:            31G         15G        4.3G         73M         12G         15G
Swap:           15G        551M         15G
--------------------
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/code64--vg-root  102G   38G   59G  40% /
/dev/sda1                    472M  146M  303M  33% /boot
/dev/mapper/backup-data      2.7T  2.3T  282G  90% /home/backup

역링크