Removing multiple hdisk from smitty->devices ->fixed disk-> remove

0

Original Code that I saw

I want to do the same thing but need to make sure i dont delete hdisk0 since this is my OS.

photo of drives being deleted.

Jakekq

Posted 2016-08-30T13:04:10.447

Reputation: 3

Answers

0

If the hdisk0 is in use the system wont delete it. it will error out

"smitty->devices ->fixed disk-> remove" don't have the option to select multiple. if you want to remove multiple disks use the following for loop.

it will remove all disks but hdisk0.

for i in `lspv |grep -v hdisk0|awk '{print $1}'`;do rmdev -dl $i; done

if you want to remove all defined disk:

for i in `lsdev -Cc disk |grep Defined|awk '{print $1}'`; do rmdev -dl $i; done

the -d in rmdev command removes the device definition.

JDababseh

Posted 2016-08-30T13:04:10.447

Reputation: 16

so on the command line am i running that entire line?? for i in lspv |grep -v hdisk0|awk '{print $1}'; do rmdev-dl $i; done ??? – Jakekq – 2016-08-30T15:12:08.393

Yes. just fixed the formatting – JDababseh – 2016-08-30T15:14:40.537

https://gyazo.com/d6137e96f291a3a3d2dea218826cda08 is the loop an actual value of how many drives i have in there?? – Jakekq – 2016-08-30T15:16:06.633

Yes. the lspv command will list all disks. and the grep -v will exclude hdisk0. – JDababseh – 2016-08-30T15:17:31.743

Are you trying to remove just the defined disks? – JDababseh – 2016-08-30T15:17:54.583

Yeah so i want to do grep Defined. Im removing all the defined formats. Since these are all created after I format drives. And when Im doing up to 40 at a time its a pain to have to remove each one individually. – Jakekq – 2016-08-30T15:19:36.063

then use the second for loop – JDababseh – 2016-08-30T15:20:51.867

https://gyazo.com/86b044f0e4ab7ce2d8a989bc46096672 – Jakekq – 2016-08-30T15:22:06.323

Should i do -Cc fixed disk?? – Jakekq – 2016-08-30T15:23:32.680

yes the second for loop not the first one – JDababseh – 2016-08-30T15:24:17.767

I took a photo. It gave me an error of rmdev: not a recognized flag: C and rmdev: '}' not found – Jakekq – 2016-08-30T15:31:18.963

Please copy the second for loop and paste that in your shell. you replaced the ticks with single quote – JDababseh – 2016-08-30T15:40:43.480