DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
Old 15th August 2011
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

You are correct, you would use # disklabel -E sd0 to start the disklabel editor.

Thank you, by the way, for reviewing the man page.

  1. Use the "a" command to add a new partition.
  2. Select a partition letter. You may use anything from a-p except for c, since that is the physical drive.
  3. Since you have told us that this is a FAT filesystem, even though it is an NTFS partition, use "msdos" as the partition type.
  4. The starting sector number is 63.
  5. The editor should show the remaining sectors of the drive as the default, press the ENTER key to accept the default. You can also use an asterisk, *, to specify the remaining sectors of the drive. If you need to, you can type out the number of sectors manually, which if my math is correct, is 3907023940.
  6. Use the "w" command to write the revised disklabel to the drive.
  7. You may then use the "q" command to quit.
You may then attempt to mount the partition.
Reply With Quote
Old 15th August 2011
sepuku's Avatar
sepuku sepuku is offline
Real Name: Vizard Sepuku
Package Pilot
 
Join Date: Jun 2011
Location: Athens & Chania,Greece
Posts: 143
Default

If someone should be thanked,is you for your patience and help you are offering.I hope my knowledge someday will reach a point so i can help people like you do right now.


i'm trying the disklabel -E sd0 but the 4 and 5 in your list are not shown when running the command.

I'm asked for the partion name,the offset,the size(which in my case is 488378646),the FS type which is msdos and then i won't see anything relative with sectors.I type w,enter,q,enter and i see

no label changes but i see partition i on my disklabel sd0 yet when attempt to mount i get mount_msdos: /dev/sd0i on /usr/usb/externaldrives: Inappropriate file type or format
Reply With Quote
Old 15th August 2011
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Please post the output of # disklabel sd0 -- it does not appear to me that you were able to create the appropriate disklabel partition.

Since I cannot look over your shoulder, I would ask you to use script(1), then run the disklabel editor once again -- then, once you exit the script shell, please post the contents of the "typescript" log. I would like to see exactly what prompts you see as you edit the disklabel.
Reply With Quote
Old 15th August 2011
sepuku's Avatar
sepuku sepuku is offline
Real Name: Vizard Sepuku
Package Pilot
 
Join Date: Jun 2011
Location: Athens & Chania,Greece
Posts: 143
Default

Code:
# disklabel sd0
# /dev/rsd0c:
type: SCSI
disk: SCSI disk
label: 001-9VT156      
duid: 153749179caf22d2
flags:
bytes/sector: 4096
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 30400
total sectors: 488378646
boundstart: 0
boundend: 488378646
drivedata: 0 

16 partitions:
#                size           offset  fstype [fsize bsize  cpg]
  c:        488378646                0  unused                   
  i:        488378646                0   MSDOS
Reply With Quote
Old 15th August 2011
sepuku's Avatar
sepuku sepuku is offline
Real Name: Vizard Sepuku
Package Pilot
 
Join Date: Jun 2011
Location: Athens & Chania,Greece
Posts: 143
Default

I deleted the i partition the created once again the same way.This is the typescript:

Code:
Script started on Mon Aug 15 17:28:46 2011
# ms^H ^H^H ^Hdisklabel -sd0^H ^H^H ^H^H ^HE sd0^M^M
Label editor (enter '?' for help at any prompt)^M
> d^M
partition to delete: [] i^M
> a^M
partition: [a] i^M
offset: [0] ^M
size: [488378646] ^M
FS type: [4.2BSD] msdos^M
> w^M
> q^M
No label changes.^M
#
I hope that's what you asked 'cause i'm using this tool for the first time.

and my disklabel sd0 is the same as before.
Reply With Quote
Old 15th August 2011
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Ah. Your offset should be 63.
Reply With Quote
Old 15th August 2011
sepuku's Avatar
sepuku sepuku is offline
Real Name: Vizard Sepuku
Package Pilot
 
Join Date: Jun 2011
Location: Athens & Chania,Greece
Posts: 143
Default

No better luck with offset 63.It won't mount.

Code:
$ sudo mount -t msdos /dev/sd0i /usr/usb/externaldrives/ 
mount_msdos: /dev/sd0i on /usr/usb/externaldrives: Inappropriate file type or format
Reply With Quote
Old 15th August 2011
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

  • Double check your disklabel, and ensure that that the "i" partition now starts at sector 63.

  • Ensure that mount point /usr/usb/externaldrives exists.

  • While you can't seem to get a simple tool like dd(1) working for you, for unexplained reasons.... if you ever did, I would love to see the output of the first sector of the NTFS partition -- the 64th sector of the drive:

# dd if=/dev/rsd0c skip=63 count=1 | hexdump -C

