Chris Josephes
2010-Aug-04 23:13 UTC
[zfs-discuss] Splitting root mirror to prep for re-install
I have a host running svn_133 with a root mirror pool that I''d like to rebuild with a fresh install on new hardware; but I still have data on the pool that I would like to preserve. Given a rpool with disks c7d0s0 and c6d0s0, I think the following process will do what I need: 1. Run these commands # zpool detach rpool c6d0s0 # zpool create preserve c6d0s0 # zfs create export/home # zfs send rpool/export/home | zfs receive preserve/home # zfs send (other filesystems) # zpool export preserve 2. Build out new host with svn_134, placing new root pool on c6d0s0 (or whatever it''s called on the new SATA controller) 3. Run zpool import against "preserve", copy over data that should be migrated. 4. Rebuild the mirror by destroying the "preserve" pool and attaching c7d0s0 to the rpool mirror. Am I missing anything? -- Chris -- This message posted from opensolaris.org
Edward Ned Harvey
2010-Aug-05 00:58 UTC
[zfs-discuss] Splitting root mirror to prep for re-install
> From: zfs-discuss-bounces at opensolaris.org [mailto:zfs-discuss- > bounces at opensolaris.org] On Behalf Of Chris Josephes > > I have a host running svn_133 with a root mirror pool that I''d like to > rebuild with a fresh install on new hardware; but I still have data on > the pool that I would like to preserve.So, after rebuilding, you don''t want to restore the same OS that you''re currently running. But there are some files you''d like to save for after you reinstall. Why not just copy them off somewhere, in a tarball or something like that?> Given a rpool with disks c7d0s0 and c6d0s0, I think the following > process will do what I need: > > 1. Run these commands > > # zpool detach rpool c6d0s0 > # zpool create preserve c6d0s0The only reason you currently have the rpool in a slice (s0) is because that''s a requirement for booting. If you aren''t planning to boot from the device after breaking it off the mirror ... Maybe just use the whole device instead of the slice. zpool create preserve c6d0> # zfs create export/home > # zfs send rpool/export/home | zfs receive preserve/home > # zfs send (other filesystems) > # zpool export preserveThese are not right. It should be something more like this: zfs create -o readonly=on preserve/rpool_export_home zfs snapshot rpool/export/home at fubarsnap zfs send rpool/export/home at fubarsnap | zfs receive -F preserve/rpool_export_home And finally zpool export preserve> 2. Build out new host with svn_134, placing new root pool on c6d0s0 (or > whatever it''s called on the new SATA controller)Um ... I assume that''s just a type-o ... Yes, install fresh. No, don''t overwrite the existing "preserve" disk. For that matter, why break the mirror at all? Just install the OS again, onto a single disk, which implicitly breaks the mirror. Then when it''s all done, use "zpool import" to import the other half of the mirror, which you didn''t overwrite.> 3. Run zpool import against "preserve", copy over data that should be > migrated. > > 4. Rebuild the mirror by destroying the "preserve" pool and attaching > c7d0s0 to the rpool mirror. > > Am I missing anything?If you blow away the partition table of the 2nd disk (as I suggested above, but now retract) then you''ll have to recreate the partition table of the second disk. So you only attach s0 to s0. After attaching, and resilvering, you''ll want to installgrub on the 2nd disk, or else it won''t be bootable after the first disk fails. See the ZFS Troubleshooting Guide for details.
Mark Musante
2010-Aug-05 01:34 UTC
[zfs-discuss] Splitting root mirror to prep for re-install
You can also use the "zpool split" command and save yourself having to do the zfs send|zfs recv step - all the data will be preserved. "zpool split rpool preserve" does essentially everything up to and including the "zpool export preserve" commands you listed in your original email. Just don''t try to boot off it. On 4 Aug 2010, at 20:58, Edward Ned Harvey wrote:>> From: zfs-discuss-bounces at opensolaris.org [mailto:zfs-discuss- >> bounces at opensolaris.org] On Behalf Of Chris Josephes >> >> I have a host running svn_133 with a root mirror pool that I''d like to >> rebuild with a fresh install on new hardware; but I still have data on >> the pool that I would like to preserve. > > So, after rebuilding, you don''t want to restore the same OS that you''re > currently running. But there are some files you''d like to save for after > you reinstall. Why not just copy them off somewhere, in a tarball or > something like that? > > >> Given a rpool with disks c7d0s0 and c6d0s0, I think the following >> process will do what I need: >> >> 1. Run these commands >> >> # zpool detach rpool c6d0s0 >> # zpool create preserve c6d0s0 > > The only reason you currently have the rpool in a slice (s0) is because > that''s a requirement for booting. If you aren''t planning to boot from the > device after breaking it off the mirror ... Maybe just use the whole device > instead of the slice. > > zpool create preserve c6d0 > > >> # zfs create export/home >> # zfs send rpool/export/home | zfs receive preserve/home >> # zfs send (other filesystems) >> # zpool export preserve > > These are not right. It should be something more like this: > zfs create -o readonly=on preserve/rpool_export_home > zfs snapshot rpool/export/home at fubarsnap > zfs send rpool/export/home at fubarsnap | zfs receive -F > preserve/rpool_export_home > > And finally > zpool export preserve > > >> 2. Build out new host with svn_134, placing new root pool on c6d0s0 (or >> whatever it''s called on the new SATA controller) > > Um ... I assume that''s just a type-o ... > Yes, install fresh. No, don''t overwrite the existing "preserve" disk. > > For that matter, why break the mirror at all? Just install the OS again, > onto a single disk, which implicitly breaks the mirror. Then when it''s all > done, use "zpool import" to import the other half of the mirror, which you > didn''t overwrite. > > >> 3. Run zpool import against "preserve", copy over data that should be >> migrated. >> >> 4. Rebuild the mirror by destroying the "preserve" pool and attaching >> c7d0s0 to the rpool mirror. >> >> Am I missing anything? > > If you blow away the partition table of the 2nd disk (as I suggested above, > but now retract) then you''ll have to recreate the partition table of the > second disk. So you only attach s0 to s0. > > After attaching, and resilvering, you''ll want to installgrub on the 2nd > disk, or else it won''t be bootable after the first disk fails. See the ZFS > Troubleshooting Guide for details. > > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss
Chris Josephes
2010-Aug-05 01:54 UTC
[zfs-discuss] Splitting root mirror to prep for re-install
> > > So, after rebuilding, you don''t want to restore the > same OS that you''re > currently running. But there are some files you''d > like to save for after > you reinstall. Why not just copy them off somewhere, > in a tarball or > something like that?It''s about 200+ gigs of files. If I had a third drive, empty for all this, I''d do that in a heartbeat.> > > > Given a rpool with disks c7d0s0 and c6d0s0, I think > the following > > process will do what I need: > > > > 1. Run these commands > > > > # zpool detach rpool c6d0s0 > > # zpool create preserve c6d0s0 > > The only reason you currently have the rpool in a > slice (s0) is because > that''s a requirement for booting. If you aren''t > planning to boot from the > device after breaking it off the mirror ... Maybe > just use the whole device > instead of the slice. > > zpool create preserve c6d0 > > > > # zfs create export/home > > # zfs send rpool/export/home | zfs receive > preserve/home > > # zfs send (other filesystems) > > # zpool export preserve > > These are not right. It should be something more > like this: > zfs create -o readonly=on preserve/rpool_export_home > zfs snapshot rpool/export/home at fubarsnap > zfs send rpool/export/home at fubarsnap | zfs receive -F > preserve/rpool_export_home > > And finally > zpool export preserve >Good catch on the readonly. The snapshot wouldn''t hurt either. The zfs manpage on svn_133 suggests that I could do the whole send/receive directly against the filesystems without a snapshot, but one extra step isn''t going to hurt.> > > 2. Build out new host with svn_134, placing new > root pool on c6d0s0 (or > > whatever it''s called on the new SATA controller) > > Um ... I assume that''s just a type-o ... > Yes, install fresh. No, don''t overwrite the existing > "preserve" disk. >Yeah, typo.> For that matter, why break the mirror at all? Just > install the OS again, > onto a single disk, which implicitly breaks the > mirror. Then when it''s all > done, use "zpool import" to import the other half of > the mirror, which you > didn''t overwrite. >I was worried about how "zpool import" would identify it. If I just detach the disk from the mirror, would it still consider itself a part of "rpool"? If so, how would ZFS handle two disks that belong to two distinct pools with the same name?> > > 3. Run zpool import against "preserve", copy over > data that should be > > migrated. > > > > 4. Rebuild the mirror by destroying the "preserve" > pool and attaching > > c7d0s0 to the rpool mirror. > > > > Am I missing anything? > > If you blow away the partition table of the 2nd disk > (as I suggested above, > but now retract) then you''ll have to recreate the > partition table of the > second disk. So you only attach s0 to s0. > > After attaching, and resilvering, you''ll want to > installgrub on the 2nd > disk, or else it won''t be bootable after the first > disk fails. See the ZFS > Troubleshooting Guide for details.Yep. I keep forgetting about the installgrub part. And the future plan would be to use the whole disk instead of just a slice.> > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discu > ss >-- This message posted from opensolaris.org
Chris Josephes
2010-Aug-05 02:17 UTC
[zfs-discuss] Splitting root mirror to prep for re-install
> You can also use the "zpool split" command and save > yourself having to do the zfs send|zfs recv step - > all the data will be preserved. > > "zpool split rpool preserve" does essentially > everything up to and including the "zpool export > preserve" commands you listed in your original email. > Just don''t try to boot off it.Gotta love OpenSolaris. Just did a test run with "zpool split -n rpool preserve", and it looks like it''d be the easiest way to go about the process. -- This message posted from opensolaris.org