I was looking at a mail folder and I noted that a file in the inbox had a total of 11 hard links to it:
👹 # exa -lH cur/1564249738.M167990P53982.mail.covisp.net,S=8572,W=8738:2,Sgl .rw------- 11 8.6k vpopmail 19 Jul 19:59 cur/1564249738.M167990P53982.mail.covisp.net,S=8572,W=8738:2,Sgl
👹 # find . -samefile cur/1564249738.M167990P53982.mail.covisp.net,S=8572,W=8738:2,Sgl [6:59] [/usr/local/virtual/kreme@kreme.com/Maildir] ./.Junk/cur/1564253637.M808919P50422.mail.covisp.net,S=8572,W=8738:2,bc ./.Junk/cur/1564253637.M808920P50422.mail.covisp.net,S=8572,W=8738:2,bc ./.Junk/cur/1564253723.M977674P50422.mail.covisp.net,S=8572,W=8738:2,bc ./.Junk/cur/1564253723.M977675P50422.mail.covisp.net,S=8572,W=8738:2,bc ./.Junk/cur/1564253723.M977676P50422.mail.covisp.net,S=8572,W=8738:2,bc ./.Junk/cur/1563587951.M591499P47868.mail.covisp.net,S=8572,W=8738:2, ./.Junk/cur/1564851795.M381461P10380.mail.covisp.net,S=8572,W=8738:2,bc ./.Junk/cur/1564851795.M381462P10380.mail.covisp.net,S=8572,W=8738:2,bc ./.Junk/cur/1564852369.M760020P10380.mail.covisp.net,S=8572,W=8738:2,bc ./.Trash/cur/1563587951.M591499P47868.mail.covisp.net,S=8572,W=8738:2,S ./cur/1564249738.M167990P53982.mail.covisp.net,S=8572,W=8738:2,Sgl
A bit of background: a few weeks ago I had thousands of files in the mail store that had hundreds of links, and I got that all cleaned up through juggling some grep and awk to delete all but one of the linked files. I figured this was caused by something I’d done when I moved local users into being virtual users and eliminated pam authentication in favor of sql. But this gives me pause.
I think it’s normal for a file in the INBOX that is marked as junk or as deleted to have a single hard link (or at least it is since the default was set to maildir_copy_with_hardlinks), but 11?
And when do these hard links get cleaned off? If I delete the trashed and junked messages, when does dovecot go through and removed the linked files in the cur/ folder?
(It’s not immediate, I trashed those copies in Junk and Trash and the original file is still in the cur folder)
-- There is nothing so stupid that some person somewhere will not, with earnestness, say it.