ZFS mirror on 2nd MS-DOS partitions

Using information from ZFS Configuration Guide - Siwiki:

root@openindiana:~# parted -m #c3t0d0p0 is the USB live OpenIndiana disk.

GNU Parted 1.8.8

Using /dev/dsk/c3t0d0p0

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) print

print

BYT;

/dev/dsk/c3t0d0p0:4023MB:ide:512:512:msdos:Generic Ide;

1:2097kB:998MB:996MB:solaris::boot;

(parted) quit

quit

root@openindiana:~# parted -ml

BYT;

/dev/dsk/c3t0d0p0:4023MB:ide:512:512:msdos:Generic Ide;

1:2097kB:998MB:996MB:solaris::boot;

BYT;

/dev/dsk/c4t0d0p0:1000GB:ide:512:512:msdos:Generic Ide;

1:32.3kB:105GB:105GB:fat32::boot, lba;

2:105GB:1000GB:895GB:::;

BYT;

/dev/dsk/c4t0d1p0:1000GB:ide:512:512:msdos:Generic Ide;

1:32.3kB:10.5GB:10.5GB:ntfs::;

2:10.5GB:1000GB:990GB:::;

root@openindiana:~# parted -l

Model: Generic Ide (ide)

Disk /dev/dsk/c3t0d0p0: 4023MB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 2097kB 998MB 996MB primary solaris boot

Model: Generic Ide (ide)

Disk /dev/dsk/c4t0d0p0: 1000GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 32.3kB 105GB 105GB primary fat32 boot, lba

2 105GB 1000GB 895GB primary

Model: Generic Ide (ide)

Disk /dev/dsk/c4t0d1p0: 1000GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 32.3kB 10.5GB 10.5GB primary ntfs

2 10.5GB 1000GB 990GB primary

root@openindiana:~#

Partition #2 on each disk is where I want to put the zfs mirrorn 2 on each disk is where I want to put the zfs mirror

root@openindiana:~# zpool status

no pools available

root@openindiana:~# zpool create -f mypool mirror c4t0d0p2 c4t0d1p2

root@openindiana:~# zpool status

pool: mypool

state: ONLINE

scan: none requested

config:

NAME STATE READ WRITE CKSUM

mypool ONLINE 0 0 0

mirror-0 ONLINE 0 0 0

c4t0d0p2 ONLINE 0 0 0

c4t0d1p2 ONLINE 0 0 0

errors: No known data errors

root@openindiana:~# zpool list

NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT

mypool 832G 108K 832G 0% 1.00x ONLINE -

root@openindiana:~#

Whoops! noticed later that the first disk has a 895GB partition and the second has a 990GB partition.

Not what I wanted. Let's kill the second disk in the mirror.

root@openindiana:~# zpool detach mypool c4t0d1p2

root@openindiana:~# zpool list

NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT

mypool 832G 112K 832G 0% 1.00x ONLINE -

root@openindiana:~# zpool status

pool: mypool

state: ONLINE

scan: none requested

config:

NAME STATE READ WRITE CKSUM

mypool ONLINE 0 0 0

c4t0d0p2 ONLINE 0 0 0

errors: No known data errors

root@openindiana:~#

=========================Repartition to match disk c4tod0====================

root@openindiana:~# parted /dev/dsk/c4t0d1p0 print

Model: Generic Ide (ide)

Disk /dev/dsk/c4t0d1p0: 1000GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 32.3kB 105GB 105GB primary ntfs boot

2 105GB 1000GB 895GB primary

root@openindiana:~# parted /dev/dsk/c4t0d0p0 print

Model: Generic Ide (ide)

Disk /dev/dsk/c4t0d0p0: 1000GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 32.3kB 105GB 105GB primary fat32 boot, lba

2 105GB 1000GB 895GB primary

root@openindiana:~#

Now lets add the new partition to the mypool as a mirror

root@openindiana:~# time zpool add mypool mirror d4t0d0p2 c4t0d1p2

cannot open 'd4t0d0p2': no such device in /dev/dsk

must be a full path or shorthand device name

real 0m0.004s

user 0m0.002s

sys 0m0.003s

root@openindiana:~# time zpool add mypool mirror c4t0d0p2 c4t0d1p2

invalid vdev specification

use '-f' to override the following errors:

mirror contains devices of different sizes

real 0m0.041s

user 0m0.012s

sys 0m0.017s

root@openindiana:~# volcheck

