Re: lilo/raid?

Andries Brouwer (aebr@win.tue.nl)
Mon, 1 Jul 2002 17:59:10 +0200


On Mon, Jul 01, 2002 at 04:04:58PM +0200, Roy Sigurd Karlsbakk wrote:

> still - sorry if this is OT - I'm just too close to tear my hair or head off
> or something
>
> The documentation everywhere, including the lilo 22.3.1 sample conf ffile
> tells me "use boot = /dev/md0", but lilo, when run, just tells me
>
> Fatal: Filesystem would be destroyed by LILO boot sector: /dev/md0
>
> Please help

But (i) why don't you ask the maintainer of LILO,
(ii) why don't you read the source?

If I grep for "Filesystem would be destroyed" in the LILO sources
I find it in lilo-22.3.1/bsect.c:

ireloc = part_nowrite(boot_dev);
if (ireloc>1) {
die("Filesystem would be destroyed by LILO boot sector: %s", boot_dev);
}

So, some routine part_nowrite() returned a value larger than 1.
This routine lives in partition.c and does

int part_nowrite(char* device)
{
int fd;
BOOT_SECTOR bs;

int ret=0; /* say ok, unless we recognize a problem partition */

if ((fd = open(device, O_RDONLY)) < 0) pdie("part_nowrite check:");
if (read(fd, bs.sector, sizeof(bs)) != SECTOR_SIZE) pdie("part_nowrite: rea\
d:");

/* check for XFS */
if (!strncmp("XFSB", bs.sector, 4)) ret=2;

/* check for NTFS */
else if ( !strncmp("NTFS", bs.par_d.system, 4)
|| strstr(bs.sector,"NTLDR") ) ret=2;

/* check for SWAP -- last check, as 'bs' is overwritten */
else if (*(long*)bs.sector == 0xFFFFFFFEUL) {
if (lseek(fd, (PAGE_SIZE)-SECTOR_SIZE, SEEK_SET) != (PAGE_SIZE)-SECTOR_\
SIZE)
pdie("part_nowrite lseek:");
if (SECTOR_SIZE != read(fd, bs.sector, sizeof(bs)) ) pdie("part_nowrite\
swap check:");
if (!strncmp(bs.sector+SECTOR_SIZE-10,"SWAPSPACE2",10)
|| !strncmp(bs.sector+SECTOR_SIZE-10,"SWAP-SPACE",10) ) ret=2;
}

/* check for override (-F) command line flag */
if (ret==2 && force_fs) {
fprintf(errstd, "WARNING: '-F' override used. Filesystem on %s may be\
destroyed.\n", device);
ret=0;
}

return ret;
}

So, it looks like (1) you can use the -F flag and lilo will go ahead anyway,
(2) lilo thinks it recognizes XFS or NTFS or swap space on the boot sector
of your device.

It must be easy for you to investigate what you have in reality, and
determine whether there is any potential problem.

Andries
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/