Hello *, I have to delete a subtree of about ~50 million files in thousands of subdirs, ~14TB of data. Running a recursive rm is very slow so I setup a simple policy file: RULE 'delstuff' DELETE DIRECTORIES_PLUS WHERE PATH_NAME LIKE '/mypath/%' This kinda works but is not really fast, either. It even requires a second run because files and directories within the tree will be processed in arbitrary order so it will happen quite frequently that a directory is going to be deleted before its content has been removed completely. For those dirs I see an error message and have to delete afterwards. I am wondering if there's a quicker way. Given the fact that this is a whole tree I think there's should be a quick way to unlink the complete inode hierachy. Unfortunately we are not using a fileset for that tree... So are there any ideas how to solve that more efficiently? Uli -- Science + Computing AG Vorstandsvorsitzender/Chairman of the board of management: Dr. Martin Matzke Vorstand/Board of Management: Matthias Schempp, Sabine Hohenstein Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Philippe Miltin Aufsichtsrat/Supervisory Board: Martin Wibbe, Ursula Morgenstern Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196
On 20/04/2021 12:18, Ulrich Sibiller wrote:
Hello *,
I have to delete a subtree of about ~50 million files in thousands of subdirs, ~14TB of data. Running a recursive rm is very slow so I setup a simple policy file:
RULE 'delstuff' DELETE DIRECTORIES_PLUS > WHERE PATH_NAME LIKE '/mypath/%'
This kinda works but is not really fast, either. It even requires a second run because files and directories within the tree will be processed in arbitrary order so it will happen quite frequently that a directory is going to be deleted before its content has been removed completely. For those dirs I see an error message and have to delete afterwards.
You are going to have to remove all the inodes and hence the speed is going to be dependant on your metadata performance no matter how you approach the problem. I doubt that you are going to get much better than a recursive rm. You could try running a series of parallel rm's attacking subsection of the directory tree on different nodes, but I suspect that it will make very little difference. You could my sync/restore script to split the problem up between different nodes https://github.com/digitalcabbage/syncrestore
I am wondering if there's a quicker way. Given the fact that this is a whole tree I think there's should be a quick way to unlink the complete inode hierachy.
Unfortunately we are not using a fileset for that tree...
So are there any ideas how to solve that more efficiently?
Does it matter that it takes a long time? Use screen or tmux to run the command in the background safe from accidental detaches and forget about. Check on it now and then to see how it's going or just forget about it, it will finish. Something like screen -S filedel -L -Logfile /tmp/filedel.log -d -m /bin/rm -rf <tree> Consider using mv to move it out the way or hide it while the delete is in progress. If you do that think carefully about backups, you don't want to back it all up again while it is being deleted :-) JAB. -- Jonathan A. Buzzard Tel: +44141-5483420 HPC System Administrator, ARCHIE-WeSt. University of Strathclyde, John Anderson Building, Glasgow. G4 0NG
On 4/20/21 1:47 PM, Jonathan Buzzard wrote:
You are going to have to remove all the inodes and hence the speed is going to be dependant on your metadata performance no matter how you approach the problem. I doubt that you are going to get much better than a recursive rm.
You could try running a series of parallel rm's attacking subsection of the directory tree on different nodes, but I suspect that it will make very little difference. You could my sync/restore script to split the problem up between different nodes
might be worth a try, thanks.
Does it matter that it takes a long time? Use screen or tmux to run the
Unfortunately it makes sense since I need the sapce for something else...
command in the background safe from accidental detaches and forget about. Check on it now and then to see how it's going or just forget about it, it will finish. Something like
screen -S filedel -L -Logfile /tmp/filedel.log -d -m /bin/rm -rf <tree>
Consider using mv to move it out the way or hide it while the delete is in progress. If you do that think carefully about backups, you don't want to back it all up again while it is being deleted :-)
;-) Yeah, that's why I did not the do the mv in the first place ;-) Thanks, Uli -- Dipl.-Inf. Ulrich Sibiller science + computing ag System Administration Hagellocher Weg 73 Hotline +49 7071 9457 681 72070 Tuebingen, Germany https://atos.net/de/deutschland/sc -- Science + Computing AG Vorstandsvorsitzender/Chairman of the board of management: Dr. Martin Matzke Vorstand/Board of Management: Matthias Schempp, Sabine Hohenstein Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Philippe Miltin Aufsichtsrat/Supervisory Board: Martin Wibbe, Ursula Morgenstern Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196
On 20/04/2021 13:09, Ulrich Sibiller wrote:
Consider using mv to move it out the way or hide it while the delete is in progress. If you do that think carefully about backups, you don't want to back it all up again while it is being deleted :-)
;-) Yeah, that's why I did not the do the mv in the first place ;-)
I would estimate (based on my experience) is that you should be able to delete that amount of data/files in under 24 hours anyway with a simple rm -rf. Which is why I question trying to find faster methods. You have already wasted a significant amount of that time :-) If your using TSM for the backup then just exclude it from the backup in your dsm.opts file exclude.dir <path to directory> We have a NOBACK option that allows users to select if they don't want something backing up. Helpful if your job generates lots of temporary files or data that are junked as soon as the job finishes. Anything under a directory called NOBACK does not get backed up. exclude.dir /.../NOBACK/ JAB. -- Jonathan A. Buzzard Tel: +44141-5483420 HPC System Administrator, ARCHIE-WeSt. University of Strathclyde, John Anderson Building, Glasgow. G4 0NG
I would start with the mv to hide it, and then allow the delete to progress in the background. I would seperate out the delete of files from directories... And i would try using mmxargs with a rm command to get parallelism plus reduce the number of execs in one policy, followed by a simple rm -r of the directory tree. Maybe it's cheaper to make a new filesystem and just retain the data you want though... Alec On Tue, Apr 20, 2021, 6:51 AM Jonathan Buzzard < jonathan.buzzard@strath.ac.uk> wrote:
On 20/04/2021 13:09, Ulrich Sibiller wrote:
Consider using mv to move it out the way or hide it while the delete is in progress. If you do that think carefully about backups, you don't want to back it all up again while it is being deleted :-)
;-) Yeah, that's why I did not the do the mv in the first place ;-)
I would estimate (based on my experience) is that you should be able to delete that amount of data/files in under 24 hours anyway with a simple rm -rf. Which is why I question trying to find faster methods. You have already wasted a significant amount of that time :-)
If your using TSM for the backup then just exclude it from the backup in your dsm.opts file
exclude.dir <path to directory>
We have a NOBACK option that allows users to select if they don't want something backing up. Helpful if your job generates lots of temporary files or data that are junked as soon as the job finishes. Anything under a directory called NOBACK does not get backed up.
exclude.dir /.../NOBACK/
JAB.
-- Jonathan A. Buzzard Tel: +44141-5483420 HPC System Administrator, ARCHIE-WeSt. University of Strathclyde, John Anderson Building, Glasgow. G4 0NG _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss
A couple of ideas. The KC recommends adding WEIGHT(DIRECTORY_HASH) to group deletions within a directory. Then maybe also do it as a 2-step process, in the same policy run. Where you delete all non-directories first, and then deletes the directories in a depth-first order using WEIGTH(Length(PATH_NAME)): RULE 'delnondir' DELETE WEIGHT(DIRECTORY_HASH) DIRECTORIES_PLUS WHERE PATH_NAME LIKE '/mypath/%' AND NOT MISC_ATTRIBUTES LIKE '%D%' RULE 'deldir' DELETE DIRECTORIES_PLUS WEIGHT(Length(PATH_NAME)) WHERE PATH_NAME LIKE '/mypath/%' AND MISC_ATTRIBUTES LIKE '%D%' HTH On Tue, Apr 20, 2021 at 1:18 PM Ulrich Sibiller < u.sibiller@science-computing.de> wrote:
Hello *,
I have to delete a subtree of about ~50 million files in thousands of subdirs, ~14TB of data. Running a recursive rm is very slow so I setup a simple policy file:
RULE 'delstuff' DELETE DIRECTORIES_PLUS WHERE PATH_NAME LIKE '/mypath/%'
This kinda works but is not really fast, either. It even requires a second run because files and directories within the tree will be processed in arbitrary order so it will happen quite frequently that a directory is going to be deleted before its content has been removed completely. For those dirs I see an error message and have to delete afterwards.
I am wondering if there's a quicker way. Given the fact that this is a whole tree I think there's should be a quick way to unlink the complete inode hierachy.
Unfortunately we are not using a fileset for that tree...
So are there any ideas how to solve that more efficiently?
Uli -- Science + Computing AG Vorstandsvorsitzender/Chairman of the board of management: Dr. Martin Matzke Vorstand/Board of Management: Matthias Schempp, Sabine Hohenstein Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Philippe Miltin Aufsichtsrat/Supervisory Board: Martin Wibbe, Ursula Morgenstern Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196 _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss
On 4/20/21 1:52 PM, Jan-Frode Myklebust wrote:
A couple of ideas.
The KC recommends adding WEIGHT(DIRECTORY_HASH) to group deletions within a directory. Then maybe > also do it as a 2-step process, in the same policy run. Where you delete all non-directories first, and then deletes the directories in a depth-first order using WEIGTH(Length(PATH_NAME)):
RULE 'delnondir' DELETE WEIGHT(DIRECTORY_HASH) DIRECTORIES_PLUS WHERE PATH_NAME LIKE '/mypath/%' AND NOT MISC_ATTRIBUTES LIKE '%D%'
RULE 'deldir' DELETE DIRECTORIES_PLUS WEIGHT(Length(PATH_NAME)) WHERE PATH_NAME LIKE '/mypath/%' AND MISC_ATTRIBUTES LIKE '%D%'
Thanks, I am aware of that but it will not really help with my speed concerns. Uli -- Dipl.-Inf. Ulrich Sibiller science + computing ag System Administration Hagellocher Weg 73 Hotline +49 7071 9457 681 72070 Tuebingen, Germany https://atos.net/de/deutschland/sc -- Science + Computing AG Vorstandsvorsitzender/Chairman of the board of management: Dr. Martin Matzke Vorstand/Board of Management: Matthias Schempp, Sabine Hohenstein Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Philippe Miltin Aufsichtsrat/Supervisory Board: Martin Wibbe, Ursula Morgenstern Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196
participants (5)
-
Alec -
Frederick Stock -
Jan-Frode Myklebust -
Jonathan Buzzard -
Ulrich Sibiller
