Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jul 2005 16:40:41 -0700 (PDT)
From:      dpk <dpk@dpk.net>
To:        Giorgos Keramidas <keramida@ceid.upatras.gr>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Large filesystem woes
Message-ID:  <20050728161608.Q79761@shared10.hosting.flyingcroc.net>
In-Reply-To: <20050728231035.GA60181@gothmog.gr>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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:
<UNUSED>
Do you want to change it? [n]
The data for partition 3 is:
<UNUSED>
Do you want to change it? [n]
The data for partition 4 is:
<UNUSED>
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:
<UNUSED>
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050728161608.Q79761>