root@openindiana:~# time zpool add mypool mirror c4t0d0p2 c4t0d1p2

invalid vdev specification

use '-f' to override the following errors:

mirror contains devices of different sizes

real 0m0.041s

user 0m0.012s

sys 0m0.017s

root@openindiana:~#

Note:

This creates an ordinary NON-MIRRORED pool called mypool

root@openindiana:~# time zpool create mypool c4t0d0p2 c4t0d1p2

real 0m0.491s

user 0m0.016s

sys 0m0.026s

root@openindiana:~# zpool list

NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT

mypool 1.71T 119K 1.71T 0% 1.00x ONLINE -

root@openindiana:~# zpool status

pool: mypool

state: ONLINE

scan: none requested

config:

NAME STATE READ WRITE CKSUM

mypool ONLINE 0 0 0

c4t0d0p2 ONLINE 0 0 0

c4t0d1p2 ONLINE 0 0 0

errors: No known data errors

root@openindiana:~#

================================WHOOPS!==========================

Blew away USB disk partition table

root@openindiana:~# parted -lm

BYT;

/dev/dsk/c3t0d0p0:4023MB:ide:512:512:msdos:Generic Ide;

1:2097kB:998MB:996MB:solaris::boot;

BYT;

/dev/dsk/c4t0d0p0:1000GB:ide:512:512:msdos:Generic Ide;

1:32.3kB:105GB:105GB:fat32::boot, lba;

2:105GB:1000GB:895GB:::;

BYT;

/dev/dsk/c4t0d1p0:1000GB:ide:512:512:msdos:Generic Ide;

1:32.3kB:105GB:105GB:ntfs::boot;

2:105GB:1000GB:895GB:::;

root@openindiana:~# parted

GNU Parted 1.8.8

Using /dev/dsk/c3t0d0p0

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) unit

unit

Unit? [compact]?

(parted) help unit

help unit

unit UNIT set the default unit to UNIT

UNIT is one of: s, B, kB, MB, GB, TB, compact, cyl, chs, %, kiB, MiB,

GiB, TiB

(parted) unit

unit

Unit? [compact]? s

s

(parted) print

print

Model: Generic Ide (ide)

Disk /dev/dsk/c3t0d0p0: 7858176s

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 4096s 1949695s 1945600s primary solaris boot

(parted) quit

quit

root@openindiana:~# parted -l unit s print

Model: Generic Ide (ide)

Disk /dev/dsk/c3t0d0p0: 4023MB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 2097kB 998MB 996MB primary solaris boot

Model: Generic Ide (ide)

Disk /dev/dsk/c4t0d0p0: 1000GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 32.3kB 105GB 105GB primary fat32 boot, lba

2 105GB 1000GB 895GB primary

Model: Generic Ide (ide)

Disk /dev/dsk/c4t0d1p0: 1000GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 32.3kB 105GB 105GB primary ntfs boot

2 105GB 1000GB 895GB primary

root@openindiana:~# parted unit s print

Error: Could not stat device unit - No such file or directory.

Retry/Cancel? ^C

init_ide: _device_stat failed

root@openindiana:~# parted unit ^Cprint

root@openindiana:~# for i in 0 1;do parted /dev/dsk/c4t0d${i}p0 unit s print;done

Model: Generic Ide (ide)

Disk /dev/dsk/c4t0d0p0: 1953525168s

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 63s 204796619s 204796557s primary fat32 boot, lba

2 204796620s 1953520064s 1748723445s primary

Model: Generic Ide (ide)

Disk /dev/dsk/c4t0d1p0: 1953525168s

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 63s 205085789s 205085727s primary ntfs boot

2 205085790s 1953520064s 1748434275s primary

root@openindiana:~# parted

GNU Parted 1.8.8

Using /dev/dsk/c3t0d0p0

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) rm

rm

Partition number? 1

1

(parted) print

print

Model: Generic Ide (ide)

Disk /dev/dsk/c3t0d0p0: 4023MB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

(parted) ?

?

check NUMBER do a simple check on the file system

cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition

help [COMMAND] print general help, or help on

COMMAND

mklabel,mktable LABEL-TYPE create a new disklabel (partition

table)

mkfs NUMBER FS-TYPE make a FS-TYPE file system on

partititon NUMBER

mkpart PART-TYPE [FS-TYPE] START END make a partition

mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system

move NUMBER START END move partition NUMBER

