2012-10-07 21:58:46 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
tmpf=`mktemp`
|
|
|
|
|
|
|
|
## === List
|
|
|
|
echo 'qvm-block -l'
|
|
|
|
qvm-block -l > $tmpf
|
|
|
|
|
2012-10-07 22:11:51 +02:00
|
|
|
cat <<'END' | diff -u - $tmpf
|
2012-10-07 21:58:46 +02:00
|
|
|
netvm:sda STORAGE_DEVICE () 0 B
|
|
|
|
dom0:sdb1 Cruzer () 3 GiB
|
|
|
|
dom0:sdb Cruzer () 3 GiB
|
|
|
|
END
|
|
|
|
|
|
|
|
## === Attach
|
|
|
|
echo 'qvm-block -a'
|
|
|
|
qvm-block -a work dom0:sdb | diff -u /dev/null -
|
|
|
|
|
|
|
|
## === List again
|
|
|
|
echo 'qvm-block -l'
|
|
|
|
qvm-block -l > $tmpf
|
|
|
|
|
2012-10-07 22:11:51 +02:00
|
|
|
cat <<'END' | diff -u - $tmpf
|
2012-10-07 21:58:46 +02:00
|
|
|
netvm:sda STORAGE_DEVICE () 0 B
|
|
|
|
dom0:sdb1 Cruzer () 3 GiB
|
|
|
|
dom0:sdb Cruzer () 3 GiB (attached to 'work' as 'xvdi')
|
|
|
|
END
|
|
|
|
|
|
|
|
## === Use
|
|
|
|
echo 'qvm-run work fdisk'
|
|
|
|
qvm-run -qp work 'su - root -c "fdisk -l /dev/xvdi"' > $tmpf
|
|
|
|
|
2012-10-07 22:11:51 +02:00
|
|
|
cat <<'END' | diff -u - $tmpf
|
2012-10-07 21:58:46 +02:00
|
|
|
|
|
|
|
Disk /dev/xvdi: 4022 MB, 4022337024 bytes
|
|
|
|
124 heads, 62 sectors/track, 1021 cylinders, total 7856127 sectors
|
|
|
|
Units = sectors of 1 * 512 = 512 bytes
|
|
|
|
Sector size (logical/physical): 512 bytes / 512 bytes
|
|
|
|
I/O size (minimum/optimal): 512 bytes / 512 bytes
|
|
|
|
Disk identifier: 0x3963a77b
|
|
|
|
|
|
|
|
Device Boot Start End Blocks Id System
|
|
|
|
/dev/xvdi1 * 62 7849447 3924693 c W95 FAT32 (LBA)
|
|
|
|
END
|
|
|
|
|
|
|
|
## === Detach
|
|
|
|
echo 'qvm-block -d'
|
|
|
|
qvm-block -d work dom0:sdb1 | diff -u /dev/null -
|
|
|
|
|
|
|
|
rm $tmpf
|