Migrating to second hard drive

I need a hint how to mount a second hard drive into a newly installed BSD Desktop System. This second drive has been mounted under Debian wheezy but after changing to jessie I am facing the music. It is not a raid, justs a simple second hdd.
Since I installed the new system and no further applications I can see the disk, gsmartcontrol is telling me that it is safe and sound. The totally used disk space is about 469 GB on that disk I need to acces. I know that once a disk has been used in another system there are different rights and it is seen as another device, another user and another root. So normally I would change the fstab. So I did, but this resulted in nothing but a unbootable system. Note: even as root, the changes were not accepted, rights were set to 775.
The line I added to the /etc/fstab was

Code:
/dev/ada1s1  /newdisk  ufs  rw 2  2

So I reinstalled the whole system. Looking for the following files. /boot looking at
Code:
loader.conf
loader.conf.pcbsd
loader.rc
By the way, I set in the first two under
Code:
# Load File-System Support
ext2fs_load="YES"
ext4fs_load="YES"

May I should apply as well to
Code:
# Load Linux compat
linux_lvm="YES"
I really don't know.

So I searched on, reading about to add a slice to the 2nd disk, beside the mbr. Under linux it has been a linux_lvm and under gpart list is said
Code:
 Mode : r0w0e0  ... type : linux_lvm

gpart list tells me the disk is safe and sound. And a MTBF for some 4200 hours. I am using this disk for less than a year as a mass storage. If it helps I put here the output of gpart list.
To cut a long story short, is it a good idea to add a slice to the second hdd, beside the mbr that is already there, just to gain access to it? Or how to copy the content and after that format it? And how to gain access to it? That is the crucial point.
So if anyone has a clue that helps to access the disk I gladfully appreciate it. Thanks in advance.
 
I just have been, not for the first time reading this very site, even the man-page for gpart, but what happens, when I follow those instructions as this very site tells me to do is :
Code:
# gpart create -s GPT ada1
gpart: geom 'ada1': File exists
and this
Code:
# gpart add -t freebsd-ufs -a 1M ada1
gpart: size '0': Invalid argument
.
Any time I tried for training to delete a slice on a pluggable usb-key and afterwards to destroy it, I could not succeed with none of them. Nor destruct it, neither destroy it, not even the -f Option worked. So how to delete the slice on the 2nd disk, in this case called
ada1. I tried
Code:
newfs -U /dev/ada1p1
newfs: /dev/ada1p1: could not find special device
and
Code:
/var/run/dmesg.boot
diskinfo -ctv ada1
gpart set -a active /dev/ada1
   operation not supported by device
gpart set -a bootme -i 1 /dev/ada1
   invalid argument
In almost complete dispair I tried the following one
Code:
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada1
bootcode written to ada1
 
I just have been, not for the first time reading this very site, even the man-page for gpart, but what happens, when I follow those instructions as this very site tells me to do is :
Code:
# gpart create -s GPT ada1
gpart: geom 'ada1': File exists
and this
Code:
# gpart add -t freebsd-ufs -a 1M ada1
gpart: size '0': Invalid argument
.
Any time I tried for training to delete a slice on a pluggable usb-key and afterwards to destroy it, I could not succeed with none of them. Nor destruct it, neither destroy it, not even the -f Option worked. So how to delete the slice on the 2nd disk, in this case called
ada1. I tried
Code:
newfs -U /dev/ada1p1
newfs: /dev/ada1p1: could not find special device
and
Code:
/var/run/dmesg.boot
diskinfo -ctv ada1
gpart set -a active /dev/ada1
   operation not supported by device
gpart set -a bootme -i 1 /dev/ada1
   invalid argument
In almost complete dispair I tried the following one
Code:
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada1
bootcode written to ada1
And as soon as I add a line to
Code:
 /etc/fstab
taking the risk to reboot, it stops and freezes, just after adding the device and mount point rw options etc.
 
gpart destroy -F ada1 does not work ? Maybe dd < /dev/zero > /dev/ada1 will ? Let it whirr for a second and ^C. Then start again with gpart create ...

remember to breathe :)
Juha

You might benefit later, if you create a small ada1p1 for /boot and then a large ada1p2. The first page in EXAMPLES of gpart(8)
 
I may take a deep breath, because I typed the following, and just now running GSmartControl the long run.....ten minutes left....but I guess it's about data recovery now. So I did this:
The last try was about deleting the index on the 2nd hdd typing the command
Code:
gpart delete -i 1 ada1
then
Code:
gpart add -t freebsd-zfs -a 1M ada1
then the decisive error, I guess
Code:
gpart add -t freebsd-boot -b40 -s512k ada1
and running GSmart Control the long test.
I can mount the disk and see a snapshot. But as it appears, it is empty.
Throughout the time testing this I saw at least three slices, or partitions, which are said to contain a hidden backup.
So now typing
Code:
gpart recover ada1s1
gpart: arg0 'ada1s1': Invalid argument
Or should I type ada1p1 instead?
Code:
gpart recover ada1
ada1 recovering is not needed
Well, can anyone help me out of this trap? Thanks in advance.
 
I don't know what "GSmartControl" is, or why you are running it. Or why data recovery is mentioned. Repartitioning a disk deletes the old partitions and data. Make a backup before starting.

The command that will help is just gpart show ada1. The errors about not being able to create a new GEOM are because the drive is already partitioned.
To repartition it, the old partitioning must be destroyed. gpart(8) refuses to destroy partitioning unless all the partitions are removed first. Or that can be overridden with -F (note: capital F, and this will erase the partitioning on ada1 making any old data extremely difficult to recover):
gpart destroy -F ada1

Then you can create a GPT partitioning scheme and add partitions. This does not create any data, just leaves the disk with empty filesystems where data can be copied.
 
Back
Top