Find it

Wednesday, October 28, 2009

Replacing/Relabeling the Root Pool Disk

Unfortunately one of disk associated to rootpool went crazy and fun started for a day there!!! Let's fix it. BTW now a days I am testing a small part of rpool recovery after system crash... This experience is from rpool recovery and testing project.

One can see belwo shown error if something wrong with the root pool disk -

# zpool status -x
pool: rpool
state: DEGRADED
status: One or more devices could not be opened. Sufficient replicas exist for
the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using 'zpool online'.
see: http://www.sun.com/msg/ZFS-8000-2Q
scrub: none requested
config:


NAME STATE READ WRITE CKSUM
rpool DEGRADED 0 0 0
mirror DEGRADED 0 0 0
c0t0d0s0 UNAVAIL 0 0 0 cannot open
c0t2d0s0 ONLINE 0 0 0


errors: No known data errors

Have bad disk replaced with good one or brand new disk.

# zpool offline rpool c0t0d0s0
# cfgadm -c unconfigure c1::dsk/c0t0d0

Physically replace the primary disk. In my case it is c0t0d0s0.

Now I am labeling/relabeling the disk. Label rpool disk always with SMI label format and not EFI.

# format -e
Searching for disks...done




AVAILABLE DISK SELECTIONS:
0. c0t0d0
/pci@1f,0/ide@d/dad@0,0
1. c0t2d0
/pci@1f,0/ide@d/dad@2,0
Specify disk (enter its number): 0
selecting c0t0d0
[disk formatted, no defect list found]




FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition table
current - describe the current disk
format - format and analyze the disk
repair - repair a defective sector
show - translate a disk address
label - write label to the disk
analyze - surface analysis
defect - defect list management
backup - search for backup labels
verify - read and display labels
save - save new disk/partition definitions
volname - set 8-character volume name
! - execute , then return
quit
format> l
[0] SMI Label
[1] EFI Label
Specify Label type[0]: 0
Ready to label disk, continue? yes


format>

Reconfigure the disk and bring it online, if required.

# cfgadm -c configure c1::dsk/c0t0d0
# zpool online rpool c0t0d0

Before de-attach you can replace it however I dont see much need of this step in my case it failed so I am directly De-attach the bad disk from the pool

# zpool detach rpool c0t0d0s0

See the status

# zpool status -v
pool: rpool
state: ONLINE
scrub: none requested
config:


NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
c0t2d0s0 ONLINE 0 0 0


errors: No known data errors

Now we have newly added disk to the system and we need to add/attach this to the pool.

# zpool attach rpool c0t2d0s0 c0t0d0s0
Please be sure to invoke installboot(1M) to make 'c0t0d0s0' bootable.

Check the resilvering status of the newly attached disk.

# zpool status rpool
pool: rpool
state: ONLINE
status: One or more devices is currently being resilvered. The pool will
continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
scrub: resilver in progress for 0h2m, 25.39% done, 0h6m to go
config:


NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror ONLINE 0 0 0
c0t2d0s0 ONLINE 0 0 0
c0t0d0s0 ONLINE 0 0 0 1.62G resilvered


errors: No known data errors

After the disk resilvering is complete, install the boot blocks.

# installboot -F zfs /usr/platform/`uname -i`/lib/fs/zfs/bootblk /dev/rdsk/c0t0d0s0

Confirm that you can boot from the replacement disk.

REF: http://www.solarisinternals.com/

1 comment: