Solved Trouble accessing external NTFS partition

Hi to all,

I am new to the BSD, and I have trouble trying to access data on an externally mounted hard drive with Windows 10 partition on it. I am using an external drive bay connected via USB to my desktop. When I switch drive on I get the following output from dmesg:
Bash:
umass0 on uhub4
umass0: <MSC Bulk-Only Transfer> on usbus1
umass0:  SCSI over Bulk-Only; quirks = 0x4000
umass0:4:0: Attached to scbus4
da0 at umass-sim0 bus 0 scbus4 target 0 lun 0
da0: <ST500DM0 02-1BD142 > Fixed Direct Access SCSI-2 device
da0: Serial Number 8300C9880000
da0: 40.000MB/s transfers
da0: 476940MB (122096646 4096 byte sectors)
da0: quirks=0xa<NO_6_BYTE,4K>
GEOM_PART: integrity check failed (da0, MBR)
GEOM_PART: integrity check failed (diskid/DISK-8300C9880000, MBR)

If I try to mount disk i get the following:
Bash:
$ sudo mount -t ntfs-3g /dev/da0 /mnt
mount: /dev/da0: Operation not supported by device

If I run '$ gpart show' the drive is not even listed, and if I '$ gpart list' on the device i get the following:
Bash:
$ gpart list da0
gpart: Class 'PART' does not have an instance named 'da0'.

If I '$ ls -l /dev/da0' i get:
Bash:
gpart: Class 'PART' does not have an instance named 'da0'.

I tried 'dd if=/dev/zero of=/dev/da0 bs=512 count=1', also but I get the following:
Bash:
dd: /dev/da0: Invalid argument
1+0 records in
0+0 records out
0 bytes transferred in 0.000101 secs (0 bytes/sec)

Output of the 'diskinfo -v /dev/da0' is:
Bash:
/dev/da0
    4096            # sectorsize
    500107862016    # mediasize in bytes (466G)
    122096646       # mediasize in sectors
    4096            # stripesize
    0               # stripeoffset
    7600            # Cylinders according to firmware.
    255             # Heads according to firmware.
    63              # Sectors according to firmware.
    ST500DM0 02-1BD142    # Disk descr.
    8300C9880000    # Disk ident.
    No              # TRIM/UNMAP support
    Unknown         # Rotation rate in RPM
    Not_Zoned       # Zone Mode

I guess the problem is that I am trying to mount the drive using an external bay, but that is the only option I have because all of my internal bays are full (SFF chassis). Any way to work around this?
 
GEOM_PART: integrity check failed (da0, MBR)ß
GEOM_PART: integrity check failed (diskid/DISK-8300C9880000, MBR)
As they say in German: Klappe zu, Affe tot, Zirkus aus (literally it means box lid closed, monkey dead, circus close; idiomatically it means this ended quickly). This disk has no valid partition table. It might have an invalid partition table, or it might have IO errors. I would look at dmesg (or /var/log/messages) to find IO errors.

If I try to mount disk i get the following: ... mount: /dev/da0: Operation not supported by device
That tells me that there is no file system on the whole device /dev/da0. And as we saw above, the device has no partition table or an invalid one, so we won't find a file system on partitions either, for lack of partitions.

I tried 'dd if=/dev/zero of=/dev/da0 bs=512 count=1', ... dd: /dev/da0: Invalid argument
That tells that the disk is at the minimum not writeable, perhaps has more serious IO errors. By the way: after doing this command, you no longer have a partition table!

Output of the 'diskinfo -v /dev/da0' is: ...
ST500DM0 02-1BD142 # Disk descr.
8300C9880000 # Disk ident.
This is good. It means that some communication with the disk works. Does the model and serial number match what is on the label of the disk? If no, then we have a bizarre problem. Let's assume it does.

I would look for IO errors first. In theory, connecting a disk via a USB adapter should work, but it may expose you to more opportunities for mistakes (such as flaky power supplies causing IO errors, disks being inadvertently write protected, and so on). I would debug reading the disk with "dd if=/dev/da0 of=/dev/null ..." and see what you get.
 
Thank you all for the quick responses.

That tells that the disk is at the minimum not writeable, perhaps has more serious IO errors. By the way: after doing this command, you no longer have a partition table!

Yes, I know. That was exactly what I was trying to do because I wanted to see if anything will change after that. Data on the disc are of no importance because it has a bare Windows 10 system installed, which I don't need. I need the disc to migrate data from my Linux desktop to the BSD desktop. In the meanwhile, I attached the disc to my Linux workstation and I was able to read the partition table, so I used cfdisk to delete the existing one and to create a new one with Win FAT32 on it, and the same problem under BSD persists. So I went for the diskinfo -v /dev/da0 again and checked for the serial number, as you suggested. And yes, the serial numbers from the disk label and from the diskinfo(8) do not match!

