Here&s how I do mirroring for the root pool (rpool) to have redundant disk for the OS partition, based on the following guide
http://malsserver.blogspot.com/2008/08/mirroring-resolved-correct-way.html
http://darkstar-solaris.blogspot.com/2008/09/zfs-root-mirror.html
Please note that the first format command is used to know the disk number/name.
Please check comments at the end of this article.
root@opensolaris:/dev/dsk# zpool status -v
pool: rpool
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
c8t0d0s0 ONLINE 0 0 0
errors: No known data errors
root@opensolaris:/dev/dsk# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c8t0d0
/pci@0,0/pci8086,2829@d/disk@0,0
1. c8t1d0
/pci@0,0/pci8086,2829@d/disk@1,0
2. c8t2d0
/pci@0,0/pci8086,2829@d/disk@2,0
3. c8t3d0
/pci@0,0/pci8086,2829@d/disk@3,0
Specify disk (enter its number): ^C
root@opensolaris:/dev/dsk# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c8t0d0
/pci@0,0/pci8086,2829@d/disk@0,0
1. c8t1d0
/pci@0,0/pci8086,2829@d/disk@1,0
2. c8t2d0
/pci@0,0/pci8086,2829@d/disk@2,0
3. c8t3d0
/pci@0,0/pci8086,2829@d/disk@3,0
Specify disk (enter its number): 1
selecting c8t1d0
[disk formatted]
No Solaris fdisk partition 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
fdisk - run the fdisk program
repair - repair a defective sector
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
inquiry - show vendor, product and revision
volname - set 8-character volume name
!
quit
format> fdisk
No fdisk table exists. The default partition for the disk is:
a 100% "SOLARIS System" partition
Type "y" to accept the default partition, otherwise type "n" to edit the
partition table.
y
format> quit
root@opensolaris:/dev/dsk# prtvtoc /dev/rdsk/c8t0d0s2 | fmthard -s - /dev/rdsk/c8t1d0s2
fmthard: New volume table of contents now in place.
root@opensolaris:/dev/dsk# prtvtoc /dev/rdsk/c8t0d0s2
* /dev/rdsk/c8t0d0s2 partition map
*
* Dimensions:
* 512 bytes/sector
* 63 sectors/track
* 255 tracks/cylinder
* 16065 sectors/cylinder
* 2609 cylinders
* 2607 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* Unallocated space:
* First Sector Last
* Sector Count Sector
* 0 16065 16064
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
0 2 00 16065 41865390 41881454
2 5 01 0 41881455 41881454
8 1 01 0 16065 16064
root@opensolaris:/dev/dsk# prtvtoc /dev/rdsk/c8t1d0s2
* /dev/rdsk/c8t1d0s2 partition map
*
* Dimensions:
* 512 bytes/sector
* 63 sectors/track
* 255 tracks/cylinder
* 16065 sectors/cylinder
* 2609 cylinders
* 2607 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* Unallocated space:
* First Sector Last
* Sector Count Sector
* 0 16065 16064
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
0 2 00 16065 41865390 41881454
2 5 01 0 41881455 41881454
8 1 01 0 16065 16064
root@opensolaris:/dev/dsk# zpool status
pool: rpool
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
c8t0d0s0 ONLINE 0 0 0
errors: No known data errors
root@opensolaris:/dev/dsk# zpool attach rpool c8t0d0s0 c8t1d0s0
invalid vdev specification
use '-f' to override the following errors:
/dev/dsk/c8t1d0s0 overlaps with /dev/dsk/c8t1d0s2
root@opensolaris:/dev/dsk# zpool attach -f rpool c8t0d0s0 c8t1d0s0
Please be sure to invoke installgrub(1M) to make 'c8t1d0s0' bootable.
root@opensolaris:/dev/dsk# zpool status
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 0h0m, 11.37% done, 0h3m to go
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror ONLINE 0 0 0
c8t0d0s0 ONLINE 0 0 0
c8t1d0s0 ONLINE 0 0 0 419M resilvered
errors: No known data errors
root@opensolaris:/dev/dsk# zpool status
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 0h1m, 46.50% done, 0h2m to go
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror ONLINE 0 0 0
c8t0d0s0 ONLINE 0 0 0
c8t1d0s0 ONLINE 0 0 0 1.68G resilvered
errors: No known data errors
root@opensolaris:/dev/dsk# zpool status
pool: rpool
state: ONLINE
scrub: resilver completed after 0h3m with 0 errors on Fri Jan 15 10:57:32 2010
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror ONLINE 0 0 0
c8t0d0s0 ONLINE 0 0 0
c8t1d0s0 ONLINE 0 0 0 3.62G resilvered
errors: No known data errors
root@opensolaris:/dev/dsk#
root@opensolaris:/dev/dsk# prtvtoc /dev/rdsk/c8t0d0s0
* /dev/rdsk/c8t0d0s0 partition map
*
* Dimensions:
* 512 bytes/sector
* 63 sectors/track
* 255 tracks/cylinder
* 16065 sectors/cylinder
* 2609 cylinders
* 2607 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* Unallocated space:
* First Sector Last
* Sector Count Sector
* 0 16065 16064
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
0 2 00 16065 41865390 41881454
2 5 01 0 41881455 41881454
8 1 01 0 16065 16064
root@opensolaris:/dev/dsk# prtvtoc /dev/rdsk/c8t1d0s0
* /dev/rdsk/c8t1d0s0 partition map
*
* Dimensions:
* 512 bytes/sector
* 63 sectors/track
* 255 tracks/cylinder
* 16065 sectors/cylinder
* 2609 cylinders
* 2607 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* Unallocated space:
* First Sector Last
* Sector Count Sector
* 0 16065 16064
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
0 2 00 16065 41865390 41881454
2 5 01 0 41881455 41881454
8 1 01 0 16065 16064
root@opensolaris:/dev/dsk# installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c8t1d0s0
stage1 written to partition 0 sector 0 (abs 16065)
stage2 written to partition 0, 271 sectors starting at 50 (abs 16115)
root@opensolaris:/dev/dsk#
COMMENTS from Malachi&s Guide
I run the second format command and pick fdisk in my guide, so maybe due to that, there&s no error in my guide.
It appears that we were missing a step....
before doing the fmthard, you have to do fdisk on the new drive.
In my case, I did 'pfexec fdisk /dev/rdsk/c4t1d0s2', it complained, I said yes then everything was fine.
If you skip this step, you'll get:
fmthard: Partition 2 specifies the full disk and is not equal
and later:
"Partition 0 of the disk has an incorrect offset"
A couple things maybe worth mentioning. If you hotplug a SATA disk, and your controller supports hotswapping, you may still have to do cfgadm and check the state of the drive. (This happens on an nVidia 610i) If it's unconfigured just cfgadm -c configure SATA1/1 or whatever port it's on. Then you should be able to add it to the pool. The other advantage is it will give the address (c0t0d0 etc. of the new drive). This will not work for IDE, and I don't have any SCSI drives to try this with so I can't say if itworks the same way.
Also, I have been trying to figure out a way to find the IDE (SCSI?) disks other than using the format command. Yeah you can control C out of it but it just makes me nervous having to tell someone else to do that. Especially some of the Windows users, say the word format and they get all red nervous and itchy ;)
No comments:
Post a Comment