-
gpart utility: Can't access USB Hard Drive
I have an external hard drive that plugs into my USB port. Knoppix assigns the device /dev/uba1 to it. When I try to scan the drive using the command "gpart /dev/uba1", I receive the message "*** Fatal error: ioctl(HDIO_GETGEO) failed: Inappropriate ioctl for device."
I accidentally deleted the primary NTFS partition on this drive and I'm trying to re-create it. Can gpart help me with this? What do I need to do?
-
Administrator
Site Admin-
Re: gpart utility: Can't access USB Hard Drive

Originally Posted by
ktas
.... Knoppix assigns the device /dev/uba1 to it. When I try to scan the drive using the command "gpart /dev/uba1", I receive the message "*** Fatal error.....
I havn't used gpart much and never on a usb device, but shouldn't you be scanning uba, the hard drive, and not uba1, the partition that does not exist?
-
Well, I'm new to this, but perhaps you're right. If that's all it is, I'll be embarassed, but appreciative! I'll try that.
-
Senior Member
registered user

Originally Posted by
ktas
Well, I'm new to this, but perhaps you're right. If that's all it is, I'll be embarassed, but appreciative! I'll try that.

Yup. You want the device where the partition table is stored, i.e. /dev/uba. According to the man page, yes, gpart should be able to recover the partition table even if the filesystem is NTFS. I'm curious to know how you deleted the partition and how well gpart worked to recover it. So, please let us know how it goes.
As safety net, you may want to image the entire device before you let gpart work on it. You can image the device with dd. How big is the USB device? Do you have enough space on another device to store the image?
Regards,
- Robert
http://www.cwelug.org
-
Well, I did try using "/dev/uba" and received the same error msg. The error seems to be saying that the routine HDIO_GETGEO that the program is using is not valid for USB. The device is a 200 GB Maxtor external drive. But, at this point, I can't even perform a sucessful scan of the drive.
-
Senior Member
registered user

Originally Posted by
ktas
Well, I did try using "/dev/uba" and received the same error msg. The error seems to be saying that the routine HDIO_GETGEO that the program is using is not valid for USB. The device is a 200 GB Maxtor external drive. But, at this point, I can't even perform a sucessful scan of the drive.
What is a "successful scan"? Are you able to read the first 512 bytes of the drive with dd? For example:
Code:
dd if=/dev/uba of=/tmp/mbr.img bs=512 count=1
BTW, if you know the NTFS partition took up the entire drive you can simply "repartition" with fdisk. Again, you may want to make an image of the drive first.
Regards,
- Robert
http://www.cwelug.org
-

Originally Posted by
rwcitek
What is a "successful scan"? Are you able to read the first 512 bytes of the drive with dd? For example:
Code:
dd if=/dev/uba of=/tmp/mbr.img bs=512 count=1
BTW, if you know the NTFS partition took up the entire drive you can simply "repartition" with fdisk. Again, you may want to make an image of the drive first.
Regards,
- Robert
http://www.cwelug.org
No, I was referring to the "gpart" utility which refuses even to scan the drive. I know there was only a single NTFS partition. Repartitioning with fdisk won't lose data?
-
Senior Member
registered user

Originally Posted by
ktas
No, I was referring to the "gpart" utility which refuses even to scan the drive. I know there was only a single NTFS partition. Repartitioning with fdisk won't lose data?
Uh, you've got a backup image, right? In that case, no, you won't lose any data. Partitioning, especially when there's only one partition involved, only modifies the first 512 bytes of data. Destroying the partition table is kind of like ripping out the table of contents from a book. The chapters are still there, you just don't know how many there are or where they are or how big they are. But if you know there was only one partition and it took the entire drive and it was NTFS, then you can recreate the partition table.
However, if you do not create a backup image first, yes, whatever you do will immediately destroy all hopes of getting any meaningful data off the drive. That rule is called "Murphy's Law" and it holds true whenever there's really important data involved. 
Regards,
- Robert
http://www.cwelug.org
-

Originally Posted by
rwcitek

Originally Posted by
ktas
No, I was referring to the "gpart" utility which refuses even to scan the drive. I know there was only a single NTFS partition. Repartitioning with fdisk won't lose data?
Uh, you've got a backup image, right? In that case, no, you won't lose any data. Partitioning, especially when there's only one partition involved, only modifies the first 512 bytes of data. Destroying the partition table is kind of like ripping out the table of contents from a book. The chapters are still there, you just don't know how many there are or where they are or how big they are. But if you know there was only one partition and it took the entire drive and it was NTFS, then you can recreate the partition table.
However, if you do not create a backup image first, yes, whatever you do will immediately destroy all hopes of getting any meaningful data off the drive. That rule is called "Murphy's Law" and it holds true whenever there's really important data involved.
Regards,
- Robert
http://www.cwelug.org
Okay. Thanks so much for the help.
-
You can also see if testdisk sees the partition, but like rwcitek said, the easiest way is to just fdisk a new partition AFTER taking a backup image of the disk.
Similar Threads
-
By dealrocker in forum Laptops
Replies: 2
Last Post: 08-13-2010, 02:06 PM
-
By PMFAN in forum General Support
Replies: 1
Last Post: 05-10-2009, 12:45 AM
-
By martynball in forum Hardware & Booting
Replies: 1
Last Post: 12-22-2008, 04:36 PM
-
By rafaelorta in forum Hardware & Booting
Replies: 3
Last Post: 09-06-2005, 06:33 PM
-
By Colonel Sanders in forum Hardware & Booting
Replies: 2
Last Post: 08-21-2003, 04:47 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules

Gigabyte 4U AI Server 10x Nvidia GPU 2x Xeon Gold 6150 36 Core 2.7GHz DDR4 RAM
$1499.00

Dell EMC PowerEdge R440 Xeon silver 4215 2.5GHz 16 GB ram 2x 550W PSU No HDD
$275.00

867959-B21 HPE ProLiant DL360 G10 CTO Server W/ 2x 865414-B21 1x 840140-001
$245.00

Dell PowerEdge R530 2x E5-2630v4 H330 iDRAC8 Port Card Riser No PSU/RAM/HDD
$99.99

Dell PowerEdge C4130 1U AI GPU Server | 2x E5-2690 v3 | 64gb Ram | 2x 1600W
$524.99

Dell PowerEdge C4130 1U AI GPU Server | 2x E5-2680 v3 | 32gb Ram | 2x 1600W
$409.99

Dell PowerEdge C4130 1U AI GPU Server | 2x E6-2699 v3 | 128gb RAM | 2x 1600W
$899.99

Dell Poweredge R730xd 12LFF 2*2660v4 4*1Gbe h730 2x 750W Server CTO
$308.00

Dell PowerEdge FX2s + 8x FC430 Blades 16x E5-2630v4 160 Cores Rails No PSU/RAM
$699.00

RDS CAL - Remote Desktop Services Windows Server 2019 50 User/Device Connections
$63.00