On 15 January, 2009 - Jim Klimov sent me these 1,3K bytes:
> Is it possible to create a (degraded) zpool with placeholders specified
> instead
> of actual disks (parity or mirrors)? This is possible in linux mdadm
> ("missing"
> keyword), so I kinda hoped this can be done in Solaris, but didn't manage to.
>
> Usecase scenario:
>
> I have a single server (or home workstation) with 4 HDD bays, sold with 2
> drives.
> Initially the system was set up with a ZFS mirror for data slices. Now we got
> 2
> more drives and want to replace the mirror with a larger RAIDZ2 set (say I
> don't
> want a RAID10 which is trivial to make).
>
> Technically I think that it should be possible to force creation of a degraded
> raidz2 array with two actual drives and two missing drives. Then I'd copy data
> from the old mirror pool to the new degraded raidz2 pool (zfs send | zfs
> recv),
> destroy the mirror pool and attach its two drives to "repair" the raidz2 pool.
>
> While obviously not an "enterprise" approach, this is useful while expanding
> home systems when I don't have a spare tape backup to dump my files on it
> and restore afterwards.
>
> I think it's an (intended?) limitation in zpool command itself, since the
> kernel
> can very well live with degraded pools.
You can fake it..
kalv:/tmp# mkfile 64m realdisk1
kalv:/tmp# mkfile 64m realdisk2
kalv:/tmp# mkfile -n 64m fakedisk1
kalv:/tmp# mkfile -n 64m fakedisk2
kalv:/tmp# ls -la real* fake*
-rw------T 1 root root 67108864 2009-01-15 17:02 fakedisk1
-rw------T 1 root root 67108864 2009-01-15 17:02 fakedisk2
-rw------T 1 root root 67108864 2009-01-15 17:02 realdisk1
-rw------T 1 root root 67108864 2009-01-15 17:02 realdisk2
kalv:/tmp# du real* fake*
65555 realdisk1
65555 realdisk2
133 fakedisk1
133 fakedisk2
In reality, those realdisk* should be pointing at real disks, but
fakedisk* should still point at sparse mkfile's with the same size as
your real disks (300GB or whatever).
kalv:/tmp# zpool create blah raidz2 /tmp/realdisk1 /tmp/realdisk2
/tmp/fakedisk1 /tmp/fakedisk2
kalv:/tmp# zpool status blah
pool: blah
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
blah ONLINE 0 0 0
raidz2 ONLINE 0 0 0
/tmp/realdisk1 ONLINE 0 0 0
/tmp/realdisk2 ONLINE 0 0 0
/tmp/fakedisk1 ONLINE 0 0 0
/tmp/fakedisk2 ONLINE 0 0 0
errors: No known data errors
Ok, so it's created fine. Let's "accidentally" introduce some problems..
kalv:/tmp# rm /tmp/fakedisk1
kalv:/tmp# rm /tmp/fakedisk2
kalv:/tmp# zpool scrub blah
kalv:/tmp# zpool status blah
pool: blah
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: scrub completed after 0h0m with 0 errors on Thu Jan 15 17:03:38
2009
config:
NAME STATE READ WRITE CKSUM
blah DEGRADED 0 0 0
raidz2 DEGRADED 0 0 0
/tmp/realdisk1 ONLINE 0 0 0
/tmp/realdisk2 ONLINE 0 0 0
/tmp/fakedisk1 UNAVAIL 0 0 0 cannot open
/tmp/fakedisk2 UNAVAIL 0 0 0 cannot open
errors: No known data errors
Still working.
At this point, you can start filling blah with data. Then after a while,
let's bring in the other real disks:
kalv:/tmp# mkfile 64m realdisk3
kalv:/tmp# mkfile 64m realdisk4
kalv:/tmp# zpool replace blah /tmp/fakedisk1 /tmp/realdisk3
kalv:/tmp# zpool replace blah /tmp/fakedisk2 /tmp/realdisk4
kalv:/tmp# zpool status blah
pool: blah
state: ONLINE
scrub: resilver completed after 0h0m with 0 errors on Thu Jan 15 17:04:31 2009
config:
NAME STATE READ WRITE CKSUM
blah ONLINE 0 0 0
raidz2 ONLINE 0 0 0
/tmp/realdisk1 ONLINE 0 0 0
/tmp/realdisk2 ONLINE 0 0 0
/tmp/realdisk3 ONLINE 0 0 0
/tmp/realdisk4 ONLINE 0 0 0
Of course, try it out a bit before doing it for real.
/Tomas
--
Tomas Ögren, [email protected], http://www.acc.umu.se/~stric/
|- Student at Computing Science, University of Umeå
`- Sysadmin at {cs,acc}.umu.se
_______________________________________________
zfs-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss