replacing drive in 8.0.3, please clarify

Status
Not open for further replies.

peterh

Patron
Joined
Oct 19, 2011
Messages
315
I've just received notifications from smartd that one disk in a hp n36 has uncorrectable errors.
zpool status shows no problems (yet).

Looking through the documentation for 8.0.3 shows in chapter 6.3.9 "Replacing a failed drive"
that i should use the GUI to detatch the failed disk, then by using shell commands:
swapoff ( i don't care since i don't swap) and then
zpool offline <the failed disk>

at this point swap drives ( i do not have any spare slots so i have to physically remove the old drive
before installing the new )

with the new drive use gpart -create -s gpt <i suppose i use ada0 here ?Thats the disk i replace)
btw the old disk shows with gpart show ada0:
[root@fnas] ~# gpart show ada0
=> 34 1953525101 ada0 GPT (932G)
34 94 - free - (47K)
128 1953525007 1 freebsd-zfs (932G)

i see 2 partitions, one swap of 94 bytes and one with 1953525007 bytes of type freebsd-zfs.
Thus i guess that the gpart command would be : ( right ?)
gpart add -b 34 -s 94 -t freebsd-swap ada0
gpart add -t freebsd-zfs ada0

finally, still in a shell, i do :
zpool replace <pool> ada0p2
zpool detach <pool> ada0p2/old


HOWEVER, in the same documentation 10.8.4 How do I replace a bad drive?
the procedure is to power down, physically replace the disk, and
zpool replace <pool> ada0
( wait for resilver to finish )
zpool detach <pool> ada0/old
zpool export <pool>

and finally in the GUI Storage -> Volumes -> Auto Import


I'm not unfamiliar doing the whole process in freebsd/sunkos, but then i had spare slots and
no GUI to care for. Whats the recommended procedure in freenas 8.0.3 ?
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
10.8.4 is for people that do not have the ability to hot-swap. If you aren't sure there is no risk of doing the shutdown and startup. Personally, I never do drive replacements online because if you accidentally pull the wrong drive while online you're now missing 2 drives. If you are RAIDZ you are pretty much screwed. If RAIDZ2 you are missing all of your parity protection.

I'd rather do the shutdown and powerup so that if I pull the wrong drive I can always plug it back in and the server won't know any better.

Here's what I would do: (basically section 10.8.4 with more detail).

1. Record the serial number for the bad disk.
2. Do section 6.3.9 of the manual for 8.0.3(click the replace button, then offline).
3. Then do a server shutdown.
4. Pull out the bad drive. Verify that the serial number is the drive you took offline. If it is, insert a new drive. Bootup the server.
5. Perform 10.8.4 steps 3-9.

After it finishes resilvering you should do a zpool status and see that nothing is degraded or offline.

Edit: You may want to consider upgrading to the latest version of FreeNAS first. It's up to you.
 

peterh

Patron
Joined
Oct 19, 2011
Messages
315
the first step using GUI worked, but i never got any second step ( offline)
after shutdown / replace / boot the shell zpool commands did not work :
[root@fnas] ~# zpool replace fnas /dev/ada0
cannot replace /dev/ada0 with /dev/ada0: no such device in pool
[root@fnas] ~# zpool detach fnas ada0
cannot detach ada0: no such device in pool

I could however use the GUI to replace, and the resilvering started. So i'm close to home.

Is 8.0.4 better in this respect ?
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I'm not sure if its "better" than 8.0.3. I've only had to use 8.0.4 and 8.2 when replacing a hard drive. You do know that 8.0.3 has at least 1 security vulnerability that is only fixed by upgrading to 8.0.4p3(or whatever the latest is) or newer?
 

leenux_tux

Patron
Joined
Sep 3, 2011
Messages
238
Post a reply to the thread: replacing drive in 8.0.3, please clarify

peterh,

I have just gone through a complete disk replacement on my system, not because I had problems with my disks, but because I wanted to increase the amount of disk capacity I had by replacing all my 1TB drives with 2TB drives, one at a time, waiting for the RAIDZ to resilver before moving on to the next drive.

Luckily for me I have a case where the drives can easily be removed and replaced as needed.

Steps I took are as follows....

1, Identify the drive to be replaced. This required a shutdown. For me I took all of the drives out and wrote down the serial numbers for each one.
2, Boot the system back up
3, Go to "View Disks" on "Storage", choose the drive you want to replace and click "Replace", wait a few seconds for the command to process.
4, Shutdown.
5, Physically replace the drive with a new one.
6, Boot up, you will see in the GUI that the ZPOOL is in "Degraded" state.
7, Go to the "View Disks" area in "Storage".
8, Select the disk you are replacing, click "Replace Disk", you should then see your new disk available in the drop down, select this disk and click "Replace". This can take some time to complete. For me it was around 60 seconds.
9, A new entry will appear in the list of disks, this, as far as I understand it represents the old drive.
10, Click on "Detach", and detach the drive, again, this might take some time to complete. Mine took around 20 seconds. As I understand it you are just removing the reference to the drive from the ZFS database.
11, SSH to the server (or access the CLI from the console) and enter "zpool status ZPOOL_NAME". You will see some text stating that the new disk is being resilvered.

I'm not 100% sure that step 3 actually does anything, however, doing it didn't cause a problem.

Once the reslivering had completed and I ran a "scrub" (i.e, I was happy that it had all worked OK) I then went through the whole process again (from step 3) with the next drive, then again with the last drive.

Resilvering can take a long time, depending upon how much data you have, mine took around 8 hours per iteration of disk replacement.

Now this part is only for the process I went through as I was replacing all disks and wanted to make sure the extra disk space could be seen by FreeNAS. After all the disks to be replaced, are replaced, you need to export the pool and re-import, you can do this either from the GUI or from the CLI, it all depends on your preferences, and, this is where it got REALLY scary for me as the export went OK, but when I tried to re-import the pool, FreeNAS couldn't find it !! In the end I just rebooted and everything came back fine.

.
 

peterh

Patron
Joined
Oct 19, 2011
Messages
315
thanks!
( i'll fill up with random characters to satisfy the forum rules :smile:
 
Status
Not open for further replies.
Top