# Mounting a drive   wrong magic number



## NeilP (Nov 8, 2011)

```
ads1 wrong magic number 0x9386 expect ....
```

I have been using a FreeNAS box (based on FreeBSD 7.2-RELEASE-p7) for a year or more now, running 24/7 for about 2 years. I went on holiday for 2 months so turned it off while I was away.  When I came back the inevitable happened: one of the drives failed when I powered it back up.

I have read that this is either something to do with a wrong or missing label in the volume TOC, and refomatting it will reinstate the correct label. But of course data will be lost.

This is not critical data (torrent files and downloaded data) so if I can't get it back then no big deal, but if I could it would make life easier.

I have tried remounting the mountpoint from within the FreeNAS console/terminal and also through the WebGUI, and have failed to mount it.

I have created a FreeBSD VMWare machine, taken another drive out of the FreeNAS machine, connected it to a IDE -USB adapter and mounted the working drive in the VMWare machine. This works, so I know my technique is OK.

When I do `ls /dev` the working drive partition shows as da0p1 but the drive I can't mount appears as da0s1.

What is this 's' or 'p' difference? Is that relevant? They were both formatted as UFS from what I can remember.

Any help appreciated.

Thanks
Neil


----------



## wblock@ (Nov 8, 2011)

A drive with a GPT partitioning scheme has partitions that show with the p for "partition".  A drive with the MBR partitioning scheme has partitions that show with the s, standing for "slice".

Slices are not usually used directly, because only four are available.  Instead, they're divided with bsdlabel(8), giving FreeBSD "partitions" like ad0s1a, ad0s1f.  The UFS filesystems will be in those subpartitions.
`# mount /dev/ad0s1f /mnt`

file(1) can be used to identify filesystems.
`# file -s /dev/ada0p2`
`# file -s /dev/ad0s1e`


----------



## jb_fvwm2 (Nov 9, 2011)

```
tunefs -p /dev/ad0s2a
```
 works similar to the file command in the post above, but in a more readable format. (Happened to use it earlier today, so i knew.)


----------



## NeilP (Nov 9, 2011)

OK, thanks


Leanrning all the time

Here is what I get

$ file -s /dev/da0s1
/dev/da0s1: writable, no read permission

$ tunefs -p  /dev/da0s1
tunefs: /dev/da0s1: could not open special device
$      

So looks like I will some how need to change the read permissions? correct?


----------



## NeilP (Nov 9, 2011)

Tried again as 


```
$ mount /dev/da0s1 /freenas
mount: /dev/da0s1 : Operation not permitted
$ sudo su
Password:
You have mail.
bagvapp#
bagvapp# mount /dev/da0s1 /freenas
mount: /dev/da0s1 : Invalid argument
bagvapp#
bagvapp#
bagvapp# file -s /dev/da0s1
/dev/da0s1: x86 boot sector
bagvapp#
bagvapp#
bagvapp# tunefs -p /dev/da0s1
tunefs: /dev/da0s1: could not read superblock to fill out disk
bagvapp#
```

so where does this leave me?


----------



## NeilP (Nov 9, 2011)

```
bagvapp# mount /dev/da0s1 /mnt
mount: /dev/da0s1 : Invalid argument
bagvapp# mount /dev/da0s1a /mnt
mount: /dev/da0s1a : No such file or directory
bagvapp# mount /dev/da0s1b /mnt
mount: /dev/da0s1b : No such file or directory
bagvapp# tunefs -p /dev/da0s1a
tunefs: /dev/da0s1a: could not find special device
bagvapp# tunefs -p /dev/da0s1b
tunefs: /dev/da0s1b: could not find special device
bagvapp# tunefs -p /dev/da0s1c
tunefs: /dev/da0s1c: could not find special device
bagvapp# tunefs -p /dev/da0s1d
tunefs: /dev/da0s1d: could not find special device
bagvapp# tunefs -p /dev/da0s1e
tunefs: /dev/da0s1e: could not find special device
bagvapp# file -s /dev/da0s1a
/dev/da0s1a: cannot open `/dev/da0s1a' (No such file or directory)
bagvapp# file -s /dev/da0s1b
/dev/da0s1b: cannot open `/dev/da0s1b' (No such file or directory)
bagvapp#
```


----------



## NeilP (Nov 9, 2011)

Well back again after thinking about Gparted ...I see using the FreeBSD packagag manager that 'gpart' is installed, so I have been trying that.

Using the man page
http://www.brzitwa.de/mb/gpart/gpart-man.html
but every example I try from the man pages, all I get is 'Unknown Command"

So all I can think of is that there is more than one set of gpart commands?




> EXAMPLES
> 
> - To  scan  the  first  IDE  hard  disk  under Linux using
> default settings type
> ...





```
bagvapp# gpart /dev/da0
gpart: Unknown command: /dev/da0.
usage: gpart add -b start -s size -t type [-i index] [-l label] [-f flags] geom
       gpart bootcode [-b bootcode] [-p partcode] [-i index] [-f flags] geom
       gpart commit geom
       gpart create -s scheme [-n entries] [-f flags] provider
       gpart delete -i index [-f flags] geom
       gpart destroy [-f flags] geom
       gpart modify -i index [-l label] [-t type] [-f flags] geom
       gpart set -a attrib -i index [-f flags] geom
       gpart show [-lr] [geom ...]
       gpart undo geom
       gpart unset -a attrib -i index [-f flags] geom
       gpart help
       gpart list [name ...]
       gpart status [-s] [name ...]
       gpart load [-v]
       gpart unload [-v]
bagvapp#
```


