baruch / gpart

Collating patches for gpart from all distributions
GNU General Public License v2.0
28 stars 17 forks source link

gpart runs for 36 hours at this time scanning a 6 TB HDD connected via USB - is this normal? #19

Open scragnoth opened 7 months ago

scragnoth commented 7 months ago

I discovered gpart while using gparted, via the option "attempt data rescue". After I unfortunately dropped my 6 TB HDD by Toshiba (it wasn't running at that time) from around 1 m height, it acted a bit weird. It was recognized as usual, but it always experienced HDD activity, even when I didn't do anything (browsing into new folders or accessing files). It worked like this three times, when I wanted to come back to it for a fourth time since the drop it wasn't recognized anymore. It now shows as "unallocated", it had an NTFS partition, spanning it's whole size. It had between 2 and 3 of the 6 TB used.

The aforementioned "attempt data rescue" option in gparted gave up right away (it said something like "no filesystem could be recognized") so I tried gpart itself via the console. I did type "sudo gpart /dev/sdb", that runs for 36 hours now. The HDD still shows activity, so I assume that gpart is still scanning the drive. I use a normal, older USB 1.0 / 2.0 A to B cable instead of a newer USB 3.0 one which would have extra contacts on the B plug.

ThinkPad-X230-Tablet-LM:~$ sudo gpart /dev/sdb [sudo] password for :

Begin scan... Possible partition(Windows NT/W2K FS), size(1528861mb), offset(1mb)

That's what appeared right away when it started 36 hours ago and nothing else appeared since.

It would be nice if gpart could restore the filesystem, I assume that I can get all the files back by using photorec but I would loose the folder structure and the filenames ...

ssieb commented 7 months ago

Since you're using USB 2, you still have some time to wait. See some estimated speeds and times at: https://superuser.com/questions/9229/how-long-would-it-take-to-transfer-1tb-over-usb-2-0 That detected partition is much too small, but if it hasn't found anything else at this point, then it's not going to. It should have been found right away and there's nothing else to find. You could try creating a partition starting at 1MB and using the entire drive. Just make sure it only defines the partition and doesn't actually format it. Use something like fdisk.

scragnoth commented 7 months ago

Thanks for the fast reply and the link. I thought it would take a long time but I didn't think that it would take that long, but math never was my strong-suit, especially conversions between bits and bytes and so on. I'll keep it running, assuming one TB would take approx. 12 hours, it should be done tomorrow afternoon, when it would have ran for 72 hours. I looked for another USB 3.0 cable but I couldn't find any.

If I let gpart do it's thing after it finished, can I destroy something (since you said the recognized partition is way too small)? Or should I go for the fdisk route right away? One year ago, I installed Arch Linux on another machine, so I'm a bit familiar with the fdisk commands. I read inside the ArchLinux installation giude again, but I'm not sure what I would have to do then. What I should not do is to create a new partition table, right? Just a new partition then. Would it have to be a primary MBR partition?

ssieb commented 7 months ago

Nothing will get destroyed until you try to mount the partition or write to it. You need to delete any existing partitions if they aren't correct and create a new one. If it was MBR, then it would be a primary, but a disk that size has to be GPT. And if it's GPT, then maybe there's a valid backup partition at the end of the disk.

scragnoth commented 7 months ago

I came home a while ago and it was still ticking. I wanted to copy the recognized size in MB from the terminal and forgot to hit the shift key in addition to the ctrl and c keys, so I interrupted the scan by accident. I still found out that only around 1,5 TB were recognized. I will do another scan with gpart with an appropriate USB 3.0 cable.

I read around a bit, but I couldn't find a definitive answer what to do. I launched Gparted again, it said in order to create a new partition, I have to create a new partition table since there's none present. That's what I shouldn't do since it would delete my data as far as I understand. I also put my output of:

sudo fdisk -l /dev/sdb

[sudo] password for :
Disk /dev/sdb: 5,46 TiB, 6001175126016 bytes, 1465130646 sectors Disk model: DS maxi light 30 Units: sectors of 1 * 4096 = 4096 bytes Sector size (logical/physical): 4096 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0x00000000

Device Boot Start End Sectors Size Id Type /dev/sdb1 1 4294967295 4294967295 16T ee GPT

The "Disks" utility tells me that the partitioning of the HDD is "Unknown (PMBR)"

scragnoth commented 7 months ago

I have found a USB 3.0 cable, the scan was finished in only one minute. Here's the output:

sudo gpart /dev/sdb [sudo] password for :

Begin scan... Possible partition(Windows NT/W2K FS), size(1528861mb), offset(1mb) End scan.

Checking partitions...

* Warning: partition(OS/2 HPFS, NTFS, QNX or Advanced UNIX) starts beyond disk end. Partition(OS/2 HPFS, NTFS, QNX or Advanced UNIX): invalid primary Ok.

Guessed primary partition table: Primary partition(1) 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

Primary partition(2) 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

Primary partition(3) 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

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

It doesn't look too good, all of them have a size of 0 mb?

I started another try with

sudo gpart -f /dev/sdb

I read that the -f option does a deeper scan.

scragnoth commented 6 months ago

I'll give a final update here. I'll use testdisk to recover the data from my drive, the results are much more plausible (I was able to browse the folder structure I was still familiar with, but I didn't write anything (the partition table to recover the NTFS partition) to the disk yet, I want do back everything up beforehand in case something goes wrong).

I won't call gpart useless, it should have it's purpose in some circumstances. But in my case, testdisk seems to be the better choice.

I'll order some new HDDs to get the necessary storage space to do the backup first before I give restoring the partition itself a try.

ssieb commented 6 months ago

Well, it can only work if you haven't mangled the filesystem headers. It's not a general data recovery tool like testdisk. It's merely for recovering the partition table if that's the only thing that got corrupted or altered. If you make a full backup of the disk, then you can experiment on the original.