#166 scsi disk disconnects while creating an ext3 filesystem


I'm trying to make a mkfs.ext3 /dev/sda1 , while sda is scsi0=\Device\Harddisk2\Partition0 , an 8 GB USB Flash Pen drive.
Before mkfs ends, the linux console starts complaining with lots of lines like:

sd:0:0:0:0: rejecting I/O to offline device

and after stop, /sda is no longer visible.

Tried with the 20091115 snapshot.


  • Before 20091115 snapshot I've had the similar error. With 20091115 everything works. But you and me have different preconditions:

    My case Your case
    Image on hard drive USB pen drive
    Only while switching NT processes ???

    When I've tested new SVN revision r1293, have tried only "simple" magic:
    1. Open "Process Explorer" window.
    2. While 'mkfs' working, mouse clicked at "Process Explorer" and back at "colinux-console-nt".

    For previous revision with this two conditions the error was reproduced. With last revision - not.

    If you want somebody to reproduce this error, please write, what have you exactly did while 'mkfs.ext3' worked? I mean your activity with mouse, keyboard, or other user interface input devices, which coLinux console was used and so on. Some NT processes may block (lock) devices for it's "individual use" and it is erroneus to work with the drive or partition at this time from coLinux. So your "magic" may be much complicated than my.

    Then I can check three USB Flash Drives of various vendors: 4, 8, and 32 Gb.


  • Just now I've noticed the error in your parameter:
    scsi0=\Device\Harddisk2\Partition0 <== scsi0 is disk with Master Boot Record, it is NOT partition.

    When you run 'mkfs.ext3 /dev/sda1', you are trying to use /dev/sda1 as "the partition of of the partition", not as the partition of of the disk.

    Your should use scsi0=\Device\Harddisk2
    (without '\Partition0)


  • As far as I know, \Device\HarddiskN\Partition0 refers to the whole device, including MBR and all partitions. I'm, using it like that in other tool without problems for a long time. I need access to the MBR because I need to repartition the device.

    About the other comment, I had a normal usage pattern while mkfs'ing the disk, I opened other windows, change active focus, etc. I didn't did any heavy task, but I was neither frozen while it worked.

    The Flash disk didn't had associated any drive letter, either.


  • Each Harddisk has only one Master Boot Record (512 byte sector at the very beging of the disk with partition table at the end of the MBR) . Each partion has own boot sector, also 512 bytes, but wihout partition table. Please read documentation, for example http://en.wikipedia.org/wiki/Master_boot_record


  • I know, Peter. I didn't say otherwise.

    Read again my message. I'm only stating that, in Windows block device nomenclature, ...\Partition0 is the whole disk
    I don't like it that way, and would rather prefer \Device\HarddiskN as the whole disk, but ask MS why is it like that.

    If you don't belive it, ok.
    quote: "The DeviceName parameter, \device\harddisk0\partition0, refers to the whole hard disk."

    (taken from http://support.microsoft.com/?scid=kb%3Ben-us%3B821303&x=14&y=11 )

  • Article "HOW TO: Create Multiple Partitions by Using the Bmpart.exe Tool in Automated Deployment Services" (http://support.microsoft.com/?scid=kb%3Ben-us%3B821303&x=14&y=11 )
    describes only input parameters for Bmpart.exe: "The DeviceName PARAMETER, \device\harddisk0\partition0, refers to the whole hard disk", not the structure of the hard disk. Bmpart.exe can extract the whole hard disk NAME "\device\harddisk0" from the string "\device\harddisk0\partition0".

    What way and why it will be done "mkfs.ext3"? This program has no idea that somewhere on the NT-side you made a mistake in the parameters of another program, "colinux-daemon.exe".


  • Please, read about "scsiX=..." parameter in "colinux-daemon.txt" more carefully:
    <path to image file> can be a raw disk drive, with format
    "\\.\PhysicalDriveX", where X starts with 0 for first harddisk. Be
    carefully with these configs, you risk datas on your drive C:.
    Don't mount a partition that is in use on windows side!

    "\\.\PhysicalDriveX", but not "\\.\PhysicalDriveX\PartitionY".


  • About the bug:

    I have tried using cobd0=\device\harddisk2\partition0 instead of scsi, and it works ok. Only that then I can't access the partitions as cobd01 or something like that. I think I can make a workaround using several consecutive invocations to colinux:
    - scsi0=... for creating the partitions
    - several cobdX for formatting and installing the data I need.

    I'll try as soon as I can.

    Thanks in advance,

    And about \device\harddiskX\partition0 or not:


    I didn't used \\.\PhysicalDriveX\Partition0, but \device\harddiskX\Partition0. It's not the same thing.

    Anyway, I wanted to know if \device\harddiskX and \device\harddiskX\partition0 are synonyms, but it doesn't seem like that:

    With a new 8 GB flash pen and colinux using scsi0=\device\harddisk2\partition0:

    scsi0 : Cooperative Linux SCSI Adapter
    scsi 0:0:0:0: Direct-Access coLinux CODISK 1.01 PQ: 0 ANSI: 5
    sd 0:0:0:0: [sda] 15646720 512-byte hardware sectors (8011 MB)
    sd 0:0:0:0: [sda] 15646720 512-byte hardware sectors (8011 MB)
    sda: sda1
    sd 0:0:0:0: [sda] Attached SCSI disk

    colinux:~# fdisk -l
    Disk /dev/sda: 8011 MB, 8011120640 bytes
    247 heads, 62 sectors/track, 1021 cylinders
    Units = cylinders of 15314 * 512 = 7840768 bytes
    Disk identifier: 0x1ceab904

    With, as suggested, scsi0=\device\harddisk2:

    scsi0 : Cooperative Linux SCSI Adapter
    scsi 0:0:0:0: Direct-Access coLinux CODISK 1.01 PQ: 0 ANSI: 5
    coscsi0: unable to open device! rc: 1
    coscsi0: unable to open device! rc: 1
    coscsi0: unable to open device! rc: 1
    coscsi0: unable to open device! rc: 1
    sd 0:0:0:0: [sda] READ CAPACITY failed
    sd 0:0:0:0: [sda] Result: hostbyte=0x00 driverbyte=0x00
    sd 0:0:0:0: [sda] Sense not available.
    sd 0:0:0:0: [sda] Attached SCSI disk

    colinux:~# fdisk -l

    I haven't tried with the \\.\PhysicalDriveX.. syntax, because the previous version of the tool I'm making, wich is just a kind of dd but in windows, uses \device\harddiskX\Partition0 for writting raw binary disk images, with MBR and usually 4 partitions, and works fine.

    * From http://www.cygwin.com/cygwin-ug-net/using-specialnames.html

    The new fixed POSIX names are mapped to NT internal devices as follows:
    /dev/sda \device\harddisk0\partition0 (whole disk)
    /dev/sda1 \device\harddisk0\partition1 (first partition)
    /dev/sda15 \device\harddisk0\partition15 (fifteenth partition


    /dev/sda is like \device\harddisk0\partition0
    /dev/sda1 is like \device\harddisk0\partition1

    The partition numbers start with 1, not with 0. In windows the partition0 is then reserved for the whole disk, wich is just what I need to access in colinux


  • 1. I am sorry. From MS docs I knows, that the disks are numbered from 0, and partitions from 1. When I want to access entire disk, I newer use "\PartitonY". So I've noticed word "partition",
    and ignored its number :).

    2. I tried to reproduce the error several times, using Flash Drives 4, 8 and 32 Gb, but did not succeed. The message "coscsi0: unable to open device..." may indicate that the disk is used by another process. The drive letter does not matter, because is the letter of the partition. The NT-program can access entire disk as "\\.\PhysicalDriveX" and disk can be locked. So it is very important to know what processes, system or not, are running at NT-side when you started coLinux.


  • Hi again,

    I have been able to work around the problem, using cobd0 for \Device\Harddisk2\Partition0 and then creating offseted loops that simulate the different partitions. Not pretty, but works.

    The write performance is not very good, though, about 5 MB/s


  • Henry N.
    Henry N.

    Inside SCSI driver we have fixed two bugs, that can be results here. Ones was a 4GB limit and an other was an internal error with addressing of SG table.
    Both fixed as SVN revisions 1572 and 1547.
    New bugs should open new report please.

  • Henry N.
    Henry N.

    • status: open --> closed-out-of-date