# Moving FreeBSD from ad4 to ad6



## fxp (Dec 8, 2008)

Hi, i have FreeBSD 6.2 and need to move it on new HDD.
so, questions now:

dump | restore said "no memory for strings" and abandon me(even in multiuser mode), so i move to cp -RpP what it can cause ?
As you can see i have 2 disks attached as masters.


```
sysinstall -> fdisk
sysinstall -> label
cp -RpP `find / -depth 1 | grep -v mnt` /mnt
ee /mnt/etc/fstab
in bios: set boot from ad6
```

so i get "What is this bios_drive:interface(unit,partition)kernel_name thing that is displayed with the boot help?" as discribed here - http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/install-trouble.html#Q2.11.3.2.

after i type "1:ad(6,a)/boot/kernel/kernel" it`s try to load but ends with some HEX dump and "BTX Halted" message.
Does this old workaround with manual typing path to kernel still work ?


----------



## mgp (Dec 8, 2008)

I think you can do it with the "dd" utility
but I'm not sure, you have to research a little bit.

good luck


----------



## fxp (Dec 8, 2008)

thanks a lot, you helped me so mush, and please read topic next time >_<

I have done this transfer 10 times on test machine, but that was da0 <-> ad0


----------



## graudeejs (Dec 8, 2008)

fxp said:
			
		

> dump | restore said "no memory for strings" and abandon me(even in multiuser mode), so i move to cp -RpP what it can cause ?
> As you can see i have 2 disks attached as masters.



can you show the message?
Did you have /tmp and /var/tmp space?
restore failed on me many times before i discovred this.
It needs /tmp or /var/tmp mounted (with some space available).
I dunno which exacly because /var/tmp on my box was link to /tmp

i still suggest to stick to dump/restore (i'm using this all the time, to move FreeBSD to usb pen-drive)
http://forums.freebsd.org/showthread.php?t=185
just need to figure out what happened


----------



## fxp (Dec 11, 2008)

oooooooookkkkk....
what i get now:

dd if=/dev/da0 of=/dev/ad4 bs=8m --- Ends with full working two systems.
Boot from FreeBSD_disk1.iso CD and install system on ad4 --- Ends with full working system.
fdisk -BI /dev/ad4 && bsdlabel -w -B /dev/ad4s1 && newfs /dev/ad4s1a && dump/restore da0s1a to ad4s1a - "boot: ad(0,a): /boot/kernel/kernel" - nothing help there, even if i point to 1:da(0,a) , system found kernel but freeze when try to load it. IF to 0:ad(4,a) - system just can`t find it.


Just found and issue:
install from sysinstall - fdisk ad4 - "size - 781417602" and "end: cyl 1023/ head/ 254/ sector 63"
using fdisk from live system - fdisk ad4 - "size - 781422705" and "end: cyl 52/ head 15/ sector 63"

UPDATE:
If after fresh install i do only one command - "fdisk -BI ad4" system goes in "boot: ad(0,a): /boot/kernel/kernel" state. but all data safe, i can boot from other media mount ad4s1a and access files.


What i want ? i want RIGHT backup&restore. What is this fdisk bug ?


----------



## graudeejs (Dec 11, 2008)

do you use grub as boot loader?
By way you are writing (naming disks), i think you do.

i don't really understand last post.
What's wrong? Can't boot from disk?


----------



## fxp (Dec 12, 2008)

no, i use "Standart MBR" without any boot manager.
"By way you are writing (naming disks), i think you do." - can`t  understand what it means.

Eah, i can`t "boot: ad(0,a): /boot/kernel/kernel" - means system stuck after fist boot stage and can`t find kernel.

i think it`s this problem - http://lists.freebsd.org/pipermail/freebsd-questions/2004-January/033356.html but not exactly, sysinstall`s fdisk(when boot from CD) - just fine, custom fdisk - no boot, sysinstall from running machine - no boot.
anyway - just too many variables, like bios with "Auto LBA" and dd`ing whole disk several times >_<

and yes, i set kern.geom.debugflags=16


----------



## OLD (Dec 12, 2008)

# cd /usr/ports/sysutils/clonehdd
# make install clean
# clonehdd -src=ad4 -dst=ad6 -swap=2048 -fstab=ad6


----------



## graudeejs (Dec 12, 2008)

fxp said:
			
		

> "By way you are writing (naming disks), i think you do." - can`t  understand what it means.




In linux to boot you use ad(0,0) or something like that
on FreeBSD you use ad0s1a, where s1 is slice 1 (aka partion 1), and a is label

in line you have provided, the missing part is slice...
have you used bsdlabel to label slices?

On bsd you use Fdisk to make slices, and then bsdlabel to make labels
after that you use newfs to make filesystems


----------



## lizzard (Dec 14, 2008)

If you want to move FreeBSD on another harddrive, you can try something like that (in single-user mode):


> # cd /; pax -p e -X -rw . /mnt/backup/root; \
> cd /var; pax -p e -X -rw . /mnt/backup/var; \
> cd /usr; pax -p e -X -rw . /mnt/backup/usr; \
> cd /tmp; pax -p e -X -rw . /mnt/backup/tmp



Where /mnt/backup/... - mounted partitions of new HDD. After finish that, edit new fstab (/mnt/backup/etc/fstab).


----------



## fxp (Dec 15, 2008)

pax is just another "cp".
what i`m talking about - is that bootcode written by fdisk and bsdlabel (or sysinstall) can`t load system.
But as i said dd goes well.


----------

