Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Nov 2008 12:40:42 +0530
From:      "Rajkumar S" <rajkumars@gmail.com>
To:        freebsd-stable@freebsd.org
Cc:        dev@pfsense.com
Subject:   ioctl DIOCSMBR: Inappropriate ioctl for device
Message-ID:  <64de5c8b0811242310l14932467kdcef55ab48322b23@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi,

I am working on a nanobsd derived system for updating an embedded
pfSense image. The disk is partitioned into 4 partitions with 2
similar "code" partitions. One of the two code partition is live at
any moment. To update the partition image is written to the other
partition and a command like boot0cfg -s 2 -v ad2 to boot to the new
partition.

Instead of using device names I am using bsdlabel and refer the disks
using the label in fdisk.

Current partitions are as follows:

nanoimg:~#  fdisk ad2
******* Working on device /dev/ad2 *******
parameters extracted from in-core disklabel are:
cylinders=1999 heads=16 sectors/track=63 (1008 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=1999 heads=16 sectors/track=63 (1008 blks/cyl)

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 32, size 239584 (116 Meg), flag 80 (active)
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 467/ head 15/ sector 32
The data for partition 2 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 239648, size 239584 (116 Meg), flag 0
        beg: cyl 468/ head 1/ sector 1;
        end: cyl 935/ head 15/ sector 32
The data for partition 3 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 479232, size 2048 (1 Meg), flag 0
        beg: cyl 936/ head 0/ sector 1;
        end: cyl 939/ head 15/ sector 32
The data for partition 4 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 481280, size 20480 (10 Meg), flag 0
        beg: cyl 940/ head 0/ sector 1;
        end: cyl 979/ head 15/ sector 32

dmesg shows the following when booting:

ad2: 983MB <LEXAR ATA FLASH V1.01> at ata1-master PIO4
GEOM: ad2: partition 4 does not start on a track boundary.
GEOM: ad2: partition 4 does not end on a track boundary.
GEOM: ad2: partition 3 does not start on a track boundary.
GEOM: ad2: partition 3 does not end on a track boundary.
GEOM: ad2: partition 2 does not start on a track boundary.
GEOM: ad2: partition 2 does not end on a track boundary.
GEOM: ad2: partition 1 does not start on a track boundary.
GEOM: ad2: partition 1 does not end on a track boundary.
GEOM_LABEL: Label for provider ad2s3 is ufs/cfg.
GEOM_LABEL: Label for provider ad2s4 is ufs/cf.
GEOM_LABEL: Label for provider ad2s1a is ufs/root0.
GEOM_LABEL: Label for provider ad2s2a is ufs/root1.
Trying to mount root from ufs:/dev/ufs/root0

Fstab is:

/dev/ufs/root0 / ufs ro 1 1
/dev/ufs/cfg /cfg ufs rw,noauto 2 2
/dev/ufs/cf /cf ufs ro 1 1

both ad2s1a and ad2s2a are active and they appear in boot screen as F1
and F2. I can manually press F1 and F2 and boot from either of them.
But when I give a command  boot0cfg -s 1 -v ad2 I get

boot0cfg: /dev/ad2: Class not found
boot0cfg: /dev/ad2: ioctl DIOCSMBR: Inappropriate ioctl for device

I have searched google and archives and could not find much about this
error. Any help to resolve this would be much appreciated.

with regards,

raj



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