projects
/
nitsi.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Initial checkin
[nitsi.git]
/
qcow2-copy.sh
1
#!/bin/bash
2
3
image
=
${1}
4
uuid
=
${2}
5
from
=
${3}
6
to
=
${4}
7
8
i
=
0
9
10
tmp_dir
=
$
(
mktemp
-d
)
11
12
while
1
;
do
13
if
[ !
-f
"/dev/nbd
${i}
"
];
then
14
break
15
fi
16
i
=((
i
+
1
))
17
done
18
19
qemu-nbd
--connect
=
"/dev/nbd
${i}
"
"
${image}
"
20
21
mount UUID
=
"
${uuid}
"
"
${tmp_dir}
"
22
23
cp
-R -v
"
${from}" "${tmp_dir}${to}
"
24
25
if
umount
"
${tmp_dir}
"
;
then
26
rm
-f -d
"
${tmp_dir}
"
27
fi
28
29