Date: Wed, 2 Nov 2005 21:55:59 +0100 From: "Simon L. Nielsen" <simon@FreeBSD.org> To: freebsd-geom@FreeBSD.org Cc: Poul-Henning Kamp <phk@FreeBSD.org> Subject: geom_mirror MBR updates with fdisk fail Message-ID: <20051102205558.GA906@zaphod.nitro.dk>
next in thread | raw e-mail | index | archive | help
--rqzD5py0kzyFAOWN Content-Type: multipart/mixed; boundary="sHrvAb52M6C8blB9" Content-Disposition: inline --sHrvAb52M6C8blB9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hey Today I tried to change my slice table / MBR on a geom mirror disk system running 6.0-RC1 and it did not work. I traced the problem to the change to update MBR via geom which asumes that the device name is only one component and that doesn't work well with e.g. "/dev/mirror/gm0". I made a patch which fixes the problem for me (attached) and does not seem to break the common case, though I haven't done extensive testing. The fix is not really very elegant (e.g. it will likely fail if devfs is not in /dev) but I can't think of a better way of handling this, perhaps somebody else can? This is related to a similar problem in bsdlabel: http://cvsweb.FreeBSD.org/src/sbin/bsdlabel/bsdlabel.c#rev1.110 --=20 Simon L. Nielsen --sHrvAb52M6C8blB9 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="fdisk-graid-fix.0.patch" Index: fdisk.c =================================================================== RCS file: /home/ncvs/src/sbin/fdisk/fdisk.c,v retrieving revision 1.81 diff -u -d -r1.81 fdisk.c --- fdisk.c 17 Sep 2005 14:56:10 -0000 1.81 +++ fdisk.c 2 Nov 2005 20:36:37 -0000 @@ -753,11 +753,15 @@ grq = gctl_get_handle(); gctl_ro_param(grq, "verb", -1, "write MBR"); gctl_ro_param(grq, "class", -1, "MBR"); - q = strrchr(disk, '/'); - if (q == NULL) - q = disk; - else - q++; + if (strstr(disk, _PATH_DEV) != NULL) + q = disk + strlen(_PATH_DEV); + else { + q = strrchr(disk, '/'); + if (q == NULL) + q = disk; + else + q++; + } gctl_ro_param(grq, "geom", -1, q); gctl_ro_param(grq, "data", secsize, buf); q = gctl_issue(grq); --sHrvAb52M6C8blB9-- --rqzD5py0kzyFAOWN Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (FreeBSD) iD8DBQFDaSfeh9pcDSc1mlERAv10AKDEW4SwvYSgAGpJfXCQ0bacztEvcACeNjHd l2l5x+dp2xP5R6scOZgMzj8= =IWya -----END PGP SIGNATURE----- --rqzD5py0kzyFAOWN--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051102205558.GA906>