From owner-freebsd-questions@freebsd.org Wed Oct 4 09:29:43 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0965CE33C91 for ; Wed, 4 Oct 2017 09:29:43 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mailrelay13.qsc.de (mailrelay13.qsc.de [212.99.187.253]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.antispameurope.com", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 738757D479 for ; Wed, 4 Oct 2017 09:29:41 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de ([213.148.129.14]) by mailrelay13.qsc.de; Wed, 04 Oct 2017 11:29:32 +0200 Received: from r56.edvax.de (port-92-195-63-92.dynamic.qsc.de [92.195.63.92]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPS id 52B1D3CBF9; Wed, 4 Oct 2017 11:29:32 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id v949TVv8003712; Wed, 4 Oct 2017 11:29:31 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Wed, 4 Oct 2017 11:29:31 +0200 From: Polytropon To: Johan Hendriks Cc: freebsd-questions@freebsd.org Subject: Re: Edit the qcow2 FreeBSD image file Message-Id: <20171004112931.bb6524b9.freebsd@edvax.de> In-Reply-To: References: Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-cloud-security-sender: freebsd@edvax.de X-cloud-security-recipient: freebsd-questions@freebsd.org X-cloud-security-Virusscan: CLEAN X-cloud-security-disclaimer: This E-Mail was scanned by E-Mailservice on mailrelay13.qsc.de with 889FA6835B7 X-cloud-security-connect: mx01.qsc.de[213.148.129.14], TLS=1, IP=213.148.129.14 X-cloud-security: scantime:.1355 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Oct 2017 09:29:43 -0000 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 -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, ...