简体   繁体   中英

can a zfs disk be replaced with an imaged-copy [zol]

If I have a theoretical pool "tank" 500gb X 4 drives as devices vd{a,b,c,d}

could I pull vdc from the system, image it (bit-wise clone) onto another 500gb disk, and install the clone (lets call this fifth device vde) on the host, would I be able to import this pool normally?

I anticipate zfs may not like that the physical device changed, or may have some other "quirky" behaviors that might make trying to zpool replace ... more difficult than before.


with a clone of a raidz member,these things I've found don't work

  • zpool export tank zpool import tank

    new device ignored

  • zpool replace tank vdc /dev/vde

    /dev/vde is part of active pool tank

  • zpool online tank /dev/vde

    cannot online /dev/vde no such device in pool

  • zpool offline tank vdc zpool online tank /dev/vde

    cannot online /dev/vde no such device in pool

  • zpool attach tank vdc vde

    /dev/vde is part of active pool cryo

  • zpool online tank vde

    cannot online vde: no such device in pool

yes, by offlining the pool (export+import)

zpool import will find the new disk when the original disk is missing

Note: zpool offline tank sdc , before copying if possible, this helps reduce scrub time&wear. zpool online task sde after export+import. before export+import, while the device is offline, checksum the copies to ensure no copy defects.

  pool: tank
 state: ONLINE
  scan: resilvered 8K in 0h0m with 0 errors 
config:       
                                                         
        NAME         STATE     READ WRITE CKSUM
        tank         ONLINE       0     0     0
          raidz3-0   ONLINE       0     0     0
            sda      ONLINE       0     0     0
            sdb      ONLINE       0     0     0
            sdc      ONLINE       0     0     0
            sdd      ONLINE       0     0     0
  • (safely) disconnect the old device (export the pool first)
     # echo 1 >/sys/block/sdc/device/delete
  • scan for pool
    # zpool import -d /dev/disk/by-id/ pool: tank state: ONLINE scan: resilvered 8K in 0h0m with 0 errors config: NAME STATE READ WRITE CKSUM tank ONLINE 0 0 0 raidz3-0 ONLINE 0 0 0 sda ONLINE 0 0 0 sdb ONLINE 0 0 0 sde ONLINE 0 0 0 # clone detected sdd ONLINE 0 0 0
  • import pool
    # zpool import -d /dev/disk/by-id/ tank
  • scrub suggested, to ensure clone isn't missing any changes, or has any bad blocks
    zpool scrub tank

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM