VIA 6420 RAID 0 problem

Marcin Simonides marcin at
Mon Nov 21 23:09:04 GMT 2005

I have (had?) two issues, perhaps connected:
(I posted a question to freebsd-questions about it some time ago. It 
contains some additional information:

The first one is a problem with RAID 0, where ar0 device shows size of 
one disk instead of the whole array (others report the same problem):

atapci0: <VIA 6420 SATA150 controller> port 
irq 20 at device 15.0 on pci0
ad0: 29314MB <IBM DTLA-307030 TX4OA60A> at ata0-master UDMA100
ad4: 76319MB <WDC WD800JD-00HKA0 13.03G13> at ata2-master SATA150
ad6: 76319MB <WDC WD800JD-00HKA0 13.03G13> at ata3-master SATA150
ar0: 76319MB <VIA Tech V-RAID RAID0 (stripe 16 KB)> status: READY
ar0: disk0 READY using ad4 at ata2-master
ar0: disk1 READY using ad6 at ata3-master

I could not access slices that started past the first half of array.

After trying different things and settings with sysinstall and 
linux-fdisk port I inspected src/sys/dev/ata/ata-raid.c and in 
ata_raid_via_read_meta() changed a line:

switch (meta->type & VIA_T_MASK) {
case VIA_T_RAID0:
     raid->type = AR_T_RAID0;
     raid->width = meta->stripe_layout & VIA_L_MASK;
-   raid->total_sectors = meta->total_sectors;
+   raid->total_sectors = meta->total_sectors * raid->width;

to multiply the number of total_sectors by the number of disks (I guess 
that's what raid->width stands for). I don't know if it is the right 
thing to do, it just seemed a reasonable fix :)
It works fine for me. I can access (read-write) a FAT32 slice that 
starts near the end of the array and the data is ok, can be read in 
FreeBSD and Windows with VIA's drivers. A UFS2 partition at the 
beginning of the array which I use for /usr also works fine, as before 
the change in kernel, so I think I haven't broken anything, at least for 
my configuration.
Can anybody comment on it? Or maybe I just should send a PR?

The other, perhaps connected with this, issue is that I lost an extended 
partition while creating FreeBSD partition. It had happened before I 
started trying to fix the size problem described above.
After slicing the newly created RAID 0 array with sysinstall and 
installing Windows, formatting NTFS and FAT slices (with Windows) I 
created BSD partitions on the first slice and lost the extended 
partition (slice). (a more detailed description of what I did is in the 
original posting to freebsd-questions).
Today, after the change in kernel, I have removed FreeBSD partitions 
from the first slice and recreated them (with some differences). Nothing 
wrong happened.
Could this be connected with the bug in VIA ata raid driver? Or maybe it 
was just a coincidence and/or was entirely my fault?
Marcin Simonides

More information about the freebsd-hackers mailing list