Révision 49 bin/create-volume
create-volume (revision 49) | ||
---|---|---|
1 | 1 |
#!/bin/bash |
2 | 2 |
# $Id$ |
3 | 3 |
|
4 |
BINZFS="/sbin/zfs" |
|
5 |
BINZPOOL="/sbin/zpool" |
|
6 |
|
|
4 | 7 |
function usage { |
5 | 8 |
echo "Syntax :" 1>&2 |
6 | 9 |
echo "$0 [options]" 1>&2 |
... | ... | |
8 | 11 |
echo " -p : pool name" 1>&2 |
9 | 12 |
echo " -b : block size. Permit value : 32K, 64K, 128K (recommanded)" 1>&2 |
10 | 13 |
echo " -s : volume size. Permit unit : T, G, M" 1>&2 |
11 |
# FIXME: c'est pas clair ta formulation |
|
12 | 14 |
echo " -o : set property list for a zfs volume. Separate such property by a ','." 1>&2 |
13 | 15 |
echo " Example : -o compression=off,snapdev=visble." 1>&2 |
14 | 16 |
echo " Read the man zfs to get the list of the valid properties" 1>&2 |
... | ... | |
20 | 22 |
|
21 | 23 |
if [[ -z $VOL_OPTION ]] |
22 | 24 |
then |
23 |
/sbin/zfs create -s -b $BLOCK_SIZE -V $SIZE $NAME_POOL/$NAME
|
|
25 |
$BINZFS create -s -b $BLOCK_SIZE -V $SIZE $NAME_POOL/$NAME
|
|
24 | 26 |
else |
25 |
/sbin/zfs create -s -b $BLOCK_SIZE -o $VOL_OPTION -V $SIZE $NAME_POOL/$NAME
|
|
27 |
$BINZFS create -s -b $BLOCK_SIZE -o $VOL_OPTION -V $SIZE $NAME_POOL/$NAME
|
|
26 | 28 |
fi |
27 | 29 |
|
28 | 30 |
} |
29 | 31 |
|
30 | 32 |
|
31 | 33 |
function interactive { |
32 |
/sbin/zfs list
|
|
34 |
$BINZFS list
|
|
33 | 35 |
echo "*** Select the parent zpool : ***" |
34 | 36 |
|
35 | 37 |
while read inputline |
36 | 38 |
do |
37 | 39 |
if [ "$inputline" != "" ] |
38 | 40 |
then |
39 |
/sbin/zfs list |grep -i $inputline
|
|
41 |
$BINZFS list |grep -i $inputline
|
|
40 | 42 |
if [ $? -eq 1 ] |
41 | 43 |
then |
42 | 44 |
echo "*** Select the parent zpool ***" |
... | ... | |
84 | 86 |
do |
85 | 87 |
if [ "$inputSize" != "" ] |
86 | 88 |
then |
87 |
/sbin/zfs create -s -b 128K -V $inputSize $NAME_POOL/$inputVolume
|
|
89 |
$BINZFS create -s -b 128K -V $inputSize $NAME_POOL/$inputVolume
|
|
88 | 90 |
if [ $? -eq 0 ] |
89 | 91 |
then |
90 | 92 |
echo "*** ZFS volume creation [OK] ***" |
91 |
/sbin/zfs list
|
|
93 |
$BINZFS list
|
|
92 | 94 |
break |
93 | 95 |
else |
94 | 96 |
echo "/!\\ ZFS volume creation [ERROR] /!\\" |
Formats disponibles : Unified diff