zpool - device is too small

This happend to me today on one of the “new” SPARC boxes I just received. Both disks are exactly the same so I was a little bit confused why that happened. I’ve got two disks and would like to attach the second one as a mirror.

$ zpool attach rpool c1t0d0s0 c1t1d0s0
invalid vdev specification
use '-f' to override the following errors:
/dev/dsk/c1t1d0s0 contains a ufs filesystem.

So why is an UFS filesystem on one of my disks, which should be “factory default”. Even trying the suggested -f option the force(TM) is not with me.

$ zpool attach -f rpool c1t0d0s0 c1t1d0s0
cannot attach c1t1d0s0 to c1t0d0s0: device is too small

It looked like the installer has done some magic on one of the devices which isn’t used during installation. You can view the partition config of a device with prtvtoc. For example the disk which is currently in use:

$ prtvtoc /dev/dsk/c1t0d0s0
* /dev/dsk/c1t0d0s0 partition map
*
* Dimensions:
*     512 bytes/sector
*     625 sectors/track
*      20 tracks/cylinder
*   12500 sectors/cylinder
*   46875 cylinders
*   46873 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00          0 585912500 585912499
       2      5    01          0 585912500 585912499

Because I’m sure both disks look exact the same, I could dump the partition map from the first disk and restore it on the second disk.

# Dump partition table to file
$ prtvtoc /dev/dsk/c1t0d0s0 > /tmp/dsk-partition.dump

Using fmthard to restore the partition table to the second disk.

$ fmthard -s /tmp/dsk-partition.dump /dev/rdsk/c1t1d0s0
fmthard: New volume table of contents now in place.

Problem fixed, now I could easily add the device to the zpool.

$ zpool attach rpool c1t0d0s0 c1t1d0s0

Posted

July 10, 2015, 12:49 pm

Tags

, , , , ,

More

Permalink

Comments

Send your comment by mail.