From owner-freebsd-fs@FreeBSD.ORG Wed Oct 2 16:56:40 2013 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 9815316D for ; Wed, 2 Oct 2013 16:56:40 +0000 (UTC) (envelope-from sean_bruno@yahoo.com) Received: from nm4-vm4.bullet.mail.gq1.yahoo.com (nm4-vm4.bullet.mail.gq1.yahoo.com [98.136.218.163]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 680862836 for ; Wed, 2 Oct 2013 16:56:40 +0000 (UTC) Received: from [98.137.12.60] by nm4.bullet.mail.gq1.yahoo.com with NNFMP; 02 Oct 2013 16:56:33 -0000 Received: from [208.71.42.191] by tm5.bullet.mail.gq1.yahoo.com with NNFMP; 02 Oct 2013 16:56:33 -0000 Received: from [127.0.0.1] by smtp202.mail.gq1.yahoo.com with NNFMP; 02 Oct 2013 16:56:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1380732993; bh=fjSolWjN82FYuGN7sp0XFsqilsRh0adEwKcAfPWacEk=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Subject:From:Reply-To:To:Cc:In-Reply-To:References:Content-Type:Date:Message-ID:Mime-Version:X-Mailer; b=Bx1raVTYoUluy+0Y35iha4uls3HXgBRrZxjvMZoLg+36xmGzM0c9iK2/jpt9bd9OfXzYfA/qWcBjWv1L4CH5Qy6C9sjsztl6RbDGwRHGb8LEs498DmrIFS21ihzVljVyxpvhlZ9GLHOJYRxWwBRMAEG+uMo+Z5Uk9zwI1ykB2AU= X-Yahoo-Newman-Id: 782592.9112.bm@smtp202.mail.gq1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: YDvj1EoVM1nPm8vB_AHLa5AhkbOoJE3cB3UXj0EM7Rwx_U1 vBfqVgrbshmPen_Of6SKJ.cjniE4Rl2pF6sS0AUnBZ9CDACQZ0bK0NezdAK3 JFbFiZ6omqp7.KQsChRnPnSIqZsdk0u5rYAfp8Bw1Oz_N8c9S8ef8CyLV99t yeeYjIxAjUAA3nF54OimJygN.DkxEJBxRYY_2fzSVy0uOjYcjZo3lhRoSB9_ YM3yeCnCeM7667DT.jG1gHoCpAOl.bTGrD31pMVixjJyZNdr4Wip28XBre43 aJrrlU9O9zQv6K9QkYgvkGr48Euu_wP3KrPqCWttpsEfX6j0SBLLOIGQJe8. BYc6JMqYCIEcEg9h6a.PgXe2fzC7E87DvlIx41.XD7gsF8g5ZqF9kzT180sx 9tEv3gJhWg9ySo5hKB5_jQUZ6ibDlrnNtDfMQl8SgK_RcfNrTB6ZOR2G0YP. zLPVXsUXc.zYHI7nQawzsKU7vUBplgCb9ewPZQvATbyIPQcd.5Pm9SpUYPuK 8ftIusa6MDHh8rTKvvIk5M5UqipqyEmW_H8C56H6TrkMceihYl_QKaH7WbwR O8py1bjk- X-Yahoo-SMTP: u5BKR6OswBC_iZJVfGRoMkTIpc8pEA4- X-Rocket-Received: from [10.73.160.242] (sean_bruno@209.131.62.116 with ) by smtp202.mail.gq1.yahoo.com with SMTP; 02 Oct 2013 09:56:33 -0700 PDT Subject: Re: Endian issues, LE write to BE partitions From: Sean Bruno To: John-Mark Gurney In-Reply-To: <20131002164408.GB56872@funkthat.com> References: <1380730546.1619.47.camel@localhost> <20131002164408.GB56872@funkthat.com> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-djOkgtXHBc5VCZFrmvcl" Date: Wed, 02 Oct 2013 09:56:32 -0700 Message-ID: <1380732992.6516.11.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Cc: freebsd-fs@freebsd.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: sbruno@freebsd.org List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Oct 2013 16:56:40 -0000 --=-djOkgtXHBc5VCZFrmvcl Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On Wed, 2013-10-02 at 09:44 -0700, John-Mark Gurney wrote: > Sean Bruno wrote this message on Wed, Oct 02, 2013 at 09:15 -0700: > > Using makefs from an amd64 host to build a f/s in a VTOC8 partition wil= l > > destroy the entire partition table. I simplified the test to simple dd > > to an existing partition and got the same result, exonerating mkfs > >=20 > > I suspect a lack of endian knowledge in geom itself, not > > geom_part_vtoc8. =20 > >=20 > > test case: > > using amd64 host (10.0 current) create monolothic image > > truncate -s+5G /var/tmp/myfile.img > > mdconfig -f /var/tmp/myfile.img > > build and load geom_part_vtoc8 kernel module > > use gpart to create VTOC8 part table > > add partition to part table to yeild the following: > >=20 > > =3D> 0 10442250 md0 VTOC8 (5.0G) > > 0 10442250 1 freebsd-ufs (5G) =20 >=20 > This looks like a user error, or an issue that VTOC allows you to > create/write to a partition that covers the label metadata... So this > is most definately a VTOC8 issue... VTOC8 should at least return an > error when trying to write sectors that contain it's metadata.. >=20 Do you mean "user error" in that I personally executed a command that should not have been run or "user error" in that the geom_part_vtoc8 "user" should not allow me to dd to the partition? I suspect that on a g_write() from geom_part_vtoc8, the data is not be swapped around correctly. Should the geom_part_vtoc8 module be swapping the data in this case (writing from a LE machine to a BE f/s)? > newfs actually skips the first few KB of the disk because bsdlabels > would do the same thing... >=20 I would prefer to use newfs in this case actually, but it has no knowledge of how to write Big Endian f/s on Little Endian systems. Hence I was stuck with trying to use makefs in this case to get the f/s populated. Unless I'm mistaken, if I use newfs on this disk image from my amd64 host, it will get a little endian f/s. I'm assuming that this is part of my current problem. > This sounds like makefs is writing to the first few KB of the disk > unlike newfs which probably doesn't (because it knows it might be on > a partitioned disk and could destroy the partition table)... makefs, in this case, isn't really doing anything wrong here. Like dd, its using the target device as a destination for a file system creation. That's why I switched my test case over to dd, from makefs, for simplification of the problem. >=20 > > dd to md0a from dev zero for just a bit > > dd if=3D/dev/zero of=3D/dev/md0a bs=3D64k count=3D100 > >=20 > > destroy md0 via mdconfig -d -u 0 > > recreate it with mdconfig -f /var/tmp/myfile.img > >=20 > > gpart displays no partions for the image any more: > > gpart: No such geom: md0. > >=20 >=20 --=-djOkgtXHBc5VCZFrmvcl Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (FreeBSD) iQEcBAABAgAGBQJSTFBAAAoJEBkJRdwI6BaHZy8H/31W9EX3qo8z8aGuGruDNFOD 7JuZPzPnHfchbih7McCJQ0+3OW09Svl2wuRUxir/G/A5ExM/2foTl0HAvkO6iky0 e/ciDzamg6lSt+oXkqmRAVyGhM17jg5KPTnpv4RA7hkDu0BRQ4nKAi6XuKk5ndsc fdGbRrLS230+6asgzRQPSCidvurBCSaYwxryY6Ck5pXmR70zvuOvl4u3Pa5RK+bN BJkIv75CJV8xneOUsYuapJz92aQ8vE0SnUOfM/YyfgyY3JumaEebNUXd9aZNPQtX prvAr1/p8oVuX+xwOF2gOYfmq73xiwBFJ+OqRb174mjwedWbzzjclr6QMrZAjfQ= =0Qk4 -----END PGP SIGNATURE----- --=-djOkgtXHBc5VCZFrmvcl--