[ltp] cloning 14G drives

Rob Mayoff linux-thinkpad@www.bm-soft.com
Tue, 30 Nov 1999 08:52:16 -0600 (CST)


| i tried the dd to /dev/null on the train home last night with
| 16383/16/63 and it still stopped at the 8G barrier.  so there
| is definitely a kernel or a kernel version dependence.
| more when i discover it...

I finally installed Redhat 6.1 last weekend (I've been using
Mandrake 6.0) and encountered the problem. My solution was to patch
/usr/src/linux/drivers/block/ide-disk.c. The function to change is
called lba_capacity_is_ok. I changed it to look like this:

/*--------------------------------------------------------------------*/
static int lba_capacity_is_ok (struct hd_driveid *id)
{
	unsigned long lba_sects   = id->lba_capacity;
#if 0
	unsigned long chs_sects   = id->cyls * id->heads * id->sectors;
	unsigned long _10_percent = chs_sects / 10;

	/*
	 * very large drives (8GB+) may lie about the number of cylinders
	 * This is a split test for drives 8 Gig and Bigger only.
	 */
	if ((id->lba_capacity >= 16514064) && (id->cyls == 0x3fff) &&
	    (id->heads == 16) && (id->sectors == 63)) {
#endif
		id->cyls = lba_sects / (16 * 63); /* correct cyls */
		return 1;	/* lba_capacity is our only option */
#if 0
	}
	/* perform a rough sanity check on lba_sects:  within 10% is "okay" */
	if ((lba_sects - chs_sects) < _10_percent) {
		return 1;	/* lba_capacity is good */
	}
	/* some drives have the word order reversed */
	lba_sects = (lba_sects << 16) | (lba_sects >> 16);
	if ((lba_sects - chs_sects) < _10_percent) {
		id->lba_capacity = lba_sects;	/* fix it */
		return 1;	/* lba_capacity is (now) good */
	}
	return 0;	/* lba_capacity value is bad */
#endif
}
/*--------------------------------------------------------------------*/

The only changes were to add the two #if/#endif pairs.  Now I can access
the whole disk.

I know this won't help if you're trying to install on a disk that
already has partitions above 8G.  I had to edit my partition table by
hand to work around that problem.  I'm still thinking about how new
users might avoid the problem.

----- The Linux ThinkPad mailing list -----
The linux-thinkpad mailing list home page is at:
http://www.bm-soft.com/~bm/tp_mailing.html