D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] grub error 25

 

The story so far. I had a system running Debian Lenny with two 120GB
disks. One of the disks, /dev/sdb, had four partitions: 
  1. an old Ubuntu distro
  2. /boot, which includes grub
  3. swap
  4. everything else
and one day I got 'grub error 25' and the disk could not boot. I realise
now that I had some warning; for a couple of weeks the ethernet
connection had been unreliable and I thought this was something to do
with the router or the driver eth0 but it may have been an early
warning. 

Following lots of advice I disconnected /dev/sdb, installed Ubuntu
10.10 (because I happened to have it) and used it to get and burn
Debian Squeeze to a CD. I got a minimal system working using evolution
as a mailer. I then plugged /dev/sdb in again and ran fdisk. This
returned

  Disk /dev/sdb: 120.0 GB, 120034123776 bytes
  255 heads, 63 sectors/track, 14593 cylinders
  Units = cylinders of 16065 * 512 = 8225280 bytes
  Sector size (logical/physical): 512 bytes / 512 bytes
  I/O size (minimum/optimal): 512 bytes / 512 bytes
  Disk identifier: 0x77587758

   Device Boot      Start        End      Blocks   Id  System
  /dev/sdb1   *        1        3000    24097468+  83  Linux
  /dev/sdb2         3001        3122      979965   83  Linux
  /dev/sdb3         3123        3244      979965   82  Linux/swap  
  /dev/sdb4         3245       14593    91160842+  83  Linux

but fdisk on /dev/sdb1,2 etc returned nothing. So the partition table
seemed to be ok. I used Gparted to make space on a 250GB external
drive and did
  dd if=/dev/sdb of=/dev/sdc6/sdb.img bs=512
so I had a whole disk image. Mat suggested that I try kpartx on this.
The guide is 
   http://tinyapps.org/docs/mount_partitions_from_disk_images.html
which explains kpartx and other things too. So I tried
  kpartx -lv /dev/sdc6/sdb.img
and got
  loop0p1 : 0 48194937 /dev/loop0 63
  loop0p2 : 0 1959930 /dev/loop0 48195000
  loop0p3 : 0 1959930 /dev/loop0 50154930
  loop0p4 : 0 182321685 /dev/loop0 52114860

OK so far. The next thing is 
  kpartx -a -v /dev/sdc6/sdb.img
which gave
  add map loop0p1 (254:0): 0 48194937 linear /dev/loop0 63
  add map loop0p2 (254:1): 0 1959930 linear /dev/loop0 48195000
  add map loop0p3 (254:2): 0 1959930 linear /dev/loop0 50154930
  add map loop0p4 (0:0): 0 182321685 linear /dev/loop0 52114860

which doesn't look quite right. The numbers like (254:0) are like major
and minor device numbers and there is something wrong with partition 4. 

To mount the parition you do 
   mount -reiserfs /dev/mapper/loop0p4 /mnt/sdb4 -o ro
which returned "device /dev/mapper/loop0p4 does not exist" so it
looked as if I could go no further along this route.

Further down the site there is a section "Use a partition image" which
sugests that you can use dd to create an image of a single partition
instead of the whole disk. So I did this
  dd if=/dev/sdb4 of=/dev/sdc5/sdb4.img bs=512
and created an image of partition 4 on the external drive. I could then 
use reiserfsck to investigate the partition and to my surprise this
returned the comment that there are no errors in it. Indeed
  mount -t reiserfs -o loop /dev/sdc5/sdb4.img  /mnt
mounted it and revealed all the files as I hoped to find them. 

RESULT!! and thanks to everyone who helped. I can now mine the
partition and copy files to the new Debian system, which is of course
an ext3 fs. 

Tony



-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq