/[sysadmin-cookbook]/recepies/zfs/zfs-snapshot-to-ve.sh
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /recepies/zfs/zfs-snapshot-to-ve.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 70 - (hide annotations)
Sat May 16 12:35:09 2009 UTC (15 years ago) by dpavlin
File MIME type: application/x-sh
File size: 441 byte(s)
list clone filesystem so that destroy can find it,
display available OpenVZ VEs on the end

1 dpavlin 47 #!/bin/sh -x
2    
3     veid=60017
4    
5     fs=`zfs list | grep @ | iselect -t 'select snapshot to clone' -a | sed 's/ .*$//'`
6    
7     if [ -z "$fs" ] ; then
8     exit;
9     fi
10    
11     orig=`echo $fs | cut -d/ -f3 | cut -d@ -f1`
12 dpavlin 49 pool=`echo $fs | cut -d/ -f1`
13 dpavlin 47
14     echo "clone $fs -- $orig to $veid";
15    
16 dpavlin 49 clone=$pool/clone/$orig-$veid
17 dpavlin 47
18     vzctl stop $veid && (
19     umount /$clone
20 dpavlin 70 zfs list | grep ^$clone
21 dpavlin 47 zfs destroy $clone
22     )
23    
24 dpavlin 49 zfs clone $fs $pool/clone/$orig-$veid
25 dpavlin 47
26     vzctl start 60017
27    
28 dpavlin 70 vzlist -a

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26