How do I mount and transfer data from my old drive to new drive?

How do I mount and transfer data from my old drive to new drive? I currently came accross this problem with my older FreeBSD drive.

Code:
status=51<READY,DSC,ERROR> error=40<UNCORRECTABLE>

This made the first drive unstable and always wanted to shut down. So I bought a new drive and reinstalled a fresh FreeBSD 8.2 latest. How can I mount the old one to transfer the MySQL databases over onto the new one and the websites to the new drive?

Thanks

Scott.
 
looking to access the old drive from the new FreeBSD 8.2 drive.

Looking to access the old drive from the new FreeBSD 8.2 drive. like accessing a directory to cp or mv whole directories of data to the new drive. Example my websites directory and MySQL databases to the new MySQL database /db/mysql on the new drive etc.
 
With the old drive connected at boot time, first identify the device you want to mount

Code:
# egrep 'ad[0-9]|da[0-9]' /var/run/dmesg.boot
ad1: 152626MB <MAXTOR STM3160212A 3.AAJ> at ata0-slave UDMA100 
ad4: 78166MB <Maxtor 6Y080M0 YAR51HW0> at ata2-master UDMA100 SATA 1.5Gb/s

In this case ad4, it might be a good idea to fsck the disk before mounting unless the drive is about to fail.

e.g.
Code:
# fsck -y /dev/ad4s1d

locate which partition on disk you want to mount and mount it

Code:
# ls /dev/ad4*
/dev/ad4    /dev/ad4s1  /dev/ad4s1a /dev/ad4s1b /dev/ad4s1d
# mount -f /dev/ad4s1d /mnt

If this was all error free you can now [cmd=]# cd /mnt[/cmd] and copy or move your files to the new drive.
 
Plug in the drive; compare /var/log/dmesg.yesterday with
Code:
 dmesg -a
to see what device the old drive is detected as; mount it on a mount point (Command will vary depending upon the name in /dev of the partition/filesystem you wish to copy; copy method can vary (rsync, dd, etc etc... ). If you've never done it before, I'd copy a small amount (one or two files) first to be sure the source and destination are what you want to make happen.
....
Abbreviated version anyway... other ways may exist. Also, the post above this one appeared as I was typing this "first reply..."
 
jake said:
With the old drive connected at boot time, first identify the device you want to mount

Code:
# egrep 'ad[0-9]|da[0-9]' /var/run/dmesg.boot
ad1: 152626MB <MAXTOR STM3160212A 3.AAJ> at ata0-slave UDMA100 
ad4: 78166MB <Maxtor 6Y080M0 YAR51HW0> at ata2-master UDMA100 SATA 1.5Gb/s

In this case ad4, it might be a good idea to fsck the disk before mounting unless the drive is about to fail.

e.g.
Code:
# fsck -y /dev/ad4s1d

locate which partition on disk you want to mount and mount it

Code:
# ls /dev/ad4*
/dev/ad4    /dev/ad4s1  /dev/ad4s1a /dev/ad4s1b /dev/ad4s1d
# mount -f /dev/ad4s1d /mnt

If this was all error free you can now '# cd /mnt' and copy or move your files to the new drive.


I'm a little confused about this part..

Code:
# ls /dev/ad4*
/dev/ad4    /dev/ad4s1  /dev/ad4s1a /dev/ad4s1b /dev/ad4s1d
# mount -f /dev/ad4s1d /mnt

Scared to death here, i need it really clear in my head before i proceed.

where did the ad4s1, ad4s1a etc come from? I only see the two drives you show
up the top. Never mounted a drive before, only fresh installs.

just did the first part... booted up and i see my drive as being..
ad10 - the new freeBSD drive
ad12 - the old drive.

Ok now i see what you showed me now like above with all the dev directories.
Now how would i know what each one is?

I tried this....

Code:
cd /dev/ad12

says Not a directory and all the others say the same.


Ok i tried to do a

Code:
fsck -y /dev/ad12s1f
fsck: Could not determine filesystem type

Where to go from here?
 
Code:
 fdisk /dev/ad10
fdisk /dev/ad12
fdisk without arguments should show what partitions exist. (a 165 for freebsd). (Most arguments to fdisk may destroy data). If you have /dev/ad12s1, /dev/ad12s2, etc you may be able to mount each one onto /mnt in turn until the ones with the data you want appear. If you cannot fsck, and/or "no valid label found", sometimes a
Code:
 mount -o force /dev/ad12s1 /mnt
may make the data appear. If you cannot then rsync/dd data off it without errors, there is a switch to dd (another dangerous command if one is not careful) to continue upon error.
....
Hope that answers most of the immediate questions at this point.
 
Back
Top