From owner-freebsd-questions@freebsd.org Wed Oct 4 10:01:39 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 58B9EE34BC5 for ; Wed, 4 Oct 2017 10:01:39 +0000 (UTC) (envelope-from joh.hendriks@gmail.com) Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D266D7EC2C for ; Wed, 4 Oct 2017 10:01:38 +0000 (UTC) (envelope-from joh.hendriks@gmail.com) Received: by mail-wm0-x234.google.com with SMTP id u138so22017813wmu.4 for ; Wed, 04 Oct 2017 03:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=hkqljNlwm+Dh2hPaNyQDrrFneBuTJBC3ywvWrgYQKhw=; b=tM88BZuG4SHNYkXN6AuNS+UWhfO4xG9uhVsO80H29jAA9Qh1FsoSkE+PZ4Cvw4Cr6m 0Ac6eltsH7bMYB5p+gUYmx3q+J4xxvWdLZRLnD/RVAWtOy+TXOvhi5+m8td7oNx4EZsi O3gSZGhdItYwUjQkRCFl1Xn1sHMuo6pGQEBiBRhcozaiUdpWDnQ4Vs0WgSiOQ0rubKF1 Cf3ZPU1uajpw8vSqzzmzUln4OpkCnH+841eLnluIYXpTkpKCnkg0oWj4cBH/Qx2drLGl eUpeOwD0WVybT+MC4p59S1A9Ye5jaOKCqMzRP+ezcy+iK5aQ5AA0o5eDEsphSC7IETqP NSvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=hkqljNlwm+Dh2hPaNyQDrrFneBuTJBC3ywvWrgYQKhw=; b=RTZhxjujeKwIy65lwEp1zN3kmEO7JV/MvErfESZgWt7IoXssO5hKYuPXVolxoeOqeX M08Zc8xkuV3PV4+vYGuZWQSuEO6XNv73EIJt2FVdAlF4VO+nWyLf0sDkKFYZrYMaCirf 4J89ptahaSlwZ9pKcoHTVwBj+Gl30lkn0yDzX7a+Zz3flKwmDMguBX3gf7mOW1sTjXo3 nLhratDQT3VSwWa0Q70XF5au1mlWxn9fJJBciBaRsSphIvHZGRei9FPxtUxqkYGoPtbR CWxalNqC38oWc9sDmd7NjSoC/kwW8kMn+yJZZQ6qnl2iZ+HGR1cKCfMa22itMJalbWLd KcXA== X-Gm-Message-State: AHPjjUjeOjW8VhmCfJysLR8y4YwYSnl6FGDDZksVyvApikrA/D0NdndK RqzRIpvgf7iWruWjjzIciEdm2A== X-Google-Smtp-Source: AOwi7QAXCYDFx52nIQx9hmK2mQ8GBPfZso3mUpJ21z4tJbvkqAEWpcltioUH/ezG6Ct0ROcPqKShGA== X-Received: by 10.80.183.148 with SMTP id h20mr28085368ede.178.1507111297249; Wed, 04 Oct 2017 03:01:37 -0700 (PDT) Received: from Johans-MacBook-Air-2.local (92-111-79-242.static.chello.nl. [92.111.79.242]) by smtp.googlemail.com with ESMTPSA id c5sm12455696edd.43.2017.10.04.03.01.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 03:01:36 -0700 (PDT) Subject: Re: Edit the qcow2 FreeBSD image file To: Polytropon References: <20171004112931.bb6524b9.freebsd@edvax.de> From: Johan Hendriks Cc: freebsd-questions@freebsd.org Message-ID: Date: Wed, 4 Oct 2017 12:02:56 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171004112931.bb6524b9.freebsd@edvax.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: nl 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 10:01:39 -0000 Op 04/10/2017 om 11:29 schreef Polytropon: > 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. > Thanks, I tried that, but it does not work. root@desk:~ # mdconfig -a -t vnode -f FreeBSD-11.1-RELEASE-amd64.qcow2 -u 0 Then a ls of /dev/md0 only shows md0 and i can not mount that one. root@desk:~ # ls -al /dev/md* crw-r-----  1 root  operator  0x8c Oct  4 11:48 /dev/md0 crw-------  1 root  wheel      0xb Sep 21 14:16 /dev/mdctl And a mount of /dev/md0 gives an error. root@desk:~ # mount -t ufs -o rw /dev/md0 /mnt mount: /dev/md0: Invalid argument regards Johan