[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[resuelto] Re: he reescrtito el inicio del disco duro



El Fri, 15 Feb 2008 20:43:52 -0800
consul tores <consultores1@gmail.com> escribió:

> Yo no he logrado entender la situacion; si la imagen a escribir con dd
> es mayor de 512 bytes, dd te daria error o no escribe nada, al querer
> escribir en el MBR; si usas Lilo, bastaria con leer el manual y
> escribir la copia que guarda Lilo; has revisado con fdisk el MBR
> actual? el sector boot, lo recuperas con fdisk o sfdisk; la tabla con
> Testdisk.
> 
> En fin, espero que de algo te sirva esta informacion.
> 
> 
Buenas,
primero disculpas por no contestar antes, estaba "ocupado" con el ordenador, segundo gracias a todos los que habeis contestado.
Hago un resumen, me baje una imagen del instalador de Debian para instalar desde un llavero usb, aproximadamente de 16MB,
en lugar de escribirlo al llavero dd if=usb.img of=/dev/sda , estando como root (primer y principal gran fallo) , lo escribi en mi disco duro /dev/hda (en mi descargo diré que había dormido poco ). Resultado : machaqué la tabla de particiones del disco duro, el sector de arranque y todo lo que hubiera en el los primeros 16 MB del hda, por ejemplo mi partición con el directorio /boot . EL ordenador seguía funcionando pero estaba claro que en el momento que lo apagara, ya no iba a volver a reiniciarse correctamente. 
fdisk y sfdisk me sacaban la tabla de particiones implantada (la imagen lleva sus propias particiones) : que se compone de 4 particiones. No me sirven para esto
cfdisk , ni siquiera se inicia, dice que hay un error en el disco y que presione una tecla y vuelve a bash.
gpart adivina las particiones originales , y me presenta también las nuevas, no es mal comienzo.

Begin scan...
Possible partition(Solaris/x86 disklabel), size(15610mb), offset(31mb)
Possible partition(Solaris/x86 disklabel), size(15610mb), offset(15657mb)
Possible extended partition at offset(31274mb)
   Possible partition(Linux ext2), size(14645mb), offset(31275mb)
   Possible partition(Linux ext2), size(3906mb), offset(45920mb)
   Possible partition(Linux ext2), size(9766mb), offset(49826mb)
   Possible partition(Linux ext2), size(972mb), offset(59592mb)
   Possible partition(Linux ext2), size(2925mb), offset(60565mb)
   Possible partition(Linux ext2), size(19532mb), offset(63491mb)
   Possible partition(Linux ext2), size(9766mb), offset(83023mb)
End scan.

Checking partitions...
Partition(Linux swap or Solaris/x86): primary 
Partition(Linux swap or Solaris/x86): primary 
   Partition(Linux ext2 filesystem): logical 
   Partition(Linux ext2 filesystem): orphaned logical 
   Partition(Linux ext2 filesystem): orphaned logical 
   Partition(Linux ext2 filesystem): orphaned logical 
   Partition(Linux ext2 filesystem): orphaned logical 
   Partition(Linux ext2 filesystem): orphaned logical 
   Partition(Linux ext2 filesystem): orphaned logical 
Ok.

Guessed primary partition table:
Primary partition(1)
   type: 130(0x82)(Linux swap or Solaris/x86)
   size: 15610mb #s(31969350) s(64260-32033609)
   chs:  (4/0/1)-(1023/254/63)d (4/0/1)-(1993/254/63)r

Primary partition(2)
   type: 130(0x82)(Linux swap or Solaris/x86)
   size: 15610mb #s(31969350) s(32065677-64035026)
   chs:  (1023/254/63)-(1023/254/63)d (1995/254/1)-(3985/253/63)r

Primary partition(3)
   type: 015(0x0F)(Extended DOS, LBA)
   size: 76159mb #s(155975085) s(64051155-220026239)
   chs:  (1023/254/63)-(1023/254/63)d (3987/0/1)-(13695/254/63)r

Primary partition(4)
   type: 000(0x00)(unused)
   size: 0mb #s(0) s(0-0)
   chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r

Y por fin testdisk, que tambien ve todo, pero ademas es más comodo y facil de usar, 



Fri Feb 15 14:23:08 2008
Command line: TestDisk

TestDisk 6.5, Data Recovery Utility, October 2006
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org
Linux version (ext2fs lib: 1.40-WIP, ntfs lib: avaible, reiserfs lib: none)
Using locale 'es_ES.UTF-8'.
Hard disk list
Disk /dev/hda - 160 GB / 149 GiB - CHS 19457 255 63, sector size=512

Disk /dev/hda - 160 GB / 149 GiB
Partition table type: Intel

Interface Advanced
Geometry from i386 MBR: head=206 sector=44
BAD_RS LBA=3020518592 3059909
check_part_i386 1 type E4: no test
BAD_RS LBA=1006562073 16226700
check_part_i386 2 type 98: no test
BAD_RS LBA=1696625775 4057182
check_part_i386 3 type 7D: no test
 2 * Sys=98               62655 150 49 186400 224  7 1987968046
 3 * Sys=7D               105610  17 55 225118 182 57 1919906418
 1 * SpeedStor FAT16 ext  188018 149 36 188050  31 27     506638

Analyse Disk /dev/hda - 160 GB / 149 GiB - CHS 19457 255 63
Geometry from i386 MBR: head=206 sector=44
BAD_RS LBA=3020518592 3059909
check_part_i386 1 type E4: no test
BAD_RS LBA=1006562073 16226700
check_part_i386 2 type 98: no test
BAD_RS LBA=1696625775 4057182
check_part_i386 3 type 7D: no test
Current partition structure:
 1 * SpeedStor FAT16 ext  188018 149 36 188050  31 27     506638

Warning: Bad starting sector (CHS and LBA don't match)
 2 * Sys=98               62655 150 49 186400 224  7 1987968046

Bad relative sector.
 3 * Sys=7D               105610  17 55 225118 182 57 1919906418

Bad relative sector.
Only one partition must be bootable
Space conflict between the following two partitions
 2 * Sys=98               62655 150 49 186400 224  7 1987968046
 3 * Sys=7D               105610  17 55 225118 182 57 1919906418
Space conflict between the following two partitions
 3 * Sys=7D               105610  17 55 225118 182 57 1919906418
 1 * SpeedStor FAT16 ext  188018 149 36 188050  31 27     506638

search_part()
Disk /dev/hda - 160 GB / 149 GiB - CHS 19457 255 63

recover_EXT2: s_block_group_nr=0/3, s_mnt_count=1/30, s_blocks_per_group=8192
recover_EXT2: boot_sector=0, s_blocksize=1024
recover_EXT2: s_blocks_count 32098
recover_EXT2: part_size 64196
   D Linux                    0   1  1     3 254 62      64196 [/boot]
     EXT2 Sparse superblock, 32 MB / 31 MiB

SUN Marker at 4/0/1
 0 P SunOS root              73   0  1   743 254 63   10779615
 1 P SunOS swap               7   0  1    72 254 63    1060290
 2 P Whole disk               4   0  1  1993 254 63   31969350
 7 P SunOS home             744   0  1  1993 254 63   20081250
 8 P Boot                     4   0  1     4 254 63      16065
 9 P SunOS alt.               5   0  1     6 254 63      32130

recover_sun
   D Solaris                  4   0  1  1993 254 63   31969350
   D Linux Swap            1996   0  1  2119 254 43    1992040
     SWAP2 version 1, 1019 MB / 972 MiB

recover_EXT2: s_block_group_nr=0/114, s_mnt_count=11/30, s_blocks_per_group=32768
recover_EXT2: boot_sector=0, s_blocksize=4096
recover_EXT2: s_blocks_count 3749161
recover_EXT2: part_size 29993288
   D Linux                 2120   1  1  3986 254 59   29993288 [/home]
     EXT3 Sparse superblock Recover, 15 GB / 14 GiB

recover_EXT2: s_block_group_nr=0/114, s_mnt_count=21/35, s_blocks_per_group=32768
recover_EXT2: boot_sector=0, s_blocksize=4096
recover_EXT2: s_blocks_count 3749161
recover_EXT2: part_size 29993288
   D Linux                 3987   1  1  5853 254 59   29993288 [/usr/local]
     EXT3 Sparse superblock Recover, 15 GB / 14 GiB

recover_EXT2: s_block_group_nr=0/30, s_mnt_count=20/25, s_blocks_per_group=32768
recover_EXT2: boot_sector=0, s_blocksize=4096
recover_EXT2: s_blocks_count 1000038
recover_EXT2: part_size 8000304
   D Linux                 5854   1  1  6351 254 60    8000304
     EXT3 Large file Sparse superblock Recover, 4096 MB / 3906 MiB

recover_EXT2: s_block_group_nr=0/76, s_mnt_count=27/36, s_blocks_per_group=32768
recover_EXT2: boot_sector=0, s_blocksize=4096
recover_EXT2: s_blocks_count 2500107
recover_EXT2: part_size 20000856
   D Linux                 6352   1  1  7596 254 57   20000856
     EXT3 Large file Sparse superblock Recover, 10240 MB / 9766 MiB

recover_EXT2: s_block_group_nr=0/121, s_mnt_count=20/30, s_blocks_per_group=8192
recover_EXT2: boot_sector=0, s_blocksize=1024
recover_EXT2: s_blocks_count 995998
recover_EXT2: part_size 1991996
   D Linux                 7597   1  1  7720 254 62    1991996 [/opt]
     EXT3 Sparse superblock Recover, 1019 MB / 972 MiB

recover_EXT2: s_block_group_nr=0/22, s_mnt_count=16/22, s_blocks_per_group=32768
recover_EXT2: boot_sector=0, s_blocksize=4096
recover_EXT2: s_blocks_count 749022
recover_EXT2: part_size 5992176
   D Linux                 7721   1  1  8093 254 57    5992176
     EXT3 Large file Sparse superblock Recover, 3067 MB / 2925 MiB

recover_EXT2: s_block_group_nr=0/152, s_mnt_count=1/21, s_blocks_per_group=32768
recover_EXT2: boot_sector=0, s_blocksize=4096
recover_EXT2: s_blocks_count 5000223
recover_EXT2: part_size 40001784
   D Linux                 8094   1  1 10583 254 60   40001784 [extra]
     EXT3 Sparse superblock Recover, 20 GB / 19 GiB

recover_EXT2: s_block_group_nr=0/76, s_mnt_count=12/20, s_blocks_per_group=32768
recover_EXT2: boot_sector=0, s_blocksize=4096
recover_EXT2: s_blocks_count 2500107
recover_EXT2: part_size 20000856
   D Linux                10584   1  1 11828 254 57   20000856
     EXT3 Large file Sparse superblock, 10240 MB / 9766 MiB
get_geometry_from_list_part_aux head=255 nbr=22
get_geometry_from_list_part_aux head=8 nbr=5
get_geometry_from_list_part_aux head=16 nbr=2
get_geometry_from_list_part_aux head=32 nbr=1
get_geometry_from_list_part_aux head=64 nbr=1
get_geometry_from_list_part_aux head=128 nbr=1
get_geometry_from_list_part_aux head=240 nbr=2
get_geometry_from_list_part_aux head=255 nbr=22

Results
   * Linux                    0   1  1     3 254 63      64197 [/boot]
     EXT2 Sparse superblock, 32 MB / 31 MiB
   P Solaris                  4   0  1  1993 254 63   31969350
   P Linux Swap            1996   0  1  2119 254 63    1992060
     SWAP2 version 1, 1019 MB / 972 MiB
   L Linux                 2120   1  1  3986 254 63   29993292 [/home]
     EXT3 Sparse superblock Recover, 15 GB / 14 GiB
   L Linux                 3987   1  1  5853 254 63   29993292 [/usr/local]
     EXT3 Sparse superblock Recover, 15 GB / 14 GiB
   L Linux                 5854   1  1  6351 254 63    8000307
     EXT3 Large file Sparse superblock Recover, 4096 MB / 3906 MiB
   L Linux                 6352   1  1  7596 254 63   20000862
     EXT3 Large file Sparse superblock Recover, 10240 MB / 9766 MiB
   L Linux                 7597   1  1  7720 254 63    1991997 [/opt]
     EXT3 Sparse superblock Recover, 1019 MB / 972 MiB
   L Linux                 7721   1  1  8093 254 63    5992182
     EXT3 Large file Sparse superblock Recover, 3067 MB / 2925 MiB
   L Linux                 8094   1  1 10583 254 63   40001787 [extra]
     EXT3 Sparse superblock Recover, 20 GB / 19 GiB
   L Linux                10584   1  1 11828 254 63   20000862
     EXT3 Large file Sparse superblock, 10240 MB / 9766 MiB

interface_write()
 1 * Linux                    0   1  1     3 254 63      64197 [/boot]
 2 P Solaris                  4   0  1  1993 254 63   31969350
 3 P Linux Swap            1996   0  1  2119 254 63    1992060
 4 E extended LBA          2120   0  1 19456 254 63  278518905
 5 L Linux                 2120   1  1  3986 254 63   29993292 [/home]
 6 L Linux                 3987   1  1  5853 254 63   29993292 [/usr/local]
 7 L Linux                 5854   1  1  6351 254 63    8000307
 8 L Linux                 6352   1  1  7596 254 63   20000862
 9 L Linux                 7597   1  1  7720 254 63    1991997 [/opt]
10 L Linux                 7721   1  1  8093 254 63    5992182
11 L Linux                 8094   1  1 10583 254 63   40001787 [extra]
12 L Linux                10584   1  1 11828 254 63   20000862
simulate write!

write_mbr_i386: starting...
write_all_log_i386: starting...
write_all_log_i386: CHS: 2120/0/1,lba=34057800
write_all_log_i386: CHS: 3987/0/1,lba=64051155
write_all_log_i386: CHS: 5854/0/1,lba=94044510
write_all_log_i386: CHS: 6352/0/1,lba=102044880
write_all_log_i386: CHS: 7597/0/1,lba=122045805
write_all_log_i386: CHS: 7721/0/1,lba=124037865
write_all_log_i386: CHS: 8094/0/1,lba=130030110
write_all_log_i386: CHS: 10584/0/1,lba=170031960

TestDisk exited normally.

Una pequeña maravilla, que me ha evitado, tener que reinstalar.

Bueno, después de reescribir la tabla, he tenido que desmontar /dev/hda1 , que era la partición más afectada, aparecía como vacía, formatearla de nuevo, montarla, reinstalar los kernel, en aptitude figuraban como instalador pero en /boot no había  nada, reinstalar el grub y reiniciar. El primer arranque ha cascado, había reinstalado mal el grub, pero con el rescue de Debian, lo he solucionado y ahora os escribo desde el ordenador, como si no hubiera pasado nad.

Bueno , perdon por el rollo, y de nuevo gracias a todos los que habeis dado sugerencias, ya sabeis niños con root no se juega y menos cuando no se ha dormido mucho.


Reply to: