create cqow2 image and mount it unsing nbd
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 11 May 2009 13:20:48 +0000 (13:20 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 11 May 2009 13:20:48 +0000 (13:20 +0000)
git-svn-id: svn://svn.rot13.org/sysadmin-cookbook@50 191e9f34-6774-4a6d-acfc-7664dacd4a2a

recepies/kvm/10.create-image [new file with mode: 0644]
recepies/kvm/20.mount-image [new file with mode: 0644]

diff --git a/recepies/kvm/10.create-image b/recepies/kvm/10.create-image
new file mode 100644 (file)
index 0000000..f63c506
--- /dev/null
@@ -0,0 +1,3 @@
+root@klin:/btrfs# kvm-img create -f qcow2 212052.cqow2 50G
+Formatting '212052.cqow2', fmt=qcow2, size=52428800 kB
+
diff --git a/recepies/kvm/20.mount-image b/recepies/kvm/20.mount-image
new file mode 100644 (file)
index 0000000..1f9c2db
--- /dev/null
@@ -0,0 +1,11 @@
+root@klin:/btrfs# kvm-nbd --port 10000 212052.cqow2 &
+
+root@klin:/btrfs# nbd-client localhost 10000 /dev/nbd0
+Negotiation: ..size = 52428800KB
+bs=1024, sz=52428800
+
+root@klin:/btrfs# mount /dev/nbd0p1 /mnt/tmp
+root@klin:/btrfs# df /mnt/tmp
+Filesystem           1K-blocks      Used Available Use% Mounted on
+/dev/nbd0p1           51605436     53064  48930968   1% /mnt/tmp
+