I am using Cirros as my primary hard disk to boot the operating system through Qemu. It has been very handy and useful until I faced with the space shortage problem. So, I had to look for a way to increase the disk space to continue with my work. That's when I came across the Qemu option hdb which provides a means to add a new hard disk.
To start with create a disk image of your choice. I will use Qcow2 image format to create the disk.
$ ls /dev/sd*
By default, the name of the block device will be sdb. It is a raw disk, we must create partitions underneath it. You can use the system tool that you are comfortable with. I will use cfdisk.
Create partitions according to your requirement. Then, write the changes to the disk and exit.
Next, we just format the new partition with a file system. I will use ext4 file system format to format the new partition.
We must mount the new partition to access the disk space in it.
$ qemu-img create -f qcow2 drive.qcow 4GOnce we have created the disk image, we should pass this as part of the Qemu command line.
$ qemu-system-x86_64 -hda cirros.img -hdb drive.qcow
Inside guest VM
When we login into the vm, before we can start using our new disk, we have to partition the disk and format the partitions with a file system. Before we format the disk, we must find the new block device that the kernel created as part of the boot process.$ ls /dev/sd*
By default, the name of the block device will be sdb. It is a raw disk, we must create partitions underneath it. You can use the system tool that you are comfortable with. I will use cfdisk.
$ cfdisk /dev/sdb
Create partitions according to your requirement. Then, write the changes to the disk and exit.
Next, we just format the new partition with a file system. I will use ext4 file system format to format the new partition.
$ mkfs.ext4 /dev/sdb1
We must mount the new partition to access the disk space in it.
$ mkdir /drive
$ mount -t ext4 /dev/sdb1 /drive$ df
Now, the new mount point will appear as part of the output of the df command.
[links]
* http://wiki.qemu.org/Main_Page
* http://en.wikipedia.org/wiki/Qcow
* https://launchpad.net/cirros/+download
[links]
* http://wiki.qemu.org/Main_Page
* http://en.wikipedia.org/wiki/Qcow
* https://launchpad.net/cirros/+download
No comments:
Post a Comment