Recover DD-d partition info
hunandoz
Posts: 17 Freshman Member
Dear all,
I have unfortunately deleted my sda partition info with (dd if=/dev/zero of=/dev/sda) when I wanted to repair my SD Card partion table in sdb. :-(
Right now system is up and running, but if I lose power, perform restart -->everything will be gone. I do not have backup possibilty of the total NAS content.
If possible I would like to recover the partitions without removing the HDD from the system. Also if possible I do not want to install debian/ubuntu onto a PC.
Thank you for your help in advance!
I have unfortunately deleted my sda partition info with (dd if=/dev/zero of=/dev/sda) when I wanted to repair my SD Card partion table in sdb. :-(
Right now system is up and running, but if I lose power, perform restart -->everything will be gone. I do not have backup possibilty of the total NAS content.
If possible I would like to recover the partitions without removing the HDD from the system. Also if possible I do not want to install debian/ubuntu onto a PC.
Thank you for your help in advance!
lsblk:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 140M 1 loop /ram_bin
sda 8:0 0 1.8T 0 disk:
|-sda1 8:1 0 502M 0 part /zyxel/mnt/sysdisk
`-sda2 8:2 0 1.8T 0 part
`-md0 9:0 0 1.8T 0 linear /i-data/1877af91
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: 0x00000000
Disk /dev/sda doesn't contain a valid partition table
#NAS_Feb_2020
#NAS_Feb_2020
0
Comments
-
Dear All,
if mdstat states md0 has active device sda2 - am I ok?
cat /proc/mdstatPersonalities : [linear] [raid0] [raid1]md0 : active linear sda2[0]1952996928 blocks super 1.2 0k roundingmdadm --examine /dev/sda1mdadm: No md superblock detected on /dev/sda1.mdadm --examine /dev/sda2/dev/sda2:Magic : a92b4efcVersion : 1.2Feature Map : 0x0Array UUID : 1877af91:c4d12aaf:62318110:85a049b4Name : NAS:0 (local to host NAS)Creation Time : Sun Mar 24 23:38:55 2019Raid Level : linearRaid Devices : 1Avail Dev Size : 1952996928 (1862.52 GiB 1999.87 GB)Used Dev Size : 0Data Offset : 2048 sectorsSuper Offset : 8 sectorsState : cleanDevice UUID : 2a4ec1ab:c15d1211:dbf7ffc6:10f1e4d3Update Time : Sun Mar 24 23:38:55 2019Checksum : e2dc1423 - correctEvents : 0Rounding : 0KDevice Role : Active device 0Array State : A ('A' == active, '.' == missing)0 -
You'll have to recreate the partition table manually. You can find the start sector and size of the partitions withcat /sys/block/sda/sda1/startcat /sys/block/sda/sda2/startcat /sys/block/sda/sda1/sizecat /sys/block/sda/sda2/size
1 -
Mijzelf,
Thank you for the starting step; Now I know the start/size for both partition.
cat /sys/block/sda/sda1/start63cat /sys/block/sda/sda1/size1028097cat /sys/block/sda/sda2/start1028160cat /sys/block/sda/sda2/size3905995905
Can ou help me with fdisk as well?
I am afraid as the NAS sees the volume (sda2) as JBOD [as far as I understand it], so I do not want crush it.0 -
I have just checked one more thing; /dev/md0 is as well existing in fdisk.
fdisk -lDisk /dev/sda: 2000.4 GB, 2000398934016 bytes255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/sda doesn't contain a valid partition tableDisk /dev/md0: 1999.9 GB, 1999868854784 bytes2 heads, 4 sectors/track, 488249232 cylinders, total 3905993857 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/md0 doesn't contain a valid partition table0 -
Mijzelf,
As far as I have checked;
fdisk /dev/sda (am I need sudo?)
select "n" as new partition
select "p" as primary (? - it will "name" it as sda1?)
enter "63"
enter "1028097"
repeat with sda2 data
n, p, 1028160, 3905995905.
How to connect it to md0? (Sorry for my poor linux knowledge)
Thank you for your patience, and understanding,0 -
I have just checked one more thing; /dev/md0 is as well existing in fdisk.fdisk runs on any block device, and even on files. But as you can see, md0 doesn't contain a valid partition table, so it's pretty meaningless here.As far as I have checked;
fdisk /dev/sda (am I need sudo?)By default there is no sudo on the box. If you logged in using the same credentials as you used to dd the partition table away, you don't need it.(? - it will "name" it as sda1?)Yes.How to connect it to md0?You don't need to. The partition table is not more then a database which contains the location and size of the partitions. You didn't change anything in the partition itself, so if you recover the table, the partitions will be as they always were. sda2 contains a header which tells it's a part of md0.
1 -
Mijzelf,
Thank you for the given instruction.
But I was unable to create 1st partition, as the possible value range is 2048 - 3907029167.
I have stopped / quit from fdisk.0 -
Mijzelf,
One more question. I am able to create the sda2, the id is 83 - "linux" is it OK?0 -
Mijzelf,
Sorry to asking many questions.
The end sector shall be 1028160 + 3905995905 = 3907029167
Am I right?0 -
I have googled, and switched on "dos compatibility flag" with issue "c". Many thanks!!!
Shall I do anything else?0
Categories
- All Categories
- 415 Beta Program
- 2.3K Nebula
- 142 Nebula Ideas
- 94 Nebula Status and Incidents
- 5.6K Security
- 230 USG FLEX H Series
- 267 Security Ideas
- 1.4K Switch
- 71 Switch Ideas
- 1K Wireless
- 39 Wireless Ideas
- 6.3K Consumer Product
- 246 Service & License
- 385 News and Release
- 82 Security Advisories
- 28 Education Center
- 9 [Campaign] Zyxel Network Detective
- 3.2K FAQ
- 34 Documents
- 34 Nebula Monthly Express
- 83 About Community
- 71 Security Highlight