[parted-devel] parted crashing on partially recovered disk
Peter Lorenzen
peter at lorenzen.us
Fri Nov 26 17:13:24 UTC 2010
A quick solution to particular problem is this patch
diff -Naur parted-2.3*/libparted/fs/hfs/probe.c
--- parted-2.3/libparted/fs/hfs/probe.c 2010-02-08 01:48:18.000000000 -0500
+++ parted-2.3-modified/libparted/fs/hfs/probe.c 2010-11-26
11:40:27.000000000 -0500
@@ -157,6 +157,7 @@
search = ((PedSector) PED_BE32_TO_CPU (vh->total_blocks) - 1)
* ( PED_BE32_TO_CPU (vh->block_size) / PED_SECTOR_SIZE_DEFAULT )
- 1;
+ if (search == -1) return NULL;
if (!ped_geometry_set (geom_ret, geom_ret->start,
search + 2)
|| !ped_geometry_read (geom_ret, buf, search, 1)
On Fri, Nov 26, 2010 at 10:54 AM, Peter Lorenzen <peter at lorenzen.us> wrote:
> Hi
>
> I had a disk-crash (a 320Gb disk) and managed to get the first half
> of the disk copied to a new disk (500Gb)
> and are now trying to rebuild the rest.
>
> My problem is that parted crashes. This happens with stock ubuntu-10.4
> and parted-2.3 build from source.
>
> # sudo sfdisk -l /dev/sdb
>
> Disk /dev/sdb: 60801 cylinders, 255 heads, 63 sectors/track
> Warning: extended partition does not start at a cylinder boundary.
> DOS and Linux will interpret the contents differently.
> Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
>
> Device Boot Start End #cyls #blocks Id System
> /dev/sdb1 * 0+ 12- 13- 102400 7 HPFS/NTFS
> /dev/sdb2 12+ 4863- 4851- 38965248 7 HPFS/NTFS
> /dev/sdb3 0 - 0 0 0 Empty
> /dev/sdb4 4863+ 29981 25119- 201761743 5 Extended
> /dev/sdb5 4863+ 7413- 2550- 20480000 83 Linux
> /dev/sdb6 7414+ 7873 460- 3694918+ 82 Linux swap / Solaris
> /dev/sdb7 7874+ 14401- 6528- 52428800 af HFS / HFS+
>
> # sudo parted-2.3/parted/parted -l /dev/sdb
> Model: ATA WDC WD20EARS-00S (scsi)
> Disk /dev/sda: 2000GB
> Sector size (logical/physical): 512B/512B
> Partition Table: msdos
>
> Number Start End Size Type File system Flags
> 1 32.3kB 20.0GB 20.0GB primary ext3 boot
> 2 20.0GB 25.0GB 5009MB primary linux-swap(v1)
> 3 25.0GB 1979GB 1954GB primary ext3
> 4 1979GB 2000GB 21.0GB primary ext3
>
>
> Backtrace has 18 calls on stack:
> 18: /home/peter/src/parted-2.3/libparted/.libs/libparted.so.0(ped_assert+0x2a)
> [0x64beda]
> 17: /home/peter/src/parted-2.3/libparted/.libs/libparted.so.0(ped_geometry_read+0x116)
> [0x655c56]
> 16: /home/peter/src/parted-2.3/libparted/.libs/libparted.so.0(hfsplus_probe+0x3a1)
> [0x67bf51]
> 15: /home/peter/src/parted-2.3/libparted/.libs/libparted.so.0(ped_file_system_probe_specific+0x6c)
> [0x64da3c]
> 14: /home/peter/src/parted-2.3/libparted/.libs/libparted.so.0(ped_file_system_probe+0x81)
> [0x64e031]
> 13: /home/peter/src/parted-2.3/libparted/.libs/libparted.so.0(+0x4750f)
> [0x68650f]
> 12: /home/peter/src/parted-2.3/libparted/.libs/libparted.so.0(+0x47631)
> [0x686631]
> 11: /home/peter/src/parted-2.3/libparted/.libs/libparted.so.0(+0x47631)
> [0x686631]
> 10: /home/peter/src/parted-2.3/libparted/.libs/libparted.so.0(+0x47571)
> [0x686571]
> 9: /home/peter/src/parted-2.3/libparted/.libs/libparted.so.0(+0x4773f)
> [0x68673f]
> 8: /home/peter/src/parted-2.3/libparted/.libs/libparted.so.0(ped_disk_new+0x75)
> [0x654e45]
> 7: /home/peter/src/parted-2.3/parted/.libs/lt-parted() [0x804e408]
> 6: /home/peter/src/parted-2.3/parted/.libs/lt-parted() [0x804f593]
> 5: /home/peter/src/parted-2.3/parted/.libs/lt-parted() [0x80518aa]
> 4: /home/peter/src/parted-2.3/parted/.libs/lt-parted() [0x8052f21]
> 3: /home/peter/src/parted-2.3/parted/.libs/lt-parted(main+0x2e) [0x805302e]
> 2: /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0x126bd6]
> 1: /home/peter/src/parted-2.3/parted/.libs/lt-parted() [0x804c451]
> Aborted
>
> Using ddd I can see that this is caused by
>
>
> ped_geometry_read (const PedGeometry* geom, void* buffer, PedSector offset,
> PedSector count)
> {
> PedSector real_start;
>
> PED_ASSERT (geom != NULL, return 0);
> PED_ASSERT (buffer != NULL, return 0);
> -> PED_ASSERT (offset >= 0, return 0);
> PED_ASSERT (count >= 0, return 0);
>
>
> It would have been nice if parted would inform of bogus paritition
> instead of just crashing.
> eventually a comment like "remove the bogus partition using fdisk" and
> try again could have been helpfull
> Best Regrads
>
> Peter Lorenzen
>
More information about the parted-devel
mailing list