[mythtv-users] remaining disk space / delete slowly

Michael T. Dean mtdean at thirdcontact.com
Mon Jul 11 18:22:28 UTC 2016



On 7/11/2016 1:28 PM, Daryl McDonald wrote:
> Just for clarification, the reason for having delete slowly selected 
> is so recordings are recorded over with a new recording (once) instead 
> of with zeros now and a new recording later (twice).

No, the slow deletes are simply to allow MythTV to spread the I/O 
requirements for deleting a file (generally a very large, multi-gigabyte 
file) over a long period of time (IIRC, about 2min/GB) rather than 
telling the OS to delete the entire, huge file and letting it force all 
that I/O to occur "immediately". Therefore, if your system has other I/O 
requirements (such as, for example, writing out recording files for new 
recordings that are currently in progress, or writing information to 
your MySQL database (eg, about in-progress recordings), or reading 
information from your MySQL database (eg, to refresh the information 
about your existing/remaining recordings), that (much, much) 
higher-priority I/O can occur without having to wait on the unimportant, 
low-priority I/O associated with deleting a recording.  This can be very 
important when deleting a bunch of huge files because it's possible for 
the new recording information to grow too large for the system to keep 
in memory before it's written to disk at which point information  is 
lost (and files are corrupted--including recording files and even 
potentially your MySQL database data files).

Deleting a file does not overwrite it with zeroes (unless you have some 
very non-standard--and very slow--version of a delete implementation on 
your system--there tend to exist programs such as srm or shred or others 
that allow you to overwrite a file's data with data patterns to try to 
prevent information from being recoverable, but normal OS deletion as 
done by normal OS programs like rm does not do so because of how 
expensive (in terms of time, processing, and even wear on the recording 
device) it would be). Generally, deletion programs simply rewrite the 
file system information to remove the information about the file and do 
some checking to make sure everything is still good.  With a 
multi-gigabyte file, this can involve quite a bit of 
information--pointing to all the parts of the disk on which parts of the 
file are written, which can take a lot of time.

> if this is correct I would expect Myth to count deleted recordings (of 
> which I have 55) as available space,

By "deleted recordings", I think you mean, "recordings in the Deleted 
recording group."  If so, these have nothing to do with slow deletes.  
These are simply recordings you have told MythTV you no longer want to 
keep and it will remove preferentially if you need space for other 
recordings.  In other words, the Deleted recording group is nothing more 
than a "Recycle Bin" from which you can undelete a recording (by simply 
moving that recording to a different recording group from inside the 
Watch Recordings screen).

> as reported on the "watch recordings" screen, which it is not, in my 
> case, and although I know I have more available space than reported - 
> seeing 89% full is hard not to react to.

The only location that reports file system information and 
deducts/reports space taken up by Deleted (and Live TV) recordings is 
the Backend Status web page.  It's available directly from the backend 
or via MythWeb.  Note that it only reports totals--not per-file system 
information--for the space used by Deleted and Live TV recordings since 
MythTV does not know on which file system each Deleted/Live TV recording 
file exists.

> Is there any solution, other than a chill pill for this behaviour?

You can chill, or you can tell MythTV to remove Deleted recordings after 
some number of days since they were added to the Deleted recording group 
(anywhere between 1 and 365), or you can manually remove Deleted 
recordings (deleting a recording that's in the Deleted recording group 
will remove it from disk--make it permanently deleted--just like 
deleting a file from the Recycle Bin does).

Note that there's absolutely no extra writes to disk performed if the 
file is deleted/expired from the Deleted recording group before that 
space is required for a new recording as opposed to it being expired 
when a new recording is being written.  So, the only thing you have to 
lose by deleting a recording "early" (before you need the space on disk) 
is, er, the recording itself--you won't be able to undelete it anymore.  
(And, perhaps, you may lose the time you spend telling MythTV to go 
ahead and delete it immediately.)

So if it makes you feel better/safer, feel free to have MythTV get rid 
of deleted recordings.  Just be willing to wait for a re-broadcast or 
buy/rent a copy of the show from your favorite streaming provider if you 
over-zealously delete a program you later decide you want.

Mike




More information about the mythtv-users mailing list