nbd-client: add the ability to use the netlink interface
[nbd.git] / maketr
blobf1248377d47749e90ec3086f2d73538234483b6e
1 #!/bin/sh
3 # Example script to make a transaction log file
4 # Must be run as root. Remember to chown the file afterwards
6 # Insert the name of a tarfile here
7 tarfile=/home/amb/iptables/iptables_1.4.4.orig.tar.gz
8 tmpnam=`mktemp`
9 conffile=${tmpnam}.conf
10 pidfile=${tmpnam}.pid
11 output=`pwd`/output.tr
13 ulimit -c unlimited
15 cat >${conffile} <<EOF
16 [generic]
17 [export1]
18 exportname = $tmpnam
19 transactionlog = $output
20 flush = true
21 fua = true
22 rotational = true
23 EOF
24 ./nbd-server -C ${conffile} -p ${pidfile} &
25 PID=$!
26 sleep 1
27 dd if=/dev/zero of=${tmpnam} bs=1M count=50
28 ./nbd-client -N export1 127.0.0.1 /dev/nbd0
29 mkfs.ext3 /dev/nbd0
30 mount -t ext3 -odata=journal,barrier=1 /dev/nbd0 /mnt
31 (cd /mnt ; tar xvzf ${tarfile} ; sync) 2>&1 >/dev/null
32 umount /mnt
33 mount -t ext3 -odata=journal,barrier=1 /dev/nbd0 /mnt
34 (cd /mnt ; tar cvzf /dev/null . ; sync) 2>&1 >/dev/null
35 dbench -D /mnt 1 &
36 sleep 10
37 killall dbench
38 sleep 2
39 killall -KILL dbench
40 sync
41 umount /mnt
42 ./nbd-client -d /dev/nbd0
43 if [ -f ${pidfile} ]
44 then
45 kill `cat ${pidfile}`
46 rm -f ${pidfile}
47 else
48 kill $PID
50 rm -f $tmpnam ${conffile}
51 ls -la ${output}