dd /dev/da0 /dev/null gives me the following error message:
Bash:
dd: unknown operand /dev/da0

Output from /var/log/messages regarding da0 does not differ from the output of dmesg command:
Code:
May 11 11:38:44 GreatOtterDesk kernel: umass0 on uhub0
May 11 11:38:44 GreatOtterDesk kernel: umass0: <MSC Bulk-Only Transfer> on usbus0
May 11 11:38:44 GreatOtterDesk kernel: umass0:  SCSI over Bulk-Only; quirks = 0x4000
May 11 11:38:44 GreatOtterDesk kernel: umass0:4:0: Attached to scbus4
May 11 11:38:44 GreatOtterDesk kernel: da0 at umass-sim0 bus 0 scbus4 target 0 lun 0
May 11 11:38:44 GreatOtterDesk kernel: da0: <ST500DM0 02-1BD142 > Fixed Direct Access SCSI-2 device
May 11 11:38:44 GreatOtterDesk kernel: da0: Serial Number 8300C9880000
May 11 11:38:44 GreatOtterDesk kernel: da0: 40.000MB/s transfers
May 11 11:38:44 GreatOtterDesk kernel: da0: 476940MB (122096646 4096 byte sectors)
May 11 11:38:44 GreatOtterDesk kernel: da0: quirks=0xa<NO_6_BYTE,4K>
May 11 11:38:44 GreatOtterDesk kernel: GEOM_PART: integrity check failed (da0, MBR)
May 11 11:38:44 GreatOtterDesk kernel: GEOM_PART: integrity check failed (diskid/DISK-8300C9880000, MBR)

Since I can read and write to disc from my Linux workstation, I am wondering if I should load some additional kernel module for the BSD?
 
If I understand well, you are trying to wipe the disk by writing zeros on it, right?
Then what you want is # dd if=/dev/zero of=/dev/da0 bs=1M status=progress
(bs=1M for speeding up the process and status=progress to get some information)

# dd if=/dev/da0 of=/dev/null would mean copying what's on da0 to nowhere, which doesn't make much sense, I think :)
 
would mean copying what's on da0 to nowhere, which doesn't make much sense, I think
Yes, you're essentially copying the disk to nowhere (commonly known as the bitbucket). It's a good test to see if the disk doesn't have read or I/O errors.
 
Disk not attached anymore?

? ??

It is one of those days when you try to do everything in a hurry, and all of it just goes wrong. It seems that disk really was not attached, but when attached I get the following:
Code:
dd: /dev/da0: Invalid argument
0+0 records in
0+0 records out
0 bytes transferred in 0.000115 secs (0 bytes/sec)
 
It is one of those days when you try to do everything in a hurry, and all of it just goes wrong.
Story of my life ;)

Maybe there's something finicky with the USB drive enclosure. Some of the controllers on the cheaper ones can be really bad. It's possible Linux may have some quirks for it, which might be why it works there but not on FreeBSD.
 
Maybe there's something finicky with the USB drive enclosure. Some of the controllers on the cheaper ones can be really bad. It's possible Linux may have some quirks for it, which might be why it works there but not on FreeBSD.

My guess too. It is a cheaper one.

So now the problem goes down to: "does anybody have a reliable external hard drive case that is compatible with BSD to recommend"?
 
What does smartctl say?
And I use Revoltec. Works good.
Depending on where you are and what connector that disk has you might borrow one ;)
 
What does smartctl say?

It says:
Bash:
smartctl 7.2 2020-12-30 r5155 [FreeBSD 12.2-RELEASE amd64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 7200.14 (AF)
Device Model:     ST500DM002-1BD142
Serial Number:    Z3TPCMZN
LU WWN Device Id: 5 000c50 06484064a
Firmware Version: HP73
User Capacity:    500,107,862,016 bytes [500 GB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA8-ACS T13/1699-D revision 4
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 1.5 Gb/s)
Local Time is:    Tue May 11 18:30:35 2021 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x82)    Offline data collection activity
                    was completed without error.
                    Auto Offline Data Collection: Enabled.
Self-test execution status:      (   0)    The previous self-test routine completed
                    without error or no self-test has ever 
                    been run.
