Score:0

Will my Harddisk still be written when i delete a logfile in use on Debian?

mx flag

Due some Bug testings there are tons of request made to my squid server on debian. Because it is a test i can't disable logging, restart the Server or block the requests. Due the growing size of the logfile i decided to delete it while writing. Squid did not create a new one (first with the next restart).

I tried to figure out what happens now in the background, is this data still written somewhere to the harddisk or what is happening in such a szenario? I'm mostly worried because i have an NVME Drive.

Score:2
in flag

In general, if a file is open, and you delete that file, its data remains on the disk while at least one process holds the file open. Data written to such files will be written to the file system, so a file deleted in this way consumes filesystem space, and will continue to grow until all file handles are released.

You should reload squid by using systemctl reload squid or squid -k reconfigure after you delete the file. This will make squid reinitialize without actually restarting, which includes reopening the log files, freeing the old handle in the process.

Score:1
mx flag

Yes. As long as the Squid process has its file handle it can write to it and the data gets written to disk. -- At the same time you can do manual move/remove/link operations, but these external actions do not affect the running process.

Related remark, not for Squid: this is also why syslogd supports signals to re-open all active logfiles, the function is necessary for logrotate (or similar tools) to get control over the old logfiles.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.