Question on changing mode on many files
Dear users/developers/support, I'd like to ask if there is a fast way to manipulate the permission mask of many files (millions). I tried on 900k files and a recursive chmod (chmod 0### -R path) takes about 1000s, with about 50% usage of mmfsd daemon. I tried with the perl's internal function chmod that can operate on an array of files, and it takes about 1/3 of the previous method. Which is already a good result. I've seen the possibility to run a policy to execute commands, but I would avoid to execute external commands through mmxargs, 1M of times; would you ? Does anybody have any suggestion to do this operation with minimum disruption on the system ? Thank you, Alvise
I have 5.0.4 for the moment (planned to be updated next year) and what I see is: [root@sf-dss-1 tmp]# locate mmfind /usr/lpp/mmfs/samples/ilm/mmfind /usr/lpp/mmfs/samples/ilm/mmfind.README /usr/lpp/mmfs/samples/ilm/mmfindUtil_processOutputFile.c /usr/lpp/mmfs/samples/ilm/mmfindUtil_processOutputFile.sampleMakefile Is that what you are talking about ? Thanks, Alvise Da: gpfsug-discuss-bounces@spectrumscale.org <gpfsug-discuss-bounces@spectrumscale.org> Per conto di Frederick Stock Inviato: martedì 7 dicembre 2021 15:02 A: gpfsug-discuss@spectrumscale.org Cc: gpfsug-discuss@spectrumscale.org Oggetto: Re: [gpfsug-discuss] Question on changing mode on many files If you are running on a more recent version of Scale you might want to look at the mmfind command. It provides a find-like wrapper around the execution of policy rules. Fred _______________________________________________________ Fred Stock | Spectrum Scale Development Advocacy | 720-430-8821 stockf@us.ibm.com<mailto:stockf@us.ibm.com> ----- Original message ----- From: "Dorigo Alvise (PSI)" <alvise.dorigo@psi.ch<mailto:alvise.dorigo@psi.ch>> Sent by: gpfsug-discuss-bounces@spectrumscale.org<mailto:gpfsug-discuss-bounces@spectrumscale.org> To: "'gpfsug main discussion list'" <gpfsug-discuss@spectrumscale.org<mailto:gpfsug-discuss@spectrumscale.org>> Cc: Subject: [EXTERNAL] [gpfsug-discuss] Question on changing mode on many files Date: Tue, Dec 7, 2021 8:53 AM Dear users/developers/support, I’d like to ask if there is a fast way to manipulate the permission mask of many files (millions). I tried on 900k files and a recursive chmod (chmod 0### -R path) takes about 1000s, with about 50% usage of mmfsd daemon. I tried with the perl’s internal function chmod that can operate on an array of files, and it takes about 1/3 of the previous method. Which is already a good result. I’ve seen the possibility to run a policy to execute commands, but I would avoid to execute external commands through mmxargs, 1M of times; would you ? Does anybody have any suggestion to do this operation with minimum disruption on the system ? Thank you, Alvise _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss
On 07/12/2021 14:01, Frederick Stock wrote:
If you are running on a more recent version of Scale you might want to look at the mmfind command. It provides a find-like wrapper around the execution of policy rules.
I am not sure that will be any faster than a "chmod -R" as it will exec millions of instances of chmod. What you gain on the swings you are going to loose on the roundabouts. TL;DR is you want to change permissions on millions of files expect it to take a considerable period of time. Even a modern NVMe SSD probably does around 50k IOPS per second, so best case scenario is one million files taking 40 seconds, at one read and one write per file and that is frankly unlikely. Also get ready to back them up again. JAB. -- Jonathan A. Buzzard Tel: +44141-5483420 HPC System Administrator, ARCHIE-WeSt. University of Strathclyde, John Anderson Building, Glasgow. G4 0NG
Or add: UPDATECTIME yes SKIPACLUPDATECHECK yes To you dsm.opt file to skip checking for those updates and don’t back them up again. Actually I thought TSM only updated the metadata if the mode/owner changed, not re-backed the file… Simon From: gpfsug-discuss-bounces@spectrumscale.org <gpfsug-discuss-bounces@spectrumscale.org> on behalf of Jonathan Buzzard <jonathan.buzzard@strath.ac.uk> Date: Tuesday, 7 December 2021 at 14:29 To: gpfsug-discuss@spectrumscale.org <gpfsug-discuss@spectrumscale.org> Subject: Re: [gpfsug-discuss] Question on changing mode on many files On 07/12/2021 14:01, Frederick Stock wrote:
If you are running on a more recent version of Scale you might want to look at the mmfind command. It provides a find-like wrapper around the execution of policy rules.
I am not sure that will be any faster than a "chmod -R" as it will exec millions of instances of chmod. What you gain on the swings you are going to loose on the roundabouts. TL;DR is you want to change permissions on millions of files expect it to take a considerable period of time. Even a modern NVMe SSD probably does around 50k IOPS per second, so best case scenario is one million files taking 40 seconds, at one read and one write per file and that is frankly unlikely. Also get ready to back them up again. 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
On 07/12/2021 14:55, Simon Thompson wrote:
Or add: UPDATECTIME yes SKIPACLUPDATECHECK yes
To you dsm.opt file to skip checking for those updates and don’t back them up again.
Yeah, but then a restore gives you potentially an unusable file system as the ownership of the files and ACL's are all wrong. Better to bite the bullet and back them up again IMHO.
Actually I thought TSM only updated the metadata if the mode/owner changed, not re-backed the file…
That was my understanding but I have seen TSM rebacked up large amounts of data where the owner of the file changed in the past, so your mileage may vary. Also ACL's are stored in extended attributes which are stored with the files and changes will definitely cause the file to be backed up again. JAB. -- Jonathan A. Buzzard Tel: +44141-5483420 HPC System Administrator, ARCHIE-WeSt. University of Strathclyde, John Anderson Building, Glasgow. G4 0NG
You can manipulate the permissions via GPFS policy engine, essentially you'd write a script that the policy engine calls and tell GPFS to farm out the change in at whatever scale you need... run in a single node, how many files per thread, how many threads per node, etc... This can GREATLY accelerate file change permissions over a large quantity of files. However, as stated earlier the mmfind command will do all of this for you and it's worth the effort to get it compiled for your system. I don't have Spectrum Scale in front of me but for the best performance you'll want to setup the mmfind policy engine parameters to parallelize your workload... If mmfind has no action it will silently use GPFS policy engine to produce the requested output, however if mmfind has an action it will expose the policy engine calls. it goes something like this: mmfind -B 1 -N directattachnode1,directattachnode2 -m 24 /path/to/find -perm +o=w ! \( -type d -perm +o=t \) -xargs chmod o-w This will run 48 threads on 2 nodes and bump other write permissions off of any file it finds (excluding temp dirs) until it completes, it should go blistering fast... as this is only a meta operation the -B 1 might not be necessary, you'd probably be better off with a -B 100, but as I deal with a lot of 100GB+ files I don't want a single thread to be stuck with 3 100GB+ files and another thread to have none, so I usually set the max depth to be 1 and take the higher execution count. This has an advantage in that GPFS will break up the inodes in the most efficient way for the chmod to happen in parallel. I'm not sure if this happens on Spectrum Scale but on most FS's if you do a chmod 770 file you'll lose any ACLs assigned to the file, so safest to bump the permissions with a subtractive or additive o-w or g+w type operation. If you think of the possibilities here you could easily change that chmod to a gzip and add a -mtime +1200 and you have a find command that will gzip compress files over 4 years old in parallel across multiple nodes... mmfind is VERY powerful and flexible, highly worth getting into usage. Alec On Tue, Dec 7, 2021 at 7:43 AM Jonathan Buzzard < jonathan.buzzard@strath.ac.uk> wrote:
On 07/12/2021 14:55, Simon Thompson wrote:
Or add: UPDATECTIME yes SKIPACLUPDATECHECK yes
To you dsm.opt file to skip checking for those updates and don’t back them up again.
Yeah, but then a restore gives you potentially an unusable file system as the ownership of the files and ACL's are all wrong. Better to bite the bullet and back them up again IMHO.
Actually I thought TSM only updated the metadata if the mode/owner changed, not re-backed the file…
That was my understanding but I have seen TSM rebacked up large amounts of data where the owner of the file changed in the past, so your mileage may vary.
Also ACL's are stored in extended attributes which are stored with the files and changes will definitely cause the file to be backed up again.
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
I'm not sure if this happens on Spectrum Scale but on most FS's if you do a chmod 770 file you'll lose any ACLs assigned to the file, so safest to bump the permissions with a subtractive or additive o-w or g+w type operation.
This depends entirely on the fileset setting, see: https://www.ibm.com/docs/en/spectrum-scale/5.1.2?topic=reference-mmchfileset... “allow-permission-change” We typically have file-sets set to chmodAndUpdateAcl, though not exclusively, I think it was some quirky software that tested the permissions after doing something and didn’t like the updatewithAcl thing … Simon
How am I just learning about this right now, thank you! Makes so much more sense now the odd behaviors I've seen over the years on GPFS vs POSIX chmod/ACL. Will definitely go review those settings on my filesets now, wonder if the default has evolved from 3.x -> 4.x -> 5.x. IBM needs to find a way to pre-compile mmfind and make it supported, it really is essential and so beneficial, and so hard to get done in a production regulated environment. Though a bigger warning that the compress option is an action not a criteria! Alec On Sun, Dec 12, 2021 at 9:01 AM Simon Thompson <s.j.thompson@bham.ac.uk> wrote:
I'm not sure if this happens on Spectrum Scale but on most FS's if you do a chmod 770 file you'll lose any ACLs assigned to the file, so safest to bump the permissions with a subtractive or additive o-w or g+w type operation.
This depends entirely on the fileset setting, see:
https://www.ibm.com/docs/en/spectrum-scale/5.1.2?topic=reference-mmchfileset...
“*allow-permission-change*”
We typically have file-sets set to chmodAndUpdateAcl, though not exclusively, I think it was some quirky software that tested the permissions after doing something and didn’t like the updatewithAcl thing …
Simon _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss
I am definitely going to try this solution with mmfind. Thank you also for the command line and several hints… I’ll be back with the outcome soon. Alvise Da: gpfsug-discuss-bounces@spectrumscale.org <gpfsug-discuss-bounces@spectrumscale.org> Per conto di Alec Inviato: domenica 12 dicembre 2021 23:04 A: gpfsug main discussion list <gpfsug-discuss@spectrumscale.org> Oggetto: Re: [gpfsug-discuss] Question on changing mode on many files How am I just learning about this right now, thank you! Makes so much more sense now the odd behaviors I've seen over the years on GPFS vs POSIX chmod/ACL. Will definitely go review those settings on my filesets now, wonder if the default has evolved from 3.x -> 4.x -> 5.x. IBM needs to find a way to pre-compile mmfind and make it supported, it really is essential and so beneficial, and so hard to get done in a production regulated environment. Though a bigger warning that the compress option is an action not a criteria! Alec On Sun, Dec 12, 2021 at 9:01 AM Simon Thompson <s.j.thompson@bham.ac.uk<mailto:s.j.thompson@bham.ac.uk>> wrote:
I'm not sure if this happens on Spectrum Scale but on most FS's if you do a chmod 770 file you'll lose any ACLs assigned to the file, so safest to bump the permissions with a subtractive or additive o-w or g+w type operation.
This depends entirely on the fileset setting, see: https://www.ibm.com/docs/en/spectrum-scale/5.1.2?topic=reference-mmchfileset... “allow-permission-change” We typically have file-sets set to chmodAndUpdateAcl, though not exclusively, I think it was some quirky software that tested the permissions after doing something and didn’t like the updatewithAcl thing … Simon _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org<http://spectrumscale.org> http://gpfsug.org/mailman/listinfo/gpfsug-discuss
Hi Alec , mmfind doesn’t have a man page (does it have an online one ? I cannot find it). And according to mmfind -h it doesn’t exposes the “-N” neither the “-B” flags. RPM is gpfs.base-5.1.1-2.x86_64. Do I have chance to download a newest version of that script from somewhere ? Thanks, Alvise Da: gpfsug-discuss-bounces@spectrumscale.org <gpfsug-discuss-bounces@spectrumscale.org> Per conto di Dorigo Alvise (PSI) Inviato: lunedì 13 dicembre 2021 11:50 A: gpfsug main discussion list <gpfsug-discuss@spectrumscale.org> Oggetto: [gpfsug-discuss] R: Question on changing mode on many files I am definitely going to try this solution with mmfind. Thank you also for the command line and several hints… I’ll be back with the outcome soon. Alvise Da: gpfsug-discuss-bounces@spectrumscale.org<mailto:gpfsug-discuss-bounces@spectrumscale.org> <gpfsug-discuss-bounces@spectrumscale.org<mailto:gpfsug-discuss-bounces@spectrumscale.org>> Per conto di Alec Inviato: domenica 12 dicembre 2021 23:04 A: gpfsug main discussion list <gpfsug-discuss@spectrumscale.org<mailto:gpfsug-discuss@spectrumscale.org>> Oggetto: Re: [gpfsug-discuss] Question on changing mode on many files How am I just learning about this right now, thank you! Makes so much more sense now the odd behaviors I've seen over the years on GPFS vs POSIX chmod/ACL. Will definitely go review those settings on my filesets now, wonder if the default has evolved from 3.x -> 4.x -> 5.x. IBM needs to find a way to pre-compile mmfind and make it supported, it really is essential and so beneficial, and so hard to get done in a production regulated environment. Though a bigger warning that the compress option is an action not a criteria! Alec On Sun, Dec 12, 2021 at 9:01 AM Simon Thompson <s.j.thompson@bham.ac.uk<mailto:s.j.thompson@bham.ac.uk>> wrote:
I'm not sure if this happens on Spectrum Scale but on most FS's if you do a chmod 770 file you'll lose any ACLs assigned to the file, so safest to bump the permissions with a subtractive or additive o-w or g+w type operation.
This depends entirely on the fileset setting, see: https://www.ibm.com/docs/en/spectrum-scale/5.1.2?topic=reference-mmchfileset... “allow-permission-change” We typically have file-sets set to chmodAndUpdateAcl, though not exclusively, I think it was some quirky software that tested the permissions after doing something and didn’t like the updatewithAcl thing … Simon _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org<http://spectrumscale.org> http://gpfsug.org/mailman/listinfo/gpfsug-discuss
I checked on my office network.... mmfind --help mmfind -polFlags '-N node1,node2 -B 100 -m 24' /path/to/find -perm +o=w ! \( -type d -perm +o=t \) -xargs chmod o-w I think that the -m 24 is the default (24 threads per node), but it's nice to include on the command line so you remember you can increment/decrement it as your needs require or your nodes can handle. It's IMPORTANT to review in the mmfind --help output that some things are 'mmfind' args and go BEFORE the path... some are CRITERIA args and have no impact on the files... BUT SOME ARE ACTION args, and they will affect files. So -exec -xargs are obvious actions, however, -gpfsCompress doesn't find compressed files, it will actually compress the objects... in our AIX environment our compressed reads feel like they're essentially broken, we only get about 5MB/s, however on Linux compress reads seem to work fairly well. So make sure to read the man page carefully before using some non-obvious GPFS enhancements. Also the nice thing is mmfind -xargs takes care of all the strange file names, so you don't have to do anything complicated, but you also can't pipe the output as it will run the xarg in the policy engine. As a footnote this is my all time favorite find for troubleshooting... find $(pwd) -mtime -1 | sed -e 's/.*/"&"/g' | xargs ls -latr List all the files modified in the last day in reverse chronology... Doesn't work :-( Alec On Mon, Dec 13, 2021 at 3:30 AM Dorigo Alvise (PSI) <alvise.dorigo@psi.ch> wrote:
Hi Alec ,
mmfind doesn’t have a man page (does it have an online one ? I cannot find it). And according to mmfind -h it doesn’t exposes the “-N” neither the “-B” flags. RPM is gpfs.base-5.1.1-2.x86_64.
Do I have chance to download a newest version of that script from somewhere ?
Thanks,
Alvise
*Da:* gpfsug-discuss-bounces@spectrumscale.org < gpfsug-discuss-bounces@spectrumscale.org> *Per conto di *Dorigo Alvise (PSI) *Inviato:* lunedì 13 dicembre 2021 11:50 *A:* gpfsug main discussion list <gpfsug-discuss@spectrumscale.org> *Oggetto:* [gpfsug-discuss] R: Question on changing mode on many files
I am definitely going to try this solution with mmfind.
Thank you also for the command line and several hints… I’ll be back with the outcome soon.
Alvise
*Da:* gpfsug-discuss-bounces@spectrumscale.org < gpfsug-discuss-bounces@spectrumscale.org> *Per conto di *Alec *Inviato:* domenica 12 dicembre 2021 23:04 *A:* gpfsug main discussion list <gpfsug-discuss@spectrumscale.org> *Oggetto:* Re: [gpfsug-discuss] Question on changing mode on many files
How am I just learning about this right now, thank you! Makes so much more sense now the odd behaviors I've seen over the years on GPFS vs POSIX chmod/ACL. Will definitely go review those settings on my filesets now, wonder if the default has evolved from 3.x -> 4.x -> 5.x.
IBM needs to find a way to pre-compile mmfind and make it supported, it really is essential and so beneficial, and so hard to get done in a production regulated environment. Though a bigger warning that the compress option is an action not a criteria!
Alec
On Sun, Dec 12, 2021 at 9:01 AM Simon Thompson <s.j.thompson@bham.ac.uk> wrote:
I'm not sure if this happens on Spectrum Scale but on most FS's if you do a chmod 770 file you'll lose any ACLs assigned to the file, so safest to bump the permissions with a subtractive or additive o-w or g+w type operation.
This depends entirely on the fileset setting, see:
https://www.ibm.com/docs/en/spectrum-scale/5.1.2?topic=reference-mmchfileset...
“*allow-permission-change*”
We typically have file-sets set to chmodAndUpdateAcl, though not exclusively, I think it was some quirky software that tested the permissions after doing something and didn’t like the updatewithAcl thing …
Simon
_______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss
_______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss
participants (5)
-
Alec -
Dorigo Alvise (PSI) -
Frederick Stock -
Jonathan Buzzard -
Simon Thompson
