Script to Identify Disk Drives - device name / Serial / GPTID

Status
Not open for further replies.

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Why not answer your question by swapping a couple of disks and see if the da# changes - it won't do any harm as long as you are careful. (Export the pool, Power down, swap the drives, power up, import the pool) I'd be interested in knowing - report back.
You can even pull a disk and put it in another slot while the system is running (if hot-swap is supported by the hardware) and FreeNAS will find the disk and put it back in the pool.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
You can even pull a disk and put it in another slot while the system is running (if hot-swap is supported by the hardware) and FreeNAS will find the disk and put it back in the pool.
Point of clarification - I'm assuming you mean after exporting the pool? I've been doing that with a single disk pool for backup - really handy.

Since I don't know @Rob Townley or what hardware his is using or how it is configured (or if a NOOB might someday read this and bork up his pool), I thought I'd error on the side of safety-taking the extra few minutes to power off won't hurt anything and adds an element of safety, but not powering off may be really bad if something isn't done right.
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Point of clarification - I'm assuming you mean after exporting the pool? I've been doing that with a single disk pool for backup - really handy.
Well, for your single disk pool, where you are taking the disk out to keep it out, you would want to export it. In my pool, running RAID-z2, I have had the occasional need to remove a drive and it can be done and the drive can be put back in without exporting the pool or shutting the server down. Now, I am talking about having the drive out for a very short period of time, but it should be re-detected and re-synced into the pool without even needing to tell the system anything. The status in the upper right corner of the GUI goes red because the pool is degraded and when the drive is put back in, the status goes back to green and the pool is healthy again all with no action except removal and insertion of the disk. You can even remove more than one disk as long as you don't remove more than the redundancy will tolerate. Two in my system.
I thought I'd error on the side of safety-taking the extra few minutes to power off won't hurt anything and adds an element of safety, but not powering off may be really bad if something isn't done right.
Wise choice, and that is part of the reason I was specific about hardware that supports hot-swap. If you are not sure, don't try it. Also interesting to note, the (new for 11.1) mirrored swap will not re-mirror at this time. Your swap will be degraded until you reboot and an export / import doesn't fix that because swap is only allocated at boot time.
 
Last edited:

NASbox

Guru
Joined
May 8, 2012
Messages
650
Well, for your single disk pool, where you are taking the disk out to keep it out, you would want to export it. In my pool, running RAID-z2, I have had the occasional need to remove a drive and it can be done and the drive can be put back in without exporting the pool or shutting the server down. Now, I am talking about having the drive out for a very short period of time, but it should be re-detected and re-synced into the pool without even needing to tell the system anything. The status in the upper right corner of the GUI goes red because the pool is degraded and when the drive is put back in, the status goes back to green and the pool is healthy again all with no action except removal and insertion of the disk. You can even remove more than one disk as long as you don't remove more than the redundancy will tolerate. Two in my system.

Wow! I'd expect that would either screw things up and require a resilver-or does it need to resilver?

I'm assuming that you are being careful to make sure nothing writes to the pool while the drive is out???

Just curious... how come you need to pull a drive off a pool and quickly put it back?
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I'm assuming that you are being careful to make sure nothing writes to the pool while the drive is out???
If something writes to the pool, a resilver will be required, but it would normally be very quick--resilvers only need to write what's changed since the disk was removed.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
If something writes to the pool, a resilver will be required, but it would normally be very quick--resilvers only need to write what's changed since the disk was removed.
The more I learn about ZFS, the more impressed I am become!
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Wow! I'd expect that would either screw things up and require a resilver-or does it need to resilver?

I'm assuming that you are being careful to make sure nothing writes to the pool while the drive is out???

Just curious... how come you need to pull a drive off a pool and quickly put it back?
The way I found out about this feature was by accident. Before the day of mirrored swap, if you had any swap being used, taking a drive out like that would crash the system. Now that the swap is mirrored, I had an incident where the eject switch was inadvertently pressed on one of my drives. I didn't even realize it was ejected until I got the email alert that the pool was degraded. I went to check on the server, found the drive ejected just enough to break contact and pushed it back in. By the time I got back to my desk, the system was healthy and happy again.

After that, I did it again just to see what would happen. I sometimes do things just to see what will happen, so I know for sure how it will work. It is much less stressful to do that when you have a whole backup server with a duplicate of all the data.
 