name NUMBER NAME name partition NUMBER as NAME

print [devices|free|list,all|NUMBER] display the partition table,

available devices, free space, all found partitions, or a particular

partition

quit exit program

rescue START END rescue a lost partition near START

and END

resize NUMBER START END resize partition NUMBER and its file

system

rm NUMBER delete partition NUMBER

select DEVICE choose the device to edit

set NUMBER FLAG STATE change the FLAG on partition NUMBER

toggle [NUMBER [FLAG]] toggle the state of FLAG on partition

NUMBER

unit UNIT set the default unit to UNIT

version display the version number and

copyright information of GNU Parted

(parted) rescue

=============================Recover by overwriting with same numbers====================

root@openindiana:/jack# parted

GNU Parted 1.8.8

Using /dev/dsk/c3t0d0p0

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) print

print

Model: Generic Ide (ide)

Disk /dev/dsk/c3t0d0p0: 4023MB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

(parted) help rescue

help rescue

rescue START END rescue a lost partition near START

and END

START and END are disk locations, such as 4GB or 10%. Negative values

count from the end of the disk. For example, -1s specifies exactly the

last sector.

(parted) rescue

rescue

Start? 4096s

4096s

End? 1949695s

1949695s

searching for file systems... 0% (time left 217:24)^\Quit (core dumped)

root@openindiana:/jack# parted

GNU Parted 1.8.8

Using /dev/dsk/c3t0d0p0

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) rescue

rescue

Start? ^C

(parted) print

print

Model: Generic Ide (ide)

Disk /dev/dsk/c3t0d0p0: 4023MB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

(parted) help rescue

help rescue

rescue START END rescue a lost partition near START

and END

START and END are disk locations, such as 4GB or 10%. Negative values

count from the end of the disk. For example, -1s specifies exactly the

last sector.

(parted) rescue

rescue

Start? 0

0

End? -1

-1

searching for file systems... 0% (time left 219:03)^C^C^C^C^C^C^C^C^C^C^Csearching for file systems... 0% (time left 218:48)^\Quit (core dumped)

root@openindiana:/jack# parted

GNU Parted 1.8.8

Using /dev/dsk/c3t0d0p0

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) help

help

check NUMBER do a simple check on the file system

cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition

help [COMMAND] print general help, or help on

COMMAND

mklabel,mktable LABEL-TYPE create a new disklabel (partition

table)

mkfs NUMBER FS-TYPE make a FS-TYPE file system on

partititon NUMBER

mkpart PART-TYPE [FS-TYPE] START END make a partition

mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system

move NUMBER START END move partition NUMBER

name NUMBER NAME name partition NUMBER as NAME

print [devices|free|list,all|NUMBER] display the partition table,

available devices, free space, all found partitions, or a particular

partition

quit exit program

rescue START END rescue a lost partition near START

and END

resize NUMBER START END resize partition NUMBER and its file

system

rm NUMBER delete partition NUMBER

select DEVICE choose the device to edit

set NUMBER FLAG STATE change the FLAG on partition NUMBER

toggle [NUMBER [FLAG]] toggle the state of FLAG on partition

NUMBER

unit UNIT set the default unit to UNIT

version display the version number and

copyright information of GNU Parted

(parted) mkpart

mkpart

Partition type? primary/extended? p^C

Error: Expecting a partition type.

(parted) print

print

Model: Generic Ide (ide)

Disk /dev/dsk/c3t0d0p0: 4023MB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

(parted) mkpart

mkpart

Partition type? primary/extended? p

p

File system type? [ext2]? solaris

solaris

Start? 4096s

4096s

End? 1949695s

1949695s

(parted) print

print

Model: Generic Ide (ide)

Disk /dev/dsk/c3t0d0p0: 4023MB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 2097kB 998MB 996MB primary solaris

(parted) toggle

toggle

Partition number? 1

1

Flag to Invert? boot/hidden/raid/lvm/lba/palo/prep? boot

boot

(parted) print

print

Model: Generic Ide (ide)

Disk /dev/dsk/c3t0d0p0: 4023MB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 2097kB 998MB 996MB primary solaris boot

(parted) unit s

unit s

(parted) print

print

Model: Generic Ide (ide)

Disk /dev/dsk/c3t0d0p0: 7858176s

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 4096s 1949695s 1945600s primary solaris boot

(parted) quit

quit

root@openindiana:/jack#

==================================Recover by