From owner-freebsd-questions@FreeBSD.ORG Thu Jul 28 23:40:47 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2911116A41F for ; Thu, 28 Jul 2005 23:40:47 +0000 (GMT) (envelope-from dpk@dpk.net) Received: from shared10.hosting.flyingcroc.net (shared10.hosting.flyingcroc.net [207.246.149.144]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0EE7E43D6D for ; Thu, 28 Jul 2005 23:40:44 +0000 (GMT) (envelope-from dpk@dpk.net) Received: from shared10.hosting.flyingcroc.net (localhost [127.0.0.1]) by shared10.hosting.flyingcroc.net (8.12.9p2/8.12.10) with ESMTP id j6SNefrR070102; Thu, 28 Jul 2005 16:40:41 -0700 (PDT) Received: from localhost (dpk@localhost) by shared10.hosting.flyingcroc.net (8.12.9p2/8.12.10/Submit) with ESMTP id j6SNef0Y070099; Thu, 28 Jul 2005 16:40:41 -0700 (PDT) X-Authentication-Warning: shared10.hosting.flyingcroc.net: dpk owned process doing -bs Date: Thu, 28 Jul 2005 16:40:41 -0700 (PDT) From: dpk X-X-Sender: dpk@shared10.hosting.flyingcroc.net To: Giorgos Keramidas In-Reply-To: <20050728231035.GA60181@gothmog.gr> Message-ID: <20050728161608.Q79761@shared10.hosting.flyingcroc.net> References: <20050719145822.W23753@shared10.hosting.flyingcroc.net> <441x5tk3e9.fsf@be-well.ilk.org> <20050720064637.Q23753@shared10.hosting.flyingcroc.net> <20050721100327.GA16179@beatrix.daedalusnetworks.priv> <20050728154356.A79761@shared10.hosting.flyingcroc.net> <20050728225701.GB46755@gothmog.gr> <20050728155804.T79761@shared10.hosting.flyingcroc.net> <20050728231035.GA60181@gothmog.gr> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: freebsd-questions@freebsd.org Subject: Re: Large filesystem woes X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2005 23:40:47 -0000 On Fri, 29 Jul 2005, Giorgos Keramidas wrote: > Hmmm, in multiuser mode, your root filesystem is mounted as read-write > and it resides in da0, so GEOM will forbid opening the disk device in > read-write mode for editing the partition table. > > In single user mode, devfs is still used, but your root filesystem > should be mounted read-only (unless you manually mount it as > read-write), so fdisk -u should work. I've remounted the disk readonly, and was still seeing the same errors. I've looked at the fdisk source and compared it to the truss output. ... /* rwmode is O_RDWR due to -u */ fd = open(disk, rwmode); ... /* errno is EPERM here, from truss */ if (fd == -1 && errno == ENXIO) return -2; if (fd == -1 && errno == EPERM && rwmode == O_RDWR) { ... /* this is successful: */ fd = open(disk, O_RDONLY); ... /* the following opens get device not configured, or no such file or directory under normal operation, from truss */ for (p = 1; p < 5; p++) { asprintf(&s, "%ss%d", disk, p); fdw = open(s, O_RDONLY); free(s); if (fdw == -1) continue; break; } ... /* ah ha! open_disk is returning -4 because the last slice had some error */ if (fdw == -1) return -4; This change was introduced with version 1.67 of the fdisk.c file. Commenting out if (fdw == -1) return -4; allows fdisk -u to function. Here are the results, not changing anything: # ./fdisk -u ******* Working on device /dev/da0 ******* parameters extracted from in-core disklabel are: cylinders=534921 heads=255 sectors/track=63 (16065 blks/cyl) Figures below won't work with BIOS for partitions not in cyl 1 parameters to be used for BIOS calculations are: cylinders=534921 heads=255 sectors/track=63 (16065 blks/cyl) Do you want to change our idea of what BIOS thinks ? [n] Media sector size is 512 Warning: BIOS sector numbering starts with sector 1 Information from DOS bootblock is: The data for partition 1 is: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 63, size 75489372 (36860 Meg), flag 80 (active) beg: cyl 0/ head 1/ sector 1; end: cyl 1023/ head 254/ sector 63 Do you want to change it? [n] The data for partition 2 is: Do you want to change it? [n] The data for partition 3 is: Do you want to change it? [n] The data for partition 4 is: Do you want to change it? [n] Partition 1 is marked active Do you want to change the active partition? [n] Here are the results of ./fdisk -u when trying to add the second partition: # ./fdisk -u ******* Working on device /dev/da0 ******* parameters extracted from in-core disklabel are: cylinders=534921 heads=255 sectors/track=63 (16065 blks/cyl) Figures below won't work with BIOS for partitions not in cyl 1 parameters to be used for BIOS calculations are: cylinders=534921 heads=255 sectors/track=63 (16065 blks/cyl) Do you want to change our idea of what BIOS thinks ? [n] n Media sector size is 512 Warning: BIOS sector numbering starts with sector 1 Information from DOS bootblock is: The data for partition 1 is: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 63, size 75489372 (36860 Meg), flag 80 (active) beg: cyl 0/ head 1/ sector 1; end: cyl 1023/ head 254/ sector 63 Do you want to change it? [n] n The data for partition 2 is: Do you want to change it? [n] y Supply a decimal value for "sysid (165=FreeBSD)" [0] 165 Supply a decimal value for "start" [0] Supply a decimal value for "size" [0] fdisk: ERROR: size of partition is zero fdisk: ERROR: failed to adjust; setting sysid to 0 Explicitly specify beg/end address ? [n] y Supply a decimal value for "beginning cylinder" [0] 1024 Supply a decimal value for "beginning head" [0] Supply a decimal value for "beginning sector" [0] Supply a decimal value for "ending cylinder" [0] 534921 Supply a decimal value for "ending head" [0] 254 Supply a decimal value for "ending sector" [0] 63 sysid 0 (0000),(unused) start 0, size 0 (0 Meg), flag 0 beg: cyl 0/ head 0/ sector 0; end: cyl 393/ head 254/ sector 63 Writing it fails, but I didn't really expect it to succeed with the above values. There's some overflowing going on.