Rob Townley

Dabbler
Joined
May 1, 2017
Messages
19
The output of the script you asked about is under diskLocation.bash in original post. Outputs both Dk# and da# along with serial using diskinfo -v.

The hardware is a 12 drive mix of SAS and SATA. Details in signature.

Good post. Frustrating how many expensive hardware raid systems could not handle identifying their own drives by utilizing their own metadata on the drives themselves. But coming from hardware raid that changes green light on failing drive to yellow or red, identifying exactly the drive to replace was the norm. Otherwise, what happens if too many wrong drives are pulled before resilvered?
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Unlike hardware RAID if you pull the wrong drive, and reinstall it in a short time, the system will automatically reintegrate the drive, no parity rebuild required. Quick and easy. Just ensure that the drive is back in the online condition before pulling any other drive.
It is best to mark the drives so they can be located with certainty. I put a label with the last few digits of the serial number on the outside of the drive bracket.

Sent from my SAMSUNG-SGH-I537 using Tapatalk
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
Unlike hardware RAID if you pull the wrong drive, and reinstall it in a short time, the system will automatically reintegrate the drive, no parity rebuild required. Quick and easy. Just ensure that the drive is back in the online condition before pulling any other drive.
It is best to mark the drives so they can be located with certainty. I put a label with the last few digits of the serial number on the outside of the drive bracket.
Clearly the best idea...

To keep in mind... If a pool is running RAIDZ1, and one drive is failed, pull the wrong drive and the pool is pooched!

If there are any writes they are gone... what about if the pool is quiet? Any coming back from either scenario?
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Clearly the best idea...

To keep in mind... If a pool is running RAIDZ1, and one drive is failed, pull the wrong drive and the pool is pooched!

If there are any writes they are gone... what about if the pool is quiet? Any coming back from either scenario?
A big part of the reason RAID-z1 is (by some people) considered to be dead and not to be used. It is like hardware RAID-5 in that it can ONLY suffer one drive failure. Any additional fault will loose the pool. It is very fragile, like a mirror. You can only loose one drive and if you loose a second, you could be totally 'pooched'...

I would never setup a primary storage pool as anything less than RAID-z2. I have setup pools of mirrors when the workload called for it, but if you do, a backup is critically important because the pool is potentially very fragile and this is not what I would call a "storage" pool. .
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
If a pool is running RAIDZ1, and one drive is failed, pull the wrong drive and the pool is pooched!
No, it isn't. If one disk is failed, and you pull the wrong one, the pool drops offline. Put the incorrectly-removed disk back in, bring it online, and the pool is back.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
A big part of the reason RAID-z1 is (by some people) considered to be dead and not to be used. It is like hardware RAID-5 in that it can ONLY suffer one drive failure. Any additional fault will loose the pool. It is very fragile, like a mirror. You can only loose one drive and if you loose a second, you could be totally 'pooched'...

I would never setup a primary storage pool as anything less than RAID-z2. I have setup pools of mirrors when the workload called for it, but if you do, a backup is critically important because the pool is potentially very fragile and this is not what I would call a "storage" pool. .
Again, one has to keep things in perspective.... a few years ago many applications would only be a single drive, if it died, everything was gone that wasn't backed up. I agree though for anything important, or very large I think Z2 or maybe Z3 is the way to go.

I'm considering Z1 for my desktop system (currently a simple mirror) on Linux. Might add a 3rd disk in Z1, but only on small drives - 1TB, maybe 2 TB MAX! A good automatic snapshot regime would reduce ransomware from a major incident to a nuisance.

No, it isn't. If one disk is failed, and you pull the wrong one, the pool drops offline. Put the incorrectly-removed disk back in, bring it online, and the pool is back.
Thanks for the correction..... that's exactly why I made the comment that I made... I knew someone would set me straight if I had it wrong.

I said it before, and I'll likely say it again, the more I learn about ZFS, the more I like it.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
The output of the script you asked about is under diskLocation.bash in original post. Outputs both Dk# and da# along with serial using diskinfo -v.

This is totally munged...
0
9WK0KP9E # Disk ident.
id1,enc@n50050cc10b8b701d/type@0/slot@1/elmdesc@Dk0_ # Physical path
I wanted to see a complete diskinfo -v. This output looks very different from what I am getting.
 
Status
Not open for further replies.
Top