I believe that this was originally an NTFS partition, formatted under Windows (or perhaps shipped with that partition from the factory). You then reformatted it as a FAT partition from a non-Windows platform, such as Linux or BSD. This explains why when you attach it to a Windows machine, it is considered unreadable -- there is a mismatch between the MBR partition type and the filesystem. To enable this partition for use on a Windows platform, you would need to edit the MBR partition table and change the partition type to a valid FAT32 type such as 0x0c. You can use fdisk(8) to do this, if you are careful.
Reply With Quote
Old 15th August 2011
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Just because results have been odd, you might inspect your /dev directory. Perhaps you are missing rsd* and sd* device nodes.
Reply With Quote
Old 15th August 2011
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

It is possible that the enclosure is faulty or non-compliant, I've seen a few that for some reason do not work on OpenBSD, producing similar I/O errors.
Reply With Quote
Old 15th August 2011
sepuku's Avatar
sepuku sepuku is offline
Real Name: Vizard Sepuku
Package Pilot
 
Join Date: Jun 2011
Location: Athens & Chania,Greece
Posts: 143
Default

Quote:
Originally Posted by jggimi View Post
  • Double check your disklabel, and ensure that that the "i" partition now starts at sector 63.

I checked it ; offset is 63.

Quote:
Originally Posted by jggimi View Post
Ensure that mount point /usr/usb/externaldrives exists.
It exists.

Quote:
Originally Posted by jggimi View Post
* While you can't seem to get a simple tool like dd(1) working for you, for unexplained reasons.... if you ever did, I would love to see the output of the first sector of the NTFS partition -- the 64th sector of the drive:


# dd if=/dev/rsd0c skip=63 count=1 | hexdump -C
Well this command returns:

Code:
# dd if=/dev/rsd0c skip=63 count=1 | hexdump -C 
dd: /dev/rsd0c: Invalid argument
0+0 records in
0+0 records out
0 bytes transferred in 0.000 secs (0 bytes/sec)
And i also opened an xconsole before running it and no kernel messages appeared.


Quote:
Originally Posted by jggimi View Post
I believe that this was originally an NTFS partition, formatted under Windows (or perhaps shipped with that partition from the factory). You then reformatted it as a FAT partition from a non-Windows platform, such as Linux or BSD.
That is true; if i can remember well i reformatted it under Ubuntu Linux.


Quote:
Originally Posted by jggimi View Post
To enable this partition for use on a Windows platform, you would need to edit the MBR partition table and change the partition type to a valid FAT32 type such as 0x0c. You can use fdisk(8) to do this, if you are careful.
So the type i should change it to is '0x0c' ? Well i think i will try it since i consider the data already lost after so many failed attempts.I have nothing to lose...except for the data. :P

Last edited by sepuku; 15th August 2011 at 07:05 PM.
Reply With Quote
Old 15th August 2011
sepuku's Avatar
sepuku sepuku is offline
Real Name: Vizard Sepuku
Package Pilot
 
Join Date: Jun 2011
Location: Athens & Chania,Greece
Posts: 143
Default

Quote:
Originally Posted by jggimi View Post
Just because results have been odd, you might inspect your /dev directory. Perhaps you are missing rsd* and sd* device nodes.

There are from sd0-sd9 and from rsd0 to rsd9 with nodes from a to p.I don't think something is missing.
Reply With Quote
Old 15th August 2011
sepuku's Avatar
sepuku sepuku is offline
Real Name: Vizard Sepuku
Package Pilot
 
Join Date: Jun 2011
Location: Athens & Chania,Greece
Posts: 143
Default

Quote:
Originally Posted by BSDfan666 View Post
It is possible that the enclosure is faulty or non-compliant, I've seen a few that for some reason do not work on OpenBSD, producing similar I/O errors.
I don't think that this is the problem because the disk worked fine with the old case,unless you mean that the case's board is not compatible with OpenBSD which to tell you the truth i don't know.It's a Seagate 2TB by the way.
Reply With Quote
Old 15th August 2011
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

0x0c is merely "hexadecimal 0c". OpenBSD's fdisk uses hex, so use 0c.
Reply With Quote
Old 15th August 2011
sepuku's Avatar
sepuku sepuku is offline
Real Name: Vizard Sepuku
Package Pilot
 
Join Date: Jun 2011
Location: Athens & Chania,Greece
Posts: 143
Default

I checked the FAQ about the fdisk.I gave #fdisk -e sd0 and i get

Code:
Unable to read MBR
Tomorrow afternoon i will attach the disk as an internal this time to windows machine and see if i can see anything.


edit:and no kernel messages again in xconsole.
Reply With Quote
Old 15th August 2011
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

I do not understand why # fdisk sd0 works yet # fdisk -e sd0 fails, without a kernel message. BSDfan666 has stated he's seen similar non-error errors, but this is outside my experience. I would install sysutils/smartmontools, and look to # smartctl -s on /dev/sd0c; smartctl -a /dev/sd0c to enable SMART and then query the electronics on the drive for insights. However, you are running 4.9-release and I do not believe that is new enough for smartmontools to work with USB devices. If you are serious about recovering what is on that drive, -current may aid you in at least communicating with SMART on the drive.

