Migrating FreeBsd installation to another hard drive
Hi, I've recently had the job of moving a FreeBsd installation to another hard drive. After quite a lot of reading I got round to following this article[1] using a VMWare FreeBsd instance. In brief the article uses dump and restore to move the data from one mounted partition to another in single user mode. It also suggests that before you do this, you perform a minimum install on the destination disk to ensure that it boots fine. First time round, I did the minimum install and then followed the steps (minus the MAKEDEV step as I'm running 5.3R) to backup the data to the destination. This all worked fine. Second time round, I didn't do a minimum install, rather I just set-up the slice and partitions on the destination using sysinstall, and then did the dump/restore. On booting from the destination disk this time, nothing happened. I reasoned that it was because I had no boot manager installed and so went ahead and used boot0cfg -B to install the FreeBsd boot manager. The disk now boots; however, I would prefer to use the equivalent of the 'Standard - Install a standard MBR (no boot manager)' option from sysinstall as FreeBsd is the only OS on the disk and so I don't need the option of booting to it or anything else. I'm guessing that I would use fdisk to do this but if so am not entirely sure how. In addition, is this safe to perform on a disk with data or would I need to go through the dump/restore process again? One final question is whether the dump/restore process is the best approach in this instance? I have read about using dd but am not entirely sure whether this would do what I need? Thanks in advance for any help, Chris [1] http://bsdvault.net/sections.php?op=viewarticle&artid=121 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Migrating FreeBsd installation to another hard drive
Chris Roos wrote: One final question is whether the dump/restore process is the best approach in this instance? I have read about using dd but am not entirely sure whether this would do what I need? No, you should use dump/restore and if it is the root partition you will need to edit fstab afterwards. --Alex PS There's a FAQ all about this. I have no wish to decry the bsdvault article you quote, since I haven't read it -- it may even be the same as the FAQ. But if the FAQ or handbook has a section answering your question, then it is always likely to be the best starting point. http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/disks.html#NEW-HUGE-DISK ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
RE: Migrating FreeBsd installation to another hard drive
Hi there, I had to do something similar i.e. change RAID levels, there is no need to install anything. Just use the fixit CD. Here is my procedure : Ofcourse you'll have to change disk[slice] names to what suits you. NOTE: I used tar for the /usr slice as I had some size constraints and therefore needed some compression ( I could have piped the dump to gzip ofcourse, but didn't). In my opinion dump&restore is the best procedure. But dd works as well. Regards, Ruben 1. boot from CD 2. goto fixit CD 3. create new mount point --> # mkdir /new_mnt 4. mount external drive /new_mnt --> # mount /dev/da0s1 /new_mnt 5. mount / on /mnt # mount /dev/ar0s1a /mnt 6. backup fstab and bsdlabel --> # cp /mnt/etc/fstab /new_mnt/fstab.BAK # bsdlabel ar0s1 > /new_mnt/bsdlabel.BAK 7. dump / --> # umount /mnt # dump -0au -C 32 -f /new_mnt/root_dump /dev/ar0s1a 8. dump /var --> # dump -0au -C 32 -f /new_mnt/var_dump /dev/ar0s1e 9. tar /usr ( or only those subsystems which contain userdata (dbase,mail,etc) --> # mount /dev/ar0s1f /mnt # cd /mnt # tar czf /new_mnt/usr_tar.tar.gz ./ 10.unmount all mounted filesystems --> # umount /mnt # umount /new_mnt 11. exit fixit and boot CD 12. power down 13. replace disks 14. boot to RAID config tool 15. set array to RAID0 16. reboot to CD 17. exit to FIXIT 18. erase current disklabel & create new label with one slice --> # dd if=/dev/zero of=/dev/ar0 bs=512 count=32 # fdisk -BI /dev/ar0 # dd if=/dev/zero of=/dev/ar0s1 bs=512 count=32 # bsdlabel -w -B da0s1 19. read disklabel & note c partition value 20. mount external disk & edit saved slice (step 6) 21. write edited label to disk 22. --> # bsdlabel -R /dev/ar0s1 /new_mnt 23. --> # newfs /dev/ar0s1[a,d,e,f) 24. --> # mount /dev/ar0s1d /tmp 25. --> # export TMPDIR=/tmp 26. mount & restore / --> # mount /dev/ar0s1a /mnt # cd /mnt # restore rf [PATHNAME_TO_root_dump] 27. umounting / and mount & restore /var --> # cd .. # umount /mnt # mount /dev/ar0s1e /mnt # cd /mnt # restore rf [PATHNAME_TO_var_dump] 28. extracting usr_tar.tar.gz into /usr --> # cd .. # umount /mnt # mount /dev/ar0s1f /mnt # cd /mnt # tar xzvf [PATHNAME_TO_usrtar] ./ 29. umount all open filesystems --> # umount /tmp # umount /mnt # umount /new_mnt 30. exit single user mode and startup -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Roos Sent: July 06, 2005 6:11 PM To: freebsd-questions@freebsd.org Subject: Migrating FreeBsd installation to another hard drive Hi, I've recently had the job of moving a FreeBsd installation to another hard drive. After quite a lot of reading I got round to following this article[1] using a VMWare FreeBsd instance. In brief the article uses dump and restore to move the data from one mounted partition to another in single user mode. It also suggests that before you do this, you perform a minimum install on the destination disk to ensure that it boots fine. First time round, I did the minimum install and then followed the steps (minus the MAKEDEV step as I'm running 5.3R) to backup the data to the destination. This all worked fine. Second time round, I didn't do a minimum install, rather I just set-up the slice and partitions on the destination using sysinstall, and then did the dump/restore. On booting from the destination disk this time, nothing happened. I reasoned that it was because I had no boot manager installed and so went ahead and used boot0cfg -B to install the FreeBsd boot manager. The disk now boots; however, I would prefer to use the equivalent of the 'Standard - Install a standard MBR (no boot manager)' option from sysinstall as FreeBsd is the only OS on the disk and so I don't need the option of booting to it or anything else. I'm guessing that I would use fdisk to do this but if so am not entirely sure how. In addition, is this safe to perform on a disk with data or would I need to go through the dump/restore process again? One final question is whether the dump/restore process is the best approach in this instance? I have read about using dd but am not entirely sure whether this would do what I need? Thanks in advance for any help, Chris [1] http://bsdvault.net/sections.php?op=viewarticle&artid=121 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]" -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.8.9/42 - Release Date: 07/06/2005 -- No virus found in this incoming message. Checked by AVG Anti-V
Re: Migrating FreeBsd installation to another hard drive
Alex Zbyslaw wrote: Chris Roos wrote: One final question is whether the dump/restore process is the best approach in this instance? I have read about using dd but am not entirely sure whether this would do what I need? No, you should use dump/restore and if it is the root partition you will need to edit fstab afterwards. Can I just double check that the editing of fstab is only applicable if my device names change? During my testing here I have been migrating to a secondary disk that eventually becomes the primary. As such I haven't had to change the fstab (both origin and eventually destination are device ad0). When I do this for real however, I will be migrating from a single drive to an array so understand that in that case I will need to edit fstab to reflect the device change (this should be fine as I have had to do this in the past). --Alex PS There's a FAQ all about this. I have no wish to decry the bsdvault article you quote, since I haven't read it -- it may even be the same as the FAQ. But if the FAQ or handbook has a section answering your question, then it is always likely to be the best starting point. http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/disks.html#NEW-HUGE-DISK Thanks, I'd already read the faq and the bsdvault procedure is very similar in content. I just wondered if there was any better/other ways really.. Thanks for your help, Chris ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Migrating FreeBsd installation to another hard drive
Thanks for the time taken to detail all of the steps. I think I am doing roughly the same thing except you are going via from _source_ to _intemediary_ back to _source_ once the RAID is sorted. I am going straight from _source_ to _destination_. I may be wrong but do any of your steps below involve writing the standard mbr (not the freebsd boot manager) to the drive? Thanks for your help, Chris Ruben Bloemgarten wrote: Hi there, I had to do something similar i.e. change RAID levels, there is no need to install anything. Just use the fixit CD. Here is my procedure : Ofcourse you'll have to change disk[slice] names to what suits you. NOTE: I used tar for the /usr slice as I had some size constraints and therefore needed some compression ( I could have piped the dump to gzip ofcourse, but didn't). In my opinion dump&restore is the best procedure. But dd works as well. Regards, Ruben 1. boot from CD 2. goto fixit CD 3. create new mount point --> # mkdir /new_mnt 4. mount external drive /new_mnt --> # mount /dev/da0s1 /new_mnt 5. mount / on /mnt # mount /dev/ar0s1a /mnt 6. backup fstab and bsdlabel --> # cp /mnt/etc/fstab /new_mnt/fstab.BAK # bsdlabel ar0s1 > /new_mnt/bsdlabel.BAK 7. dump / --> # umount /mnt # dump -0au -C 32 -f /new_mnt/root_dump /dev/ar0s1a 8. dump /var --> # dump -0au -C 32 -f /new_mnt/var_dump /dev/ar0s1e 9. tar /usr ( or only those subsystems which contain userdata (dbase,mail,etc) --> # mount /dev/ar0s1f /mnt # cd /mnt # tar czf /new_mnt/usr_tar.tar.gz ./ 10.unmount all mounted filesystems --> # umount /mnt # umount /new_mnt 11. exit fixit and boot CD 12. power down 13. replace disks 14. boot to RAID config tool 15. set array to RAID0 16. reboot to CD 17. exit to FIXIT 18. erase current disklabel & create new label with one slice --> # dd if=/dev/zero of=/dev/ar0 bs=512 count=32 # fdisk -BI /dev/ar0 # dd if=/dev/zero of=/dev/ar0s1 bs=512 count=32 # bsdlabel -w -B da0s1 19. read disklabel & note c partition value 20. mount external disk & edit saved slice (step 6) 21. write edited label to disk 22. --> # bsdlabel -R /dev/ar0s1 /new_mnt 23. --> # newfs /dev/ar0s1[a,d,e,f) 24. --> # mount /dev/ar0s1d /tmp 25. --> # export TMPDIR=/tmp 26. mount & restore / --> # mount /dev/ar0s1a /mnt # cd /mnt # restore rf [PATHNAME_TO_root_dump] 27. umounting / and mount & restore /var --> # cd .. # umount /mnt # mount /dev/ar0s1e /mnt # cd /mnt # restore rf [PATHNAME_TO_var_dump] 28. extracting usr_tar.tar.gz into /usr --> # cd .. # umount /mnt # mount /dev/ar0s1f /mnt # cd /mnt # tar xzvf [PATHNAME_TO_usrtar] ./ 29. umount all open filesystems --> # umount /tmp # umount /mnt # umount /new_mnt 30. exit single user mode and startup -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Roos Sent: July 06, 2005 6:11 PM To: freebsd-questions@freebsd.org Subject: Migrating FreeBsd installation to another hard drive Hi, I've recently had the job of moving a FreeBsd installation to another hard drive. After quite a lot of reading I got round to following this article[1] using a VMWare FreeBsd instance. In brief the article uses dump and restore to move the data from one mounted partition to another in single user mode. It also suggests that before you do this, you perform a minimum install on the destination disk to ensure that it boots fine. First time round, I did the minimum install and then followed the steps (minus the MAKEDEV step as I'm running 5.3R) to backup the data to the destination. This all worked fine. Second time round, I didn't do a minimum install, rather I just set-up the slice and partitions on the destination using sysinstall, and then did the dump/restore. On booting from the destination disk this time, nothing happened. I reasoned that it was because I had no boot manager installed and so went ahead and used boot0cfg -B to install the FreeBsd boot manager. The disk now boots; however, I would prefer to use the equivalent of the 'Standard - Install a standard MBR (no boot manager)' option from sysinstall as FreeBsd is the only OS on the disk and so I don't need the option of booting to it or anything else. I'm guessing that I would use fdisk to do this but if so am not entirely sure how. In addition, is this safe to perform on a disk with data or would I need to go through the dump/restore process again? One final question is whether the dump/restore process is the best approach in this instance? I have read about using dd but am not entirely sure whether this would do what I need? Thanks in advance for any help, Chris [1] http://bsdvault.net/sections.php?o
RE: Migrating FreeBsd installation to another hard drive
That would be "# fdisk -BI /dev/ar0" "B" for bootable. The FBSD boot manager is on slice *a which is left intact when using dump. The reason I went to an intermediate drive is . . . I only had two slots available on SATA backpane. Oh and check out http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/boot-blocks.html Good luck, Ruben -Original Message- From: Chris Roos [mailto:[EMAIL PROTECTED] Sent: July 07, 2005 5:13 PM To: [EMAIL PROTECTED] Cc: freebsd-questions@freebsd.org Subject: Re: Migrating FreeBsd installation to another hard drive Thanks for the time taken to detail all of the steps. I think I am doing roughly the same thing except you are going via from _source_ to _intemediary_ back to _source_ once the RAID is sorted. I am going straight from _source_ to _destination_. I may be wrong but do any of your steps below involve writing the standard mbr (not the freebsd boot manager) to the drive? Thanks for your help, Chris Ruben Bloemgarten wrote: > Hi there, > I had to do something similar i.e. change RAID levels, there is no need to > install anything. Just use the fixit CD. Here is my procedure : > Ofcourse you'll have to change disk[slice] names to what suits you. NOTE: I > used tar for the /usr slice as I had some size constraints and therefore > needed some compression ( I could have piped the dump to gzip ofcourse, but > didn't). In my opinion dump&restore is the best procedure. But dd works as > well. > Regards, > Ruben > > 1. boot from CD > 2. goto fixit CD > 3. create new mount point >--> # mkdir /new_mnt > 4. mount external drive /new_mnt >--> # mount /dev/da0s1 /new_mnt > 5. mount / on /mnt ># mount /dev/ar0s1a /mnt > 6. backup fstab and bsdlabel >--> # cp /mnt/etc/fstab /new_mnt/fstab.BAK ># bsdlabel ar0s1 > /new_mnt/bsdlabel.BAK > 7. dump / >--> # umount /mnt ># dump -0au -C 32 -f /new_mnt/root_dump /dev/ar0s1a > 8. dump /var >--> # dump -0au -C 32 -f /new_mnt/var_dump /dev/ar0s1e > 9. tar /usr ( or only those subsystems which contain userdata > (dbase,mail,etc) >--> # mount /dev/ar0s1f /mnt ># cd /mnt ># tar czf /new_mnt/usr_tar.tar.gz ./ > 10.unmount all mounted filesystems >--> # umount /mnt ># umount /new_mnt > 11. exit fixit and boot CD > 12. power down > 13. replace disks > 14. boot to RAID config tool > 15. set array to RAID0 > 16. reboot to CD > 17. exit to FIXIT > 18. erase current disklabel & create new label with one slice > --> # dd if=/dev/zero of=/dev/ar0 bs=512 count=32 > # fdisk -BI /dev/ar0 > # dd if=/dev/zero of=/dev/ar0s1 bs=512 count=32 > # bsdlabel -w -B ar0s1 > 19. read disklabel & note c partition value > 20. mount external disk & edit saved slice (step 6) > 21. write edited label to disk > 22. --> # bsdlabel -R /dev/ar0s1 /new_mnt > 23. --> # newfs /dev/ar0s1[a,d,e,f) > 24. --> # mount /dev/ar0s1d /tmp > 25. --> # export TMPDIR=/tmp > 26. mount & restore / > --> # mount /dev/ar0s1a /mnt > # cd /mnt > # restore rf [PATHNAME_TO_root_dump] > 27. umounting / and mount & restore /var > --> # cd .. > # umount /mnt > # mount /dev/ar0s1e /mnt > # cd /mnt > # restore rf [PATHNAME_TO_var_dump] > 28. extracting usr_tar.tar.gz into /usr > --> # cd .. > # umount /mnt > # mount /dev/ar0s1f /mnt > # cd /mnt > # tar xzvf [PATHNAME_TO_usrtar] ./ > 29. umount all open filesystems > --> # umount /tmp > # umount /mnt > # umount /new_mnt > 30. exit single user mode and startup > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Chris Roos > Sent: July 06, 2005 6:11 PM > To: freebsd-questions@freebsd.org > Subject: Migrating FreeBsd installation to another hard drive > > Hi, > > I've recently had the job of moving a FreeBsd installation to another > hard drive. > > After quite a lot of reading I got round to following this article[1] > using a VMWare FreeBsd instance. In brief the article uses dump and > restore to move the data from one mounted partition to another in single > user mode. It also suggests that before you do this, you perform a > minimum install on the destination disk to ensure that it boots fine. > > First time round, I did the minimum install and then followed the steps > (minus the MAKEDEV step as I'm running 5.3R) to backup the data to the > destination. This all worked fine. > > Second time round, I didn't do a minimum install, rather I just set
Re: Migrating FreeBsd installation to another hard drive
Chris Roos wrote: Alex Zbyslaw wrote: Chris Roos wrote: One final question is whether the dump/restore process is the best approach in this instance? I have read about using dd but am not entirely sure whether this would do what I need? No, you should use dump/restore and if it is the root partition you will need to edit fstab afterwards. Can I just double check that the editing of fstab is only applicable if my device names change? Correct. If the device will end up on the same controller and logical position (master, slave, whatever) then you do not need to edit it. However, if you plan to reboot the machine and just boot off the new disk without changing its position first, then edit fstab. You can always edit it back again before moving the hardware around. --Alex ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"