# Data Recovery



## mairving (May 25, 2010)

I have 2 SCSI disks in a system. One of the disks is failing. It hasn't failed completely but it's getting pretty close. The system functioned as a web server, apache, mysql on it. The disk that is failing is the first disk with /, etc, var, usr, and /home on it along with the swap files. The second disk is /home2. Most of the data has been copied off of disk1 to disk2. It is running FreeBSD version 6. 

As of now when I boot it up it goes into single user mode since there are bad blocks and wants to run fsck. Is it possible to replace drive 1 with a new drive and recover the data back from disk2? Or is it possible to boot possibly off of a CD, mount disk2 and move the data off of it? Or if you think that another option is better please let me know.

Thanks for the help.


----------



## SirDice (May 25, 2010)

Since most of the data on Disk1 is only the operating system just replace the drive and reinstall FreeBSD. After that you can access the data on disk2 without any problems.


----------



## mairving (May 25, 2010)

Thanks.

Once I reinstall the OS, do I just need to mount disk 2 and add to fstab?


----------



## SirDice (May 25, 2010)

Yep. After you installed the OS on a new drive you can also (temporarily) add the 'old' Disk1. If still workable you may need a few configuration files off of it.

If you're not that experienced with installing Freebsd I would suggest removing both drives. Add the new drive and install the OS. Once that's up and running put the 'old' Disk2 back. That way you can't screw up during install and inadvertently nuke your data on disk2


----------



## mairving (May 25, 2010)

SirDice said:
			
		

> Yep. After you installed the OS on a new drive you can also (temporarily) add the 'old' Disk1. If still workable you may need a few configuration files off of it.
> 
> If you're not that experienced with installing Freebsd I would suggest removing both drives. Add the new drive and install the OS. Once that's up and running put the 'old' Disk2 back. That way you can't screw up during install and inadvertently nuke your data on disk2



Thanks, have a fair amount of experience with FreeBSD but still a probably a good idea to disconnect disk 2. Appreciate the timely help.


----------



## mairving (May 27, 2010)

What is the proper way to mount the disk? The 2nd disk is da1. There is only one partition on the disk, /home2. When I add /dev/da1s1 /home2 to fstab and attempt to mount it, I get a 'no such file or directory'.


----------



## Beastie (May 27, 2010)

Do /dev/da1s1 and /home2 exist? FreeBSD won't create the mountpoint. You must create it yourself. And you must specify the partition, e.g. da1s1*d*.

Post the failing /etc/fstab entry.


----------



## mairving (May 27, 2010)

Beastie said:
			
		

> Do /dev/da1s1 and /home2 exist? FreeBSD won't create the mountpoint. You must create it yourself. And you must specify the partition, e.g. da1s1*d*.
> 
> Post the failing /etc/fstab entry.



FSTAB (without extra HD)

```
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/da0s1b             none            swap    sw              0       0
/dev/da0s1a             /               ufs     rw              1       1
/dev/da0s1g             /home           ufs     rw              2       2
/dev/da0s1e             /tmp            ufs     rw              2       2
/dev/da0s1f             /usr            ufs     rw              2       2
/dev/da0s1d             /var            ufs     rw              2       2
/dev/acd0               /cdrom          cd9660  ro,noauto       0       0
```

FSTAB with extra HD

```
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/da0s1b             none            swap    sw              0       0
/dev/da0s1a             /               ufs     rw              1       1
/dev/da0s1g             /home           ufs     rw              2       2
/dev/da0s1e             /tmp            ufs     rw              2       2
/dev/da0s1f             /usr            ufs     rw              2       2
/dev/da0s1d             /var            ufs     rw              2       2
[B]/dev/da1s1a             /home2          ufs     rw              2       2 [/B]  
/dev/acd0               /cdrom          cd9660  ro,noauto       0       0
```

When mounting...

```
mount /dev/da1s1a
mount: /home2: No such file or directory
```

I am not sure how else to mount this.


----------



## Beastie (May 27, 2010)

You didn't read my post.


			
				Beastie said:
			
		

> FreeBSD won't create the mountpoint. You must create it yourself.


----------



## Ruler2112 (May 28, 2010)

[cmd=]mkdir /home2[/cmd] will create the mount point as beastie indicated.  Basically, BSD is refusing to mount the drive and graft it to the file system because the directory you're trying to mount it on isn't there.


----------



## mairving (May 28, 2010)

Beastie said:
			
		

> You didn't read my post.



I read it. I just wasn't sure what you meant. Thanks.


----------



## mairving (May 28, 2010)

Ruler2112 said:
			
		

> [cmd=]mkdir /home2[/cmd] will create the mount point as beastie indicated.  Basically, BSD is refusing to mount the drive and graft it to the file system because the directory you're trying to mount it on isn't there.



That explains it. I knew I was missing a step.


----------

