How to move FreeBSD system from one hdd to another.
It’s can be useful, when you current hard drive disk too small or going out of order.
I’ve moved my FreeBSD system with this simple method twice. At last I’ve moved System from production server. New hdd has added in software RAID-1 and work correct.So, I think you won’t have some kind of problem. Any way, if something will wrong you always can use your previous hdd.
Let’s start.
1)Shut down your FreeBSD:
#halt
and swich off computer from power
2)Connect your new hdd, swich on computer and make shure that hdd is detected (in BIOS) and start booting system.
3)For example your new hdd has detected like this: /dev/ad4
4)make directories for points for mounting yours partitions:
#mkdir /mnt/root && mkdir /mnt/var && mkdir /mnt/usr
5) Start up sysinstall program:
#sysinstall
choose Configure-> Fdisk-> ad4 (carefully)
create freeBSD slice on the all disk space. Press s (set bootable), press w (write changes). And choose “Standard Install a standard MBR” and press “YES”
Go to the Label choose ad4 press ‘a’ (auto-defaults for all), it is auto create partitions for you. You can create partitions yourself (if you need special partition size). After that you have to select mount points. For every partition press ‘m’ and insert mount point (for exemple in my partition ad4s1e mount point “/mnt/usr”), when you finish, press ‘w’ (write changes). If you create partitions by hand – you should be shure that your root partition has created with letter “a” like this: ad4s1a. You can obtain it in thw next trick. Firstly create partinion with mount point ‘/’ – only in this case partition will be created by Label with letter ‘a’. And after that you need change mount point partition ad4s1a in ‘/mnt/root/’. I advise you create partition the same in your previous disk (see in /etc/fstab). Don’t forget create partitions that were in your previous disk (/tmp and others) After that program create partitions and mount it in your points – /mnt/root, /mnt/var, mkdir /mnt/usr.
6) Check your partition and mount points:
#df
7) Now you are ready for magic commands:
# cd / ; pax -p eme -X -rw . /mnt/root
# cd /var; pax -p eme -X -rw . /mnt/var
# cd /usr; pax -p eme -X -rw . /mnt/usr
8)If letters partitions in your new hdd are not conform with letters partitions your previous hdd you must fix it in you new fstab: /mnt/root/etc/fstab
Carefully examine your fstab and output df. If your new hdd take the place of previous hdd (replace) and letters of partitions the same in the both hdds. You don’t have to change mnt/root/etc/fstab, becose when you replace you old hdd pertition will be correct for you new hdd. But if your partitions were changed – edit /mnt/root/etc/fstab. For example if partiotion /var has lable /dev/ad0s1f and became /dev/ad0s1g you have to change in /mnt/root/etc/fstab from ad0s1f to ad0s1g
9)Shut down…swich off… replace hdd..swich on…enjoy
Posted on May 4th, 2010 by admin
Filed under: Software