Total time to complete Offline 
data collection:         (  600) seconds.
Offline data collection
capabilities:              (0x5b) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Suspend Offline collection upon new
                    command.
                    Offline surface scan supported.
                    Self-test supported.
                    No Conveyance Self-test supported.
                    Selective Self-test supported.
SMART capabilities:            (0x0003)    Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01)    Error logging supported.
                    General Purpose Logging supported.
Short self-test routine 
recommended polling time:      (   2) minutes.
Extended self-test routine
recommended polling time:      (  79) minutes.
SCT capabilities:            (0x103b)    SCT Status supported.
                    SCT Error Recovery Control supported.
                    SCT Feature Control supported.
                    SCT Data Table supported.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   111   099   006    Pre-fail  Always       -       33459544
  3 Spin_Up_Time            0x0023   100   100   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       354
  5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002f   087   060   030    Pre-fail  Always       -       583250389
  9 Power_On_Hours          0x0032   043   043   000    Old_age   Always       -       50774
 10 Spin_Retry_Count        0x0033   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       354
180 Unknown_HDD_Attribute   0x002b   100   100   000    Pre-fail  Always       -       3417303709
183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -       0
184 End-to-End_Error        0x0033   100   100   097    Pre-fail  Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   099   000    Old_age   Always       -       4 4 4
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   063   057   045    Old_age   Always       -       37 (Min/Max 24/37)
194 Temperature_Celsius     0x0022   037   043   000    Old_age   Always       -       37 (0 18 0 0 0)
195 Hardware_ECC_Recovered  0x003a   045   033   000    Old_age   Always       -       33459544
196 Reallocated_Event_Count 0x0032   100   100   036    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Interrupted (host reset)      90%         0         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

Depending on where you are and what connector that disk has you might borrow one
Thanks for the tip! I don't know, if you live in Belgrade, Serbia maybe I could ;)
 
So it is a 4k disk. That might be a problem with mbr.
But you quoted a german proverb, so... well, I am in the NE of Berlin. Thats a bit too far.
 
So it is a 4k disk. That might be a problem with mbr.
In theory, it shouldn't. This is a 512e disk, meaning it emulates 512-byte blocks, by internally using read-modify-write on 4K blocks. So if tools like gpart try to write partition tables on it one 512 byte sector at a time, it should work. And 4K and 512e disks have been around for a long time (~10 years or so); I have a 512e disk on my system (coincidentally connected via USB) and it hasn't created any trouble.

This is an odd problem. We know that communication with the disk basically works: the kernel can read the ID of the disk, and smartctl can read and write information over the interface to the controller of the disk. But doing actual IO (reading and writing the platter) doesn't seem to work. But it works under Linux. Strange.

As to "disks that work on USB under FreeBSD": I've been quite happy with inexpensive Seagate external drives. Right now I have a ST2000LM007 plugged in; that's a 2.5" disk (intended for backup workloads) with a USB-3 cable. Doesn't require a power supply. In the US, those are pretty cheap, when you find them on sale at Costco (a big hypermarket chain). This model is probably 3 or 4 years old.
 
But you quoted a german proverb, so... well, I am in the NE of Berlin. Thats a bit too far.
Really? Where? Well, it is nothing strange because we generally use a lot of German words in everyday life. And unfortunately, you are too far :(

try dd with bs=4k or bs=4096
dd if=/dev/da0 of=/dev/null bs=4096

This is working! Here is the output:
Bash:
10+0 records in
10+0 records out
40960 bytes transferred in 0.015683 secs (2611765 bytes/sec)

Iset count to 10 just to promptly get the result :). So we have a progress here! What should I do next?
 
I would suggest making an image if the disc contains stuff you want to salvage.
Then get a good USB enclosure.
 
Thank you all for the help. Meanwhile, I purchased a new hdd docking station. Not the cheapest one, but still not the high-end one. Unfortunately, I still have no success in mounting it under FreeBSD, but now I can dd /dev/da0s1 bs=512 from the drive. I also get a curious message when I `file -s /dev/da0`:
Bash:
/dev/da0: DOS/MBR boot sector MS-MBR Windows 7 english at offset 0x163 "Invalid partition table" at offset 0x17b "Error loading operating system" at offset 0x19a "Missing operating system", disk signature 0x4d1c6ff7; partition 1 : ID=0xb, active, start-CHS (0x0,1,1), end-CHS (0x3ff,254,63), startsector 63, 976773105 sectors
???

It looks to me like traces of previous Windows 10 install. Like that previous partition table was not deleted thoroughly. I will try to wipe out the drive with the dd and try to make a new partition and fat32 file system from BSD because it seems that it will work now, but I am still curious about this message?
 
Back
Top