Windows will not aid you with either diagnostics or recovery, since your configuration violates Windows standards and expectations.

If you can install the drive internally on an OpenBSD machine, I might be able to guide you closer to recovery. Might.
Reply With Quote
Old 15th August 2011
sepuku's Avatar
sepuku sepuku is offline
Real Name: Vizard Sepuku
Package Pilot
 
Join Date: Jun 2011
Location: Athens & Chania,Greece
Posts: 143
Default

Quote:
Originally Posted by jggimi View Post
I would install sysutils/smartmontools, and look to # smartctl -s on /dev/sd0c; smartctl -a /dev/sd0c to enable SMART and then query the electronics on the drive for insights. However, you are running 4.9-release and I do not believe that is new enough for smartmontools to work with USB devices.
I have that tool on Ubuntu,ran it yesterday and can't say i understood much.I know that it might not be proper to post the result here since i ran it on a ubuntu machine,but with your experience you might understand more than me.

I gave:sudo smartctl -a /dev/sdb and part of what i took was this:

Code:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   128   100   006    Pre-fail  Always       -       1877912968
  3 Spin_Up_Time            0x0003   093   093   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   099   099   020    Old_age   Always       -       1644
  5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   065   060   030    Pre-fail  Always       -       3630356
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       504
10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       113
183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -       0
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   083   000    Old_age   Always       -       472453611630
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   061   038   045    Old_age   Always   In_the_past 39 (0 30 39 33)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       46
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       1844
194 Temperature_Celsius     0x0022   039   062   000    Old_age   Always       -       39 (0 17 0 0)
195 Hardware_ECC_Recovered  0x001a   128   100   000    Old_age   Always       -       1877912968
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -       214026810294949
241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -       2097349024
242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -       565242842

SMART Error Log Version: 1
No Errors Logged
I think that "Raw_Read_Error_Rate" should have raw_value zero from what i 've heard.So this might be a problem.

And unfortunately i won't have access to desktop with OpenBSD before the 21st of the month.So i think i should take a "time-out" until then.
Reply With Quote
Old 15th August 2011
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

If I'm reading this right, you have 0x10, or 16 "Offline Uncorrectable" sectors, and 0x12, or 18 "Current Pending Sectors."

If I understand SMART, the 16 offline uncorrectable errors are from self-tests performed by the electronics at some point. Pending sectors, on the other hand, are sectors that failed to read when requested by an OS, and those sector numbers are awaiting writes ... at which time, the hardware will assign sectors from a selection of spares and remove them from the list. Welcome to modern disk hardware, when bad sectors are pretty much outside of your control; all you can do is write over them again and have the hardware put the new data on some other physical location on the drive.

You've also had a serious heat problem, which may have been related to your power supply failure, and may have been the root cause of this media damage.

Your data, or the majority of it, should be retrievable, if the drive electronics are functioning properly, unless one of the failed sectors is critical to the filesystem. And even then, it may be possible to retrieve complete files or parts of files, using forensic tools.

----

I am baffled by the failures of userland programs like fdisk and dd. Especially since fdisk, with or without -e, was just reading sector 0.

In general, when you conduct an I/O to a disk drive, you expect one of four responses:
  1. Good results, data moved.
  2. Errors occurred. On OpenBSD, the kernel produces messages.
  3. No response at all -- on OpenBSD, after a timeout, the kernel produces messages.
  4. A "good" result with garbage data, from a bad cable or bad memory in the electronics or the system.
I didn't see any of these. At least, no evidence has yet been presented that #4 has occurred.
Reply With Quote
Old 15th August 2011
sepuku's Avatar
sepuku sepuku is offline
Real Name: Vizard Sepuku
Package Pilot
 
Join Date: Jun 2011
Location: Athens & Chania,Greece
Posts: 143
Default

Thanx a lot for all the information you provided.You really are a patient one.Talking about forensic tools,which once should i use?It's my first time dealing with this kind of issue.What I really want to save is the photos i have and some notes i have for my school.All the other stuff is just things that i can re-obtain.

About the heat problem to tell you the truth,i never noticed any strange behaviour; everything worked really good.
Reply With Quote
Old 15th August 2011
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

I like The Sleuth Kit... it is available for OpenBSD. You may find the GUI add on, Autopsy, helpful.
Reply With Quote
Reply

Tags
format, hard disk, master boot record, seagate

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hard disk reliability ephemera General Hardware 32 20th April 2010 10:17 AM
Hard disk utilization Greg_Morgan General software and network 3 16th October 2009 12:13 PM
Formatting Hard Disk Drive to UFS in OS X 10.5 Turquoise88 Other BSD and UNIX/UNIX-like 1 7th March 2009 09:57 PM
Hard disk bottle neck deathsoul FreeBSD General 1 28th September 2008 10:44 AM
Copy VCD film to hard disk mfaridi FreeBSD General 4 5th June 2008 01:57 PM


All times are GMT. The time now is 12:00 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick