Alex Savatieiev | ec70369 | 2019-06-07 15:33:31 -0500 | [diff] [blame] | 1 | # package |
| 2 | apt-get install qemu-utils |
| 3 | |
| 4 | #image |
| 5 | wget https://cloud-images.ubuntu.com/releases/14.04.1/release/ubuntu-14.04-server-cloudimg-amd64-disk1.img |
| 6 | |
| 7 | # adding module |
| 8 | modprobe nbd |
| 9 | dmesg | grep nbd |
| 10 | |
| 11 | # mapping it |
| 12 | qemu-nbd --connect=/dev/nbd0 /home/osavatieiev/ubuntu-14.04-server-cloudimg-amd64-disk1.img |
| 13 | blockdev --rereadpt /dev/nbd0 |
| 14 | mkdir /mnt/target_vm |
| 15 | mount /dev/nbd0p1 /mnt/target_vm |
| 16 | |
| 17 | # download iperf just in case |
| 18 | wget http://archive.ubuntu.com/ubuntu/pool/universe/i/iperf/iperf_2.0.5-3_amd64.deb |
| 19 | cp iperf_2.0.5-3_amd64.deb /mnt/vm/tmp/ |
| 20 | |
| 21 | chroot /mnt/target_vm/ |
| 22 | |
| 23 | # add user |
| 24 | adduser spt |
| 25 | usermod -aG sudo spt |
| 26 | dpkg -i /tmp/iperf_2.0.5-3_amd64.deb |
| 27 | |
| 28 | # ctrl + D |
| 29 | # disconect |
| 30 | umount /mnt/target_vm |
| 31 | qemu-nbd --disconnect /dev/nbd0 |