I have tried some of the command options as appear above, but get no luck there either


```
bagvapp# gpart show [-lr] /dev/da0
gpart: No match.
bagvapp# gpart show /dev/da0
gpart: No such geom: /dev/da0.
```


----------



## wblock@ (Nov 9, 2011)

gpart(8) is a part of the base FreeBSD operating system.  It is not GParted.  See the man page, the link earlier in this message.

First, look to see which device nodes are found on the device:
`# ls /dev/da0*`

Use gpart(8) to see if there is a known partition scheme on the drive:
`# gpart show da0`


----------



## NeilP (Nov 9, 2011)

Thanks for that man page link...it is a better man page for this version of gpart than I found

Anyway
this is what I get


```
bagvapp# ls /dev/da0*
/dev/da0        /dev/da0s1
bagvapp# gpart show da0
gpart: No such geom: da0.
bagvapp# gpart show da01
gpart: No such geom: da01.
bagvapp#
```


----------



## NeilP (Nov 9, 2011)

Hey guys...I think I have come to a dead end.
I attempted to mount the disk on a new build of FreeNAS 8 and eventually got it to some how mount..and again it showed write only but not read permissions.

SO I thought..great...I'll re write the permissions to allow reading.

Did that ...then had to go to work


Well anyway back from work, and I plug it in to the Mac again in preparation to try more suggestions with it on the VM machine...
This time it mounts on the mac desktop with the same name I had given it in FreeNAS 8.

I can browse the mounted volume in Mac Finder...and all the folders are a complete Windows XP operating system from a machine I dumped over two years ago...No sign at all of the partition or the data I was looking for.

So either of two things have happened..

Either I got the disks somehow mixed up before I labelled them
or 
enough of the old file system remained ..as the man page suggests can happen.

Either way thanks for your help, but I am not going to be taking this any further 

Thanks again

Neil


----------



## NeilP (Nov 11, 2011)

Thought I ought to complete my humiliation here on my first posting by admitting what an arse I have been. First I take the HDD out and then label the wrong one, so try to recover  data off a drive that does not contain it.

This did not work.

So I need a new NAS box so start building one, from parts and a pile of of old PC's and a about 30 used HDD's. I mount a drive and find a partition on it. Weird, I normally blank all my 'spare' drives. Yes it is my lost data   It mounts on VM ware and works perfectly.

But I do nothing with it, just put it to one side (labelled) and carry on with the build of NAS box. I get the new box up and running and physicaly mount the 'lost data' drive in it. 
I plug the molex power lead in and there is spark and a flash and an 8 pin DIL SMD mosfet package on the back of the HDD lets out its smoke.

Yep, I had left the power on and tried to plug the molex plug in backwards.

What at total F...wit.

OK, so I have spare identical drives, so I could try swapping control boards, platters, but not even going there. I have done enough damage this week.


----------



## wblock@ (Nov 11, 2011)

NeilP said:
			
		

> Thought I ought to complete my humiliation here on my first posting...by admitting what an arse I have been
> 
> First i take the HDD out...and then label the wrong one..so try to  recover  data off a drive that does not contain it.
> 
> This did not work



Would have been pretty cool if it did, though!  But look at all the experience you've gained.



> So I need a new NAS box so start building one, from parts and a pile of of old PC's and a about 30 used HDD's



Given current drive prices, that could be a pile of money.



> I plug the molex power lead in and there is spark and a flash and an 8 pin DIL SMD mosfet package on the back of the HDD lets out its smoke.
> 
> Yep.. I had left the power on and tried to plug the molex plug in backwards.



Something similar happens to everybody at one time or another. 



> OK, so I have spare identical drives...so i could try swapping control boards...platters..but not even going there...I have done enough damage this week



With the fragile ribbon cables and connectors, it might be easier to swap a MOSFET from a donor board.  Depends on having a decent soldering setup and maybe some Chip-Quik.


----------



## NeilP (Nov 11, 2011)

wblock@ said:
			
		

> Would have been pretty cool if it did, though!  But look at all the experience you've gained.



Trouble is with experiences like this that I could learn from is that I only dabble in this sort of stuff rarely...when setting up a new box...and then when it goes wrong and needs fixing...because BSD seems so damn reliable.  This means it is many months between needing this sort of knowledge  ( 18 months at least since I last needed to do anything)



			
				wblock@ said:
			
		

> Given current drive prices, that could be a pile of money.



If only they were of a decent size..the biggest ones are 160gb ( and I just fried one of them), with the remainder being 80's 40's 30's and 8gb drives.  All scrappers from old dump PC's.





			
				wblock@ said:
			
		

> With the fragile ribbon cables and connectors, it might be easier to swap a MOSFET from a donor board.  Depends on having a decent soldering setup and maybe some Chip-Quik.



Was thinking the same thing..but I do not have much in the way of micro soldering tools.
It is not a decent sized mosfet, but a pair in a 8 pin DIL SMD package
http://pdf1.alldatasheet.com/datasheet-pdf/view/24687/STMICROELECTRONICS/STS2DPF20V.html

no done any SMD work before.  All the important stuff was off the drive any how.  I would like to repair it or attempt to just for the challenge, but it is not a necessity.  It was music torrent file downloads that I had already moved over to my music server, they were just there on the BT box ...upping my share ratio


----------



## wblock@ (Nov 11, 2011)

If you have a decent temp-controlled soldering iron, Chip-Quik will let you remove those chips.  Use solder wick to clean the pads, then solder the working one in.  Sparkfun has some videos on SMD soldering, it's not as hard as it seems.  Although there could be other components that also failed.


----------

