bobbintb Posted June 19, 2016 Share Posted June 19, 2016 I am trying to write a script and I need to know how many disk are in my system. Yes, I can just hard code the number but I plan on sharing it and want to do it the proper way. Is there a way to programmatically find out how many disks are mounted in the array? Quote Link to comment
Squid Posted June 19, 2016 Share Posted June 19, 2016 You can parse /var/local/emhttp/disks.ini Or just keep testing if /mnt/disk1, /mnt/disk2, /mnt/disk3, ... exists as a directory. Quote Link to comment
Squid Posted June 19, 2016 Share Posted June 19, 2016 even better, parse var.ini mdNumDisks="XX" Quote Link to comment
bobbintb Posted June 19, 2016 Author Share Posted June 19, 2016 You can parse /var/local/emhttp/disks.ini Or just keep testing if /mnt/disk1, /mnt/disk2, /mnt/disk3, ... exists as a directory. OK, I'll take a look at the ini. My initial idea was your second suggestion. But come to think of it, I don't really need to know how many disks there are. I'm really just trying to find which disk a file is on and the simplest thing would probably be to just search disks 1 to 21 (or whatever the upward limit is) until it finds it. Quote Link to comment
Squid Posted June 19, 2016 Share Posted June 19, 2016 http://linux.die.net/man/1/find Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.