-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add check if device is in use. #1
Comments
Someone needs to convert this script to work on Freenas. |
Thanks for your comment! I've never run into the problem of mounted drives not being available, probably because I only ever run the script on new drives, or old drives that I want to vet before putting them into service. I either case, I always pay very close attention to drive ID so that I won't mistakenly destroy data on the wrong drive! That said, do you know of a reliable way for a script to determine whether or not it's safe to run badblocks on a drive? |
Hello @Spearfoot! Sorry for the ridiculous long time it took me to answer. Whether it's safe or not to run badblocks on a device is kinda up to the user. Badblocks wont complain if a device have one or more partitions, it'll just happily write them over if none of them are mounted. I only suggest that early in the script (before the SMART tests) there is a check if any partition on the device is mounted. Otherwise the script will run for several hours before it comes to badblocks which then fails if anything actually was mounted. If you want I can make a small check using grep and /proc/mounts and send a PR. |
nybogard: pulls requests are always welcome! |
I ran your script on an 8TB disk but it finished after just a couple of days. I discovered that badblocks had exited immediately with no apparent reason. It just said that it had finished and then the script continued with the next step.
When I ran badblocks myself I got the message
Apparently I had missed to unmount the drive. It would be nice if the script did a check if the device is mounted directly when you run it and warns you.
Thanks for a awsome project!
The text was updated successfully, but these errors were encountered: