* Lost Partition
@ 2001-10-11 12:14 Vincent Sweeney
2001-10-11 13:01 ` Alexander Viro
2001-10-11 13:19 ` [PATCH] " Alexander Viro
0 siblings, 2 replies; 10+ messages in thread
From: Vincent Sweeney @ 2001-10-11 12:14 UTC (permalink / raw)
To: linux-kernel
I have just upgrade my kernel to 2.4.12 and in the process I've lost a
partition on my secondary IDE drive. Since this is my /usr partition
it's kind of important ;)
Here is the relevant section from my dmesg output and fdisk (note
/dev/hdb5 is the one missing). The output from fdisk in recovery mode
can see the partition and the ID looks correct but the kernel seems to
have an 'issue'.
If you need any more details just ask.
Vince.
---
ide: Assuming 33MHz system bus speed for PIO modes; override with
idebus=xx
VP_IDE: IDE controller on PCI bus 00 dev 39
VP_IDE: chipset revision 6
VP_IDE: not 100% native mode: will probe irqs later
ide: Assuming 33MHz system bus speed for PIO modes; override with
idebus=xx
VP_IDE: VIA vt82c686b (rev 40) IDE UDMA100 controller on pci00:07.1
ide0: BM-DMA at 0xd400-0xd407, BIOS settings: hda:DMA, hdb:DMA
ide1: BM-DMA at 0xd408-0xd40f, BIOS settings: hdc:DMA, hdd:pio
hda: SAMSUNG SV1021H, ATA DISK drive
hdb: SAMSUNG SV1021H, ATA DISK drive
hdc: LG CD-ROM CRD-8521B, ATAPI CD/DVD-ROM drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
hda: 19932192 sectors (10205 MB) w/426KiB Cache, CHS=1240/255/63,
UDMA(33)
hdb: 19932192 sectors (10205 MB) w/426KiB Cache, CHS=1240/255/63,
UDMA(33)
Partition check:
hda: hda1 hda2 < hda5 hda6 hda7 hda8 >
hdb: hdb1 hdb2 < >
---
Disk /dev/hda: 255 heads, 63 sectors, 1240 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 9 72261 83 Linux
/dev/hda2 10 1240 9888007+ 5 Extended
/dev/hda5 10 140 1052226 83 Linux
/dev/hda6 141 271 1052226 83 Linux
/dev/hda7 272 337 530113+ 83 Linux
/dev/hda8 338 1240 7253316 83 Linux
Disk /dev/hdb: 255 heads, 63 sectors, 1240 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 66 530113+ 82 Linux swap
/dev/hdb2 67 1240 9430155 5 Extended
/dev/hdb5 67 1240 9430123+ 83 Linux
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: Lost Partition 2001-10-11 12:14 Lost Partition Vincent Sweeney @ 2001-10-11 13:01 ` Alexander Viro 2001-10-11 13:19 ` [PATCH] " Alexander Viro 1 sibling, 0 replies; 10+ messages in thread From: Alexander Viro @ 2001-10-11 13:01 UTC (permalink / raw) To: Vincent Sweeney; +Cc: linux-kernel On Thu, 11 Oct 2001, Vincent Sweeney wrote: > Disk /dev/hdb: 255 heads, 63 sectors, 1240 cylinders > Units = cylinders of 16065 * 512 bytes > > Device Boot Start End Blocks Id System > /dev/hdb1 * 1 66 530113+ 82 Linux swap > /dev/hdb2 67 1240 9430155 5 Extended > /dev/hdb5 67 1240 9430123+ 83 Linux How about the contents of sectors 0 and 1076355? ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] Re: Lost Partition 2001-10-11 12:14 Lost Partition Vincent Sweeney 2001-10-11 13:01 ` Alexander Viro @ 2001-10-11 13:19 ` Alexander Viro 2001-10-11 13:25 ` Stefan Smietanowski ` (2 more replies) 1 sibling, 3 replies; 10+ messages in thread From: Alexander Viro @ 2001-10-11 13:19 UTC (permalink / raw) To: Vincent Sweeney; +Cc: linux-kernel On Thu, 11 Oct 2001, Vincent Sweeney wrote: > I have just upgrade my kernel to 2.4.12 and in the process I've lost a > partition on my secondary IDE drive. Since this is my /usr partition > it's kind of important ;) Please, see if the following fixes the problem. --- S11/fs/partitions/msdos.c Tue Oct 9 21:47:27 2001 +++ /tmp/msdos.c Thu Oct 11 09:18:22 2001 @@ -103,21 +103,20 @@ */ static void extended_partition(struct gendisk *hd, struct block_device *bdev, - int minor, int *current_minor) + int minor, unsigned long first_size, int *current_minor) { struct partition *p; Sector sect; unsigned char *data; - unsigned long first_sector, first_size, this_sector, this_size; + unsigned long first_sector, this_sector, this_size; int mask = (1 << hd->minor_shift) - 1; int sector_size = get_hardsect_size(to_kdev_t(bdev->bd_dev)) / 512; int loopct = 0; /* number of links followed without finding a data partition */ int i; - first_sector = hd->part[minor].start_sect; - first_size = hd->part[minor].nr_sects; - this_sector = first_sector; + this_sector = first_sector = hd->part[minor].start_sect; + this_size = first_size; while (1) { if (++loopct > 100) @@ -133,8 +132,6 @@ p = (struct partition *) (data + 0x1be); - this_size = hd->part[minor].nr_sects; - /* * Usually, the first entry is the real data partition, * the 2nd entry is the next extended partition, or empty, @@ -196,6 +193,7 @@ goto done; /* nothing left to do */ this_sector = first_sector + START_SECT(p) * sector_size; + this_size = NR_SECTS(p) * sector_size; minor = *current_minor; put_dev_sector(sect); } @@ -586,12 +584,13 @@ } #endif if (is_extended_partition(p)) { + unsigned long size = hd->part[minor].nr_sects; printk(" <"); /* prevent someone doing mkfs or mkswap on an extended partition, but leave room for LILO */ - if (hd->part[minor].nr_sects > 2) + if (size > 2) hd->part[minor].nr_sects = 2; - extended_partition(hd, bdev, minor, ¤t_minor); + extended_partition(hd, bdev, minor, size, ¤t_minor); printk(" >"); } } ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Re: Lost Partition 2001-10-11 13:19 ` [PATCH] " Alexander Viro @ 2001-10-11 13:25 ` Stefan Smietanowski 2001-10-11 13:28 ` Alexander Viro 2001-10-11 13:54 ` Vincent Sweeney 2001-10-11 19:33 ` Jeff V. Merkey 2 siblings, 1 reply; 10+ messages in thread From: Stefan Smietanowski @ 2001-10-11 13:25 UTC (permalink / raw) To: viro; +Cc: v.sweeney, linux-kernel Hi. Re partition problem. > - unsigned long first_sector, first_size, this_sector, this_size; > + unsigned long first_sector, this_sector, this_size; > + this_size = first_size; It seems that's sorta wrong, no? You just removed "first_size" and then you access it :) // Stefan ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Re: [PATCH] Re: Lost Partition 2001-10-11 13:25 ` Stefan Smietanowski @ 2001-10-11 13:28 ` Alexander Viro 2001-10-11 13:37 ` Stefan Smietanowski 0 siblings, 1 reply; 10+ messages in thread From: Alexander Viro @ 2001-10-11 13:28 UTC (permalink / raw) To: Stefan Smietanowski; +Cc: v.sweeney, linux-kernel On Thu, 11 Oct 2001, [iso-8859-1] Stefan Smietanowski wrote: > Hi. Re partition problem. > > > > - unsigned long first_sector, first_size, this_sector, this_size; > > + unsigned long first_sector, this_sector, this_size; > > > + this_size = first_size; > > > It seems that's sorta wrong, no? > > You just removed "first_size" and then you access it :) Look carefully at the arguments list. first_size had just become explicitly passed to extended_partition(). ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Re: [PATCH] Re: Lost Partition 2001-10-11 13:28 ` Alexander Viro @ 2001-10-11 13:37 ` Stefan Smietanowski 0 siblings, 0 replies; 10+ messages in thread From: Stefan Smietanowski @ 2001-10-11 13:37 UTC (permalink / raw) To: viro; +Cc: v.sweeney, linux-kernel Hi. >> Hi. Re partition problem. >> >> >> > - unsigned long first_sector, first_size, this_sector, this_size; >> > + unsigned long first_sector, this_sector, this_size; >> >> > + this_size = first_size; >> >> >> It seems that's sorta wrong, no? >> >> You just removed "first_size" and then you access it :) > > Look carefully at the arguments list. first_size had just become > explicitly passed to extended_partition(). Yeah I see that now. Sorry, didn't look closely enough. // Stefan ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Re: Lost Partition 2001-10-11 13:19 ` [PATCH] " Alexander Viro 2001-10-11 13:25 ` Stefan Smietanowski @ 2001-10-11 13:54 ` Vincent Sweeney 2001-10-11 13:58 ` Alexander Viro 2001-10-11 19:33 ` Jeff V. Merkey 2 siblings, 1 reply; 10+ messages in thread From: Vincent Sweeney @ 2001-10-11 13:54 UTC (permalink / raw) To: Alexander Viro; +Cc: linux-kernel No luck I'm afraid. The patch applied successfully bit I still get exactly the same problem. Vince. Alexander Viro wrote: > > On Thu, 11 Oct 2001, Vincent Sweeney wrote: > > > I have just upgrade my kernel to 2.4.12 and in the process I've lost a > > partition on my secondary IDE drive. Since this is my /usr partition > > it's kind of important ;) > > Please, see if the following fixes the problem. > > --- S11/fs/partitions/msdos.c Tue Oct 9 21:47:27 2001 > +++ /tmp/msdos.c Thu Oct 11 09:18:22 2001 > @@ -103,21 +103,20 @@ > */ > > static void extended_partition(struct gendisk *hd, struct block_device *bdev, > - int minor, int *current_minor) > + int minor, unsigned long first_size, int *current_minor) > { > struct partition *p; > Sector sect; > unsigned char *data; > - unsigned long first_sector, first_size, this_sector, this_size; > + unsigned long first_sector, this_sector, this_size; > int mask = (1 << hd->minor_shift) - 1; > int sector_size = get_hardsect_size(to_kdev_t(bdev->bd_dev)) / 512; > int loopct = 0; /* number of links followed > without finding a data partition */ > int i; > > - first_sector = hd->part[minor].start_sect; > - first_size = hd->part[minor].nr_sects; > - this_sector = first_sector; > + this_sector = first_sector = hd->part[minor].start_sect; > + this_size = first_size; > > while (1) { > if (++loopct > 100) > @@ -133,8 +132,6 @@ > > p = (struct partition *) (data + 0x1be); > > - this_size = hd->part[minor].nr_sects; > - > /* > * Usually, the first entry is the real data partition, > * the 2nd entry is the next extended partition, or empty, > @@ -196,6 +193,7 @@ > goto done; /* nothing left to do */ > > this_sector = first_sector + START_SECT(p) * sector_size; > + this_size = NR_SECTS(p) * sector_size; > minor = *current_minor; > put_dev_sector(sect); > } > @@ -586,12 +584,13 @@ > } > #endif > if (is_extended_partition(p)) { > + unsigned long size = hd->part[minor].nr_sects; > printk(" <"); > /* prevent someone doing mkfs or mkswap on an > extended partition, but leave room for LILO */ > - if (hd->part[minor].nr_sects > 2) > + if (size > 2) > hd->part[minor].nr_sects = 2; > - extended_partition(hd, bdev, minor, ¤t_minor); > + extended_partition(hd, bdev, minor, size, ¤t_minor); > printk(" >"); > } > } ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Re: Lost Partition 2001-10-11 13:54 ` Vincent Sweeney @ 2001-10-11 13:58 ` Alexander Viro 2001-10-11 14:02 ` Vincent Sweeney 0 siblings, 1 reply; 10+ messages in thread From: Alexander Viro @ 2001-10-11 13:58 UTC (permalink / raw) To: Vincent Sweeney; +Cc: linux-kernel On Thu, 11 Oct 2001, Vincent Sweeney wrote: > No luck I'm afraid. The patch applied successfully bit I still get > exactly the same problem. Please, do the following: dd if=/dev/hdb of=p0 bs=512 count=1 dd if=/dev/hdb of=p1 bs=512 count=1 skip=1076355 and mail the contents of p0 and p1. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Re: Lost Partition 2001-10-11 13:58 ` Alexander Viro @ 2001-10-11 14:02 ` Vincent Sweeney 0 siblings, 0 replies; 10+ messages in thread From: Vincent Sweeney @ 2001-10-11 14:02 UTC (permalink / raw) To: Alexander Viro; +Cc: linux-kernel [-- Attachment #1: Type: text/plain, Size: 365 bytes --] Alexander Viro wrote: > > On Thu, 11 Oct 2001, Vincent Sweeney wrote: > > > No luck I'm afraid. The patch applied successfully bit I still get > > exactly the same problem. > > Please, do the following: > > dd if=/dev/hdb of=p0 bs=512 count=1 > dd if=/dev/hdb of=p1 bs=512 count=1 skip=1076355 > > and mail the contents of p0 and p1. Files p0 and p1 attached. [-- Attachment #2: p0 --] [-- Type: application/octet-stream, Size: 512 bytes --] [-- Attachment #3: p1 --] [-- Type: application/octet-stream, Size: 512 bytes --] nú Edición), y las imágenes son reemplazadas por iconos. Sirve para quitar los iconos de sustitución y ver las imágenes reales de la página. <LI><B>Imprimir</B> <BR>Sirve para imprimir el contenido de la página que está en pantalla. Se abre un cuadro de diálogo en el que pueden elegirse las características de la impresión. <LI><B>Seguridad</B> <BR>Sirve para ver la página <B>Información sobre seguridad</B>, en la qu ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Re: Lost Partition 2001-10-11 13:19 ` [PATCH] " Alexander Viro 2001-10-11 13:25 ` Stefan Smietanowski 2001-10-11 13:54 ` Vincent Sweeney @ 2001-10-11 19:33 ` Jeff V. Merkey 2 siblings, 0 replies; 10+ messages in thread From: Jeff V. Merkey @ 2001-10-11 19:33 UTC (permalink / raw) To: Alexander Viro; +Cc: Vincent Sweeney, linux-kernel Al, Please check the NWFS code posted at vger.timpanogas.org, specifically, nwconfig.c (top area of file). One thing NetWare did that I thought was rather clever was to stamp a copy of the boot sector into the second sector of every new partition in the event someone ever wrote to the boot sector and trashed someone's partition table. I do not know if Linux has something like this, but it was sure a lifesaver when errant NLMs stepped all over the hard drive and trashed the boot sector, causing all the partition info to get wiped. Each partition header was time stamped so someone could just scan the first two sectors of every partition (after locating the fist one via brute force) and determine which copy was most recent. I realize this may not have been the problem here, but it would sure make it easier for EXT3, REISER, etc. to recover trashed partition tables a lot easier than custom patches if Linux could pick a sector on one of these volumes, and make it a bogus file or something by default and stamp a copy of the boot sector into every partition that gets created along with a time stamp of some sort so you know which one is most recent. Then fsck would be able to recover hosed partition tables very quickly. :-) Jeff On Thu, Oct 11, 2001 at 09:19:58AM -0400, Alexander Viro wrote: > > > On Thu, 11 Oct 2001, Vincent Sweeney wrote: > > > I have just upgrade my kernel to 2.4.12 and in the process I've lost a > > partition on my secondary IDE drive. Since this is my /usr partition > > it's kind of important ;) > > Please, see if the following fixes the problem. > > --- S11/fs/partitions/msdos.c Tue Oct 9 21:47:27 2001 > +++ /tmp/msdos.c Thu Oct 11 09:18:22 2001 > @@ -103,21 +103,20 @@ > */ > > static void extended_partition(struct gendisk *hd, struct block_device *bdev, > - int minor, int *current_minor) > + int minor, unsigned long first_size, int *current_minor) > { > struct partition *p; > Sector sect; > unsigned char *data; > - unsigned long first_sector, first_size, this_sector, this_size; > + unsigned long first_sector, this_sector, this_size; > int mask = (1 << hd->minor_shift) - 1; > int sector_size = get_hardsect_size(to_kdev_t(bdev->bd_dev)) / 512; > int loopct = 0; /* number of links followed > without finding a data partition */ > int i; > > - first_sector = hd->part[minor].start_sect; > - first_size = hd->part[minor].nr_sects; > - this_sector = first_sector; > + this_sector = first_sector = hd->part[minor].start_sect; > + this_size = first_size; > > while (1) { > if (++loopct > 100) > @@ -133,8 +132,6 @@ > > p = (struct partition *) (data + 0x1be); > > - this_size = hd->part[minor].nr_sects; > - > /* > * Usually, the first entry is the real data partition, > * the 2nd entry is the next extended partition, or empty, > @@ -196,6 +193,7 @@ > goto done; /* nothing left to do */ > > this_sector = first_sector + START_SECT(p) * sector_size; > + this_size = NR_SECTS(p) * sector_size; > minor = *current_minor; > put_dev_sector(sect); > } > @@ -586,12 +584,13 @@ > } > #endif > if (is_extended_partition(p)) { > + unsigned long size = hd->part[minor].nr_sects; > printk(" <"); > /* prevent someone doing mkfs or mkswap on an > extended partition, but leave room for LILO */ > - if (hd->part[minor].nr_sects > 2) > + if (size > 2) > hd->part[minor].nr_sects = 2; > - extended_partition(hd, bdev, minor, ¤t_minor); > + extended_partition(hd, bdev, minor, size, ¤t_minor); > printk(" >"); > } > } > > - > 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/ ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2001-10-11 18:29 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2001-10-11 12:14 Lost Partition Vincent Sweeney 2001-10-11 13:01 ` Alexander Viro 2001-10-11 13:19 ` [PATCH] " Alexander Viro 2001-10-11 13:25 ` Stefan Smietanowski 2001-10-11 13:28 ` Alexander Viro 2001-10-11 13:37 ` Stefan Smietanowski 2001-10-11 13:54 ` Vincent Sweeney 2001-10-11 13:58 ` Alexander Viro 2001-10-11 14:02 ` Vincent Sweeney 2001-10-11 19:33 ` Jeff V. Merkey
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox