Re: Mount on harddisc failed with 1.3.25

Jeffrey S. Norman (norman@interaccess.com)
Wed, 13 Sep 1995 15:01:15 -0500 (CDT)


On Wed, 13 Sep 1995 Andries.Brouwer@cwi.nl wrote:

> : After installing the kernel version 1.3.25:
> : /dev/sda9 not a mount point
> : With kernel 1.3.18 the mount works perfect!
>
> 1. Get a better mount and you'll have better error messages.
> 2. Recently, the kernel learned how to recognize more partitions.
> So, if you have a partition that was not recognized before,
> or just some junk on the disk in a partition table that
> the kernel did not look at earlier, then all following
> partitions will have their number increased.
> Look at the boot messages. Is your old /dev/sda9 now /dev/sda10?

No. That isn't it, at least on my machine. I have two back to back
HPFS (OS/2) partitions, hda5 and hda6. Linux recognized these partitions
without any problem in 1.3.12, but from 1.2.24 on it has only recognized
the *first* partition, hda5. Wrt hda6, I now get the error quoted above,
but also a more telling error:

HPFS: hpfs_superblock_read: not hpfs

Of course, chkdisk under OS/2 and Linux's fdisk do not report any errors.
In fact, fdisk recognizes hda6 without any problem as HPFS.

Below is an explanation of a similar error, with a fix, under msdos
partitions undr 1.3.0. I would like to apply this fix to HPFS but
don't know enough about the structure of hpfs blocks. ANybody know
more about this?

----------- FIX FOR MSDOS PARITIONS ---------

--------------------------------- dosfs.patch ---------------------------------

diff -ur ref/fs/msdos/inode.c linux/fs/msdos/inode.c
--- ref/fs/msdos/inode.c Mon Jan 23 09:38:28 1995
+++ linux/fs/msdos/inode.c Thu Feb 2 16:10:03 1995
@@ -170,7 +170,7 @@
{
struct buffer_head *bh;
struct msdos_boot_sector *b;
- int data_sectors,logical_sector_size,sector_mult;
+ int data_sectors,logical_sector_size,sector_mult,fat_clusters;
int debug,error,fat,quiet;
char check,conversion;
uid_t uid;
@@ -248,11 +248,12 @@
b->cluster_size/sector_mult : 0;
MSDOS_SB(sb)->fat_bits = fat ? fat : MSDOS_SB(sb)->clusters >
MSDOS_FAT12 ? 16 : 12;
+ fat_clusters = MSDOS_SB(sb)->fat_length*SECTOR_SIZE*8/
+ MSDOS_SB(sb)->fat_bits;
error = !MSDOS_SB(sb)->fats || (MSDOS_SB(sb)->dir_entries &
- (MSDOS_DPS-1)) || MSDOS_SB(sb)->clusters+2 > MSDOS_SB(sb)->
- fat_length*SECTOR_SIZE*8/MSDOS_SB(sb)->fat_bits ||
- (logical_sector_size & (SECTOR_SIZE-1)) || !b->secs_track ||
- !b->heads;
+ (MSDOS_DPS-1)) || MSDOS_SB(sb)->clusters+2 > fat_clusters+
+ MSDOS_MAX_EXTRA || (logical_sector_size & (SECTOR_SIZE-1))
+ || !b->secs_track || !b->heads;
}
brelse(bh);
/*
@@ -278,6 +279,8 @@
sectors),b->total_sect,logical_sector_size);
printk ("Transaction block size = %d\n",blksize);
}
+ if (MSDOS_SB(sb)->clusters+2 > fat_clusters)
+ MSDOS_SB(sb)->clusters = fat_clusters-2;
if (error) {
if (!silent)
printk("VFS: Can't find a valid MSDOS filesystem on dev 0x%04x.\n",
diff -ur ref/include/linux/msdos_fs.h linux/include/linux/msdos_fs.h
--- ref/include/linux/msdos_fs.h Tue Dec 27 07:37:13 1994
+++ linux/include/linux/msdos_fs.h Thu Feb 2 17:08:51 1995
@@ -21,6 +21,9 @@

#define FAT_CACHE 8 /* FAT cache size */

+#define MSDOS_MAX_EXTRA 3 /* tolerate up to that number of clusters which are
+ inaccessible because the FAT is too short */
+
#define ATTR_RO 1 /* read-only */
#define ATTR_HIDDEN 2 /* hidden */
#define ATTR_SYS 4 /* system */

-- 

--- Thanks to Werner Almesberger for posting the above fix