All pastes #2039444 Raw Edit

dpecka

public text v1 · immutable
#2039444 ·published 2011-01-06 11:55 UTC
rendered paste body
### we need to create backend file first:$ mkfile 20g /share/c0d0s0.file### then we need to create zfs filesystem in there with -R $new_root (sets altroot= property)### 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 need to 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 of due to the buggy behaviour there are### obviously some volumes mounted un-properly because of bad mounting order:$ zpool export foo### then we'll re-import it back again$ zpool import -R /backup -d /share foo### optionally we can check with zfs mount if it's all okay .. in my case was foo/ROOT/ROOT never mounted### so just changing default mountpoint is necessary, please note, that due to active altroot= we have to put### there relative path as far as final path can be split as $altroot/$mountpoint$ zfs set mountpoint=/root foo/ROOT/ROOT$ zfs mount foo/ROOT/ROOT############ example from real life .. we have already all of above, we need manually invoke mounting###### of foo/ROOT/ROOT anyway and i really dunno why ...####### zpool listNAME    SIZE   USED  AVAIL    CAP  HEALTH  ALTROOTrpool   136G  44.1G  91.9G    32%  ONLINE  -# zpool import -d /share/  pool: foo    id: 9416734535543432800 state: ONLINEaction: The pool can be imported using its name or numeric identifier.config:        foo                   ONLINE          /share/c0d0s0.file  ONLINE# zpool import -R /backup -d /share/ foo# zpool listNAME    SIZE   USED  AVAIL    CAP  HEALTH  ALTROOTfoo    19.9G  17.6G  2.27G    88%  ONLINE  /backuprpool   136G  44.1G  91.9G    32%  ONLINE  -# zfs mount | sortfoo                             /backup/rpoolfoo/export                      /backup/exportfoo/export/home                 /backup/export/homefoo/instances                   /backup/instancesfoo/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/ztemplate                   /backup/zones/ztemplaterpool                           /rpoolrpool/ROOT/ROOT                 /rpool/ROOT/share                /sharerpool/export                    /exportrpool/export/home               /export/homerpool/instances                 /instancesrpool/zones                     /export/home/zonesrpool/zones/am1                 /export/home/zones/am1rpool/zones/am71                /export/home/zones/am71rpool/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/ztemplate                 /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# zpool listNAME    SIZE   USED  AVAIL    CAP  HEALTH  ALTROOTrpool   136G  44.1G  91.9G    32%  ONLINE  -