All pastes #2007725 Raw Edit

nettezzaumana

public text v1 · immutable
#2007725 ·published 2010-12-01 15:20 UTC
rendered paste body
### we'll create first backend file:# mkfile 20g /share/c0d0s0.file### then we'll create zfs filesystem in there altroot= alias -R $new_root is *neccessary if### we plan to put there anothere rpool in living BE where will conflict mountpoints# zpool create -f -R /backup foo /share/c0d0s0.file### then we'll create recursive snapshot for future `zfs send`# zfs snapshot -r rpool@main_backup0### destroying of any subvolume's snap will exclude that volume from `zfs send`# zfs destroy rpool/ROOT/share@main_backup0### here we send content of rpool@main_backup0 to our new zpool foo### see that warning about missing rpool/ROOT/share@main_backup0# zfs send -vR rpool@main_backup0 | zfs receive -Fd foosending from @ to rpool@main_backup0sending from @ to rpool/dump@main_backup0sending from @ to rpool/ztemplate@snap1sending from @snap1 to rpool/ztemplate@SUNWzone1sending from @SUNWzone1 to rpool/ztemplate@SUNWzone2sending from @SUNWzone2 to rpool/ztemplate@SUNWzone3sending from @SUNWzone3 to rpool/ztemplate@SUNWzone4sending from @SUNWzone4 to rpool/ztemplate@SUNWzone5sending from @SUNWzone5 to rpool/ztemplate@SUNWzone6sending from @SUNWzone6 to rpool/ztemplate@SUNWzone7sending from @SUNWzone7 to rpool/ztemplate@SUNWzone8sending from @SUNWzone8 to rpool/ztemplate@SUNWzone9sending from @SUNWzone9 to rpool/ztemplate@main_backup0sending from @ to rpool/ROOT@main_backup0sending from @ to rpool/ROOT/ROOT@snap0sending from @snap0 to rpool/ROOT/ROOT@main_backup0WARNING: could not send rpool/ROOT/share@main_backup0: does not existsending from @ to rpool/export@main_backup0sending from @ to rpool/export/home@main_backup0sending from @ to rpool/zones@main_backup0sending from @ to rpool/zones/ossoF@snap0sending from @snap0 to rpool/zones/ossoF@main_backup0sending from @ to rpool/zones/simple-legacy@snap0sending from @snap0 to rpool/zones/simple-legacy@readysending from @ready to rpool/zones/simple-legacy@main_backup0sending from @ to rpool/zones/am1@snap0sending from @snap0 to rpool/zones/am1@snap1sending from @snap1 to rpool/zones/am1@main_backup0sending from @ to rpool/zones/commsF@snap0sending from @snap0 to rpool/zones/commsF@main_backup0sending from @ to rpool/zones/dsee1@main_backup0sending from @ to rpool/zones/am71@snap0sending from @snap0 to rpool/zones/am71@main_backup0sending from @ to rpool/swap@main_backup0sending from @ to rpool/instances@repl0sending from @repl0 to rpool/instances@repl1sending from @repl1 to rpool/instances@repl2sending from @repl2 to rpool/instances@main_backup0### then we safely export whole volume because due to the buggy behaviour there couldn't be### some volumes mounted properly because of mounting order:zpool export foo### then we'll re-import it back againzpool import -R /backup -d /share foo### optionally we can check with zfs mount if it's all okay .. in my case will be never mounted foo/ROOT/ROOT### so just changing default mountpoint is necessary, please note that due to active altroot= we have to put### there relative path because of absolut will be $altroot/$mountpointzfs set mountpoint=/root foo/ROOT/ROOTzfs mount foo/ROOT/ROOT###### now how it works:# zpool import -R /backup -d /share/ foo# zfs mountrpool/ROOT/ROOT                 /rpool/export                    /exportrpool/export/home               /export/homerpool/zones                     /export/home/zonesrpool/zones/am1                 /export/home/zones/am1rpool/zones/commsF              /export/home/zones/commsFrpool/zones/dsee1               /export/home/zones/dsee1rpool/zones/ossoF               /export/home/zones/ossoFrpool/zones/simple-legacy       /export/home/zones/simple-legacyrpool/instances                 /instancesrpool                           /rpoolrpool/ROOT/share                /sharerpool/ztemplate                 /zones/ztemplaterpool/zones/am71                /export/home/zones/am71foo/export                      /backup/exportfoo/export/home                 /backup/export/homefoo/zones                       /backup/export/home/zonesfoo/zones/am1                   /backup/export/home/zones/am1foo/zones/am71                  /backup/export/home/zones/am71foo/zones/commsF                /backup/export/home/zones/commsFfoo/zones/dsee1                 /backup/export/home/zones/dsee1foo/zones/ossoF                 /backup/export/home/zones/ossoFfoo/zones/simple-legacy         /backup/export/home/zones/simple-legacyfoo/instances                   /backup/instancesfoo                             /backup/rpoolfoo/ztemplate                   /backup/zones/ztemplate# zfs get mountpoint foo/ROOT/ROOTNAME           PROPERTY    VALUE         SOURCEfoo/ROOT/ROOT  mountpoint  /backup/root  local# zfs mount foo/ROOT/ROOT# zfs mount | grep foo/ROOT/ROOTfoo/ROOT/ROOT# zpool export foo