Recover DD-d partition info

2»

Comments

  • hunandoz
    hunandoz Posts: 17  Freshman Member
    First Comment
    After executing "w"; I have received the following;
    I still do not know if the id 83 / linux partition is OK or not... Is there a way to check it?
    What will happen if I do partprobe  kpartx as mentioned below?

    The partition table has been altered!
    Calling ioctl() to re-read partition table.
    WARNING: Re-reading the partition table failed with error 16: Device or resource                         busy.

    The kernel still uses the old table. The new table will be used at
    the next reboot or after you run partprobe(8) or kpartx(8)
    Syncing disks.
    root@NAS:~# fdisk -l

    Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
    255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x6d403b49

       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1              63     1028159      514048+  83  Linux
    /dev/sda2         1028160  3907029167  1953000504   83  Linux

    Disk /dev/md0: 1999.9 GB, 1999868854784 bytes
    2 heads, 4 sectors/track, 488249232 cylinders, total 3905993857 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    Disk /dev/md0 doesn't contain a valid partition table

  • hunandoz
    hunandoz Posts: 17  Freshman Member
    First Comment
    Dear Mijzelf,
    Just reading through fdisk; shall I set sda1 to bootable? 
    I am a beginner, so sorry for asking so many times...
  • Mijzelf
    Mijzelf Posts: 2,761  Guru Member
    250 Answers 2500 Comments Friend Collector Seventh Anniversary
    edited February 2020
    Many questions, but you're doing fine. The generated partition table looks OK to me. for comparison, this is the partition table of my old, trusty 325:

    Disk /dev/sda: 80.0 GB, 80026361856 bytes
    255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Disk identifier: 0x604f18f3

       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1              63     1028159      514048+   8  AIX
    /dev/sda2         1028160   156296384    77634112+  20  Unknown

    As you can see the first partition is identical, and the second starts on the same sector. Further the last sector of the 2nd partition is the last sector of the disk on your system, while mine has 3 sectors left. Probably because it wanted a multiple of 4096 bytes, or something like that. I suppose you did the math, about the endsector.

    The partition type is ignored, so you don't need to bother about that. The bootable flag is only used by BIOS driven PC's, and so is also ignored here.

    How many blocks did you overwrite by dd? Has sector 63 been spared?
  • hunandoz
    hunandoz Posts: 17  Freshman Member
    First Comment
    Ok, thank you for the help.
    Actually I do not know; as far as I remember on the screen was "512 bytes written" or something.  
    Opinion about executing "partprobe" or "kpartx"?
    Or keep system live till I will be able to backup to an ext. drive, and only after do a trial?

  • Mijzelf
    Mijzelf Posts: 2,761  Guru Member
    250 Answers 2500 Comments Friend Collector Seventh Anniversary
    When you only have written 512 bytes the disk should be recovered now.
    Opinion about executing "partprobe" or "kpartx"?
    I don't think either of them are available on the box. Nor does it help. They inform the kernel about partition on the disk, while you now want to 'inform' the disk about partitions in memory, by writing a partition table.
    A tool which could do so is TestDisk, which can scan a disk for apparent partitions, and write a partition table. In your case that can help to save the data, but the generated partition table will not be compatible with the firmware, because TestDisk will find the inner part of the raid array.
    Or keep system live till I will be able to backup to an ext. drive, and only after do a trial?
    That's your decision. I think your partition table is fine now. If it isn't, the data is still not lost (as long as you don't re-initialize the disk) but it will be a bit harder to copy it than it is now, of course.

  • hunandoz
    hunandoz Posts: 17  Freshman Member
    First Comment
    Thank you! Right now I am doing the copy of the important backup data. It will take some time. but afterwards I will do the reboot. "I will be back" ; at least with the results!
  • hunandoz
    hunandoz Posts: 17  Freshman Member
    First Comment
    I was not succeded. Volume is down. :-(
  • Mijzelf
    Mijzelf Posts: 2,761  Guru Member
    250 Answers 2500 Comments Friend Collector Seventh Anniversary
    That's a pity. Do you still have shell access? You should be able to login using the telnet backdoor.

    What is the output of

    cat /proc/partitions
    cat /proc/mounts
    cat /proc/mdstat
    fdisk -l /dev/sda

Consumer Product Help Center