Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Oct 2017 11:29:31 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Johan Hendriks <joh.hendriks@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Edit the qcow2 FreeBSD image file
Message-ID:  <20171004112931.bb6524b9.freebsd@edvax.de>
In-Reply-To: <dc133ebc-d931-6b9e-b989-bf8e69b2be81@gmail.com>
References:  <dc133ebc-d931-6b9e-b989-bf8e69b2be81@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 4 Oct 2017 09:47:47 +0200, Johan Hendriks wrote:
> I want to add a script to the default qcow2 file of the FreeBSD qcow2 image.
> But how do i mount the qcow2 file on FreeBSD?
> There are a lot of howto's how to do it on Linux but i do not always
> have a Linux box ready.

Without having verified, I'd say something like this will work:

	# mdconfig -a -t vnode -f <flename> -u 0
	# mount -t ufs -o rw /dev/md0s1a /mnt

The key is to connect the file to a md device ("memory disk"),
and then use it as if it was a real disk. But always check the
correct device file name - md0 will reflect the "disk layout"
of the image file, so maybe you need to use /dev/md0p1 or
/dev/md0a or simply /dev/md0, so check "ls /dev/md0*" to see
how the layout is being translated to device files - this
depends on the layout that has been constructed within the
image file.

When you're done, use:

	# umount /mnt
	# mdconfig -d -u 0

This will finally sync any changes and disconnect the device.
The image file can be used now.





-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171004112931.bb6524b9.freebsd>