# simulate his scene, firewall off,SELinux off installation Apache Services [[email protected]/]# yum-y install httpd #yum Apache service [[Email protected]/]# service httpd Restart # restart Apache Services [Email protected]/]# grep-i "^ #Cu"/etc/httpd/conf/httpd.conf #CustomLog Logs/access_log Common #CustomLog Logs/referer_log Referer #CustomLog Logs/agent_log Agent #CustomLog Logs/referer_log Referer #CustomLog Logs/agent_log Agent [Email protected]/]# sed-i [email protected] #CustomLog logs/access_log [email protected] /app/logs/access_l og [email protected] "/etc/httpd/conf/httpd.conf # Modify the log storage path [email protected]/]# grep-i "^ #Cu"/etc/httpd/conf/httpd.conf #CustomLog/app/logs/access_log Common #CustomLog Logs/referer_log Referer #CustomLog Logs/agent_log Agent Simulate creating a small disk [[email protected]/]# dd if\=/dev/mapper/volgroup-lv_root of\=/dev/sdb1 bs\=8k count\=10 10+0 Records in 10+0 Records out 81920 bytes (kB) copied, 0.000201325 s, 407 MB/s #dd Simulation Creates a disk,if input,of output,BS:blocks size,count: number of blocks [[email protected]/]# mkfs.ext4/dev/sdb1 # format partition MKE2FS 1.41.12 (17-may-2010) /DEV/SDB1 is not a block special device. Proceed anyway? (y,n) Y Filesystem label= OS Type:linux Block size=1024 (log=0) Fragment size=1024 (log=0) Stride=0 blocks, Stripe width=0 blocks Inodes, blocks 4 blocks (5.00%) reserved for the Super user First Data block=1 1 Block Group 8192 blocks per group, 8192 fragments per group Inodes per group Writing Inode Tables:done Filesystem too small for a journal Writing superblocks and filesystem accounting Information:done This filesystem would be automatically checked every mounts or Whichever comes first. Use Tune2fs-c or-i to override. # Mount Partition [Email protected]/]# mkdir-p/app/logs/ [email protected]/]# mount/dev/sdb1/app/logs/# such mounting is unsuccessful and requires the envoy to mount the method under Mount:/DEV/SDB1 is not a block device (maybe try '-O loop '?) [Email protected]/]# Mount-o loop/dev/sdb1/app/logs/ [Email protected]/]# df-th Filesystem Type Size used Avail use% mounted on /dev/mapper/volgroup-lv_root ext4 18G 990M 16G 6%/ Tmpfs tmpfs 1.9G 0 1.9G 0%/dev/shm /DEV/SDA1 ext4 485M 33M 427M 8%/boot /DEV/SDB1 ext4 73K 14K 55K 21%/app/logs # A circular access script,1.sh #!/usr/bin/bash For N in ' seq 1000000 ' # How many times the loop executes Do Curl 12.1.1.13 &>/dev/null # take the results of visiting this site regardless put all the right and wrong /dev/null Done [[email protected]/]# sh/tmp/1.sh & # put this script in the background to execute [Email protected]/]# df-th Filesystem Type Size used Avail use% mounted on /dev/mapper/volgroup-lv_root ext4 18G 995M 16G 6%/ Tmpfs tmpfs 1.9G 0 1.9G 0%/dev/shm /DEV/SDA1 ext4 485M 33M 427M 8%/boot /DEV/SDB1 ext4 73K 68K 1.0K 99% /app/logs # Workaround One: Delete the log file and restart the service [[email protected]/]# rm-rf/app/logs/access_log # Delete log files for site access [Email protected]/]# df-th Filesystem Type Size used Avail use% mounted on /dev/mapper/volgroup-lv_root ext4 18G 995M 16G 6%/ Tmpfs tmpfs 1.9G 0 1.9G 0%/dev/shm /DEV/SDA1 ext4 485M 33M 427M 8%/boot /DEV/SDB1 ext4 73K 68K 1.0K 99% /app/logs # After the log file is deleted and the disk is full, this is because the principle of deleting the file is: The number of hard links (I_linke) is 0, process occupation (i_count) is 0, This time though the number of hard links is 0. However, the process occupancy is not 0, so this file still exists [[email protected]/]#/etc/init.d/httpd Restart # Restart service stopping httpd: [OK] Starting httpd:httpd:Could not reliably determine the server's fully qualified domain name, using 12.1.1.13 for Serv Ername [OK] [Email protected]/]# df-th Filesystem Type Size used Avail use% mounted on /dev/mapper/volgroup-lv_root ext4 18G 995M 16G 6%/ Tmpfs tmpfs 1.9G 0 1.9G 0%/dev/shm /DEV/SDA1 ext4 485M 33M 427M 8%/boot /DEV/SDB1 ext4 73K 15K 54K 22%/app/logs # turn this process off at reboot, then the process takes up 0, so disk space is down. # Workaround 2, empty the configuration file directly without deleting [[email protected]/]# echo "" >/app/logs/access_log # empty file contents [Email protected]/]# df-th Filesystem Type Size used Avail use% mounted on /dev/mapper/volgroup-lv_root ext4 18G 996M 16G 6%/ Tmpfs tmpfs 1.9G 0 1.9G 0%/dev/shm /DEV/SDA1 ext4 485M 33M 427M 8%/boot /DEV/SDB1 ext4 73K 16K 53K 24%/app/logs |