Move freebsd to a new hard drive

zhaozj2021-02-16  78

Move freebsd to a new hard drive

This article mainly shows how to move your installed FreeBSD from one hard drive to another. I used Dump / Restore successfully trials many times. Before the start, please read this article.

We assume that your FreeBS is already installed on a 4G hard disk (IDE Master AD0), and we want to move it to a new 20G hard disk, you have to do it just to go to the old hard drive, install 20G new The hard disk (as the IDE Master) and performs the minimal clean install, and sets your partition accurately. Please make sure you have set the hard drive to start, and start a test!

Next, reload the original hard disk (4G) (as the IDE Master), and the new hard disk (20G) (as IDE slave). Start the original installed FreeBSD to Single User Mode (SINGLE User Mode):

Enter a single user mode:

1. Press the space (Space) while 10 second countdown, enter

Boot -s

Then enter after #

Fsck -p mount -u / mount -a swapon -a adjkerntz -i

2. Determine that you already have the device file you need so you can partition from the slave.

CD / dev ./makedev ad1s1a ./makedev ad1s1e ./makedev ad1s1f

FreeBSD 5.x version uses devfs, you can automatically detect hardware, so no

3. Establish a mount point of the new hard disk partition (Mount Point)

MKDIR / BACKUP MKDIR / BACKUP / USR MKDIR / BACKUP / VAR

4. I use a SHELL script to do the following steps:

1 - CREATE New FileSystems (Newfs The Drive)

2 - mount the partitions

3 - Dump The Data from My Old Drive, And Restore It To My New One

4 - Unmount The New Drives Partitions

5 - Enable Softupdates on The New Drive (optional)

Here is the shell script I used.

Source code:

#! / bin / sh newfs / dev / ad1s1a newfs / dev / ad1s1e newfs / dev / ad1s1f mount / dev / ad1s1a / backup / root / dev / ad1s1e / backup / var mount / dev / ad1s1f / backup / usr (Dump / USR (DUMP -0f - /) | (CD / backup / root; restore -rf -) (dump -0f - / var) | (CD / backup / var; restore -rf -) (dump -0f - / usr) | (CD) / backup / usr; restore -rf -) umount / backup / root umount / backup / var umount / backup / usr tunefs -n enable / dev / ad1s1a ### Enable SoftUpdates Tunefs -n Enable / dev / ad1s1e tunefs -n enable / dev / ad1s1f #end

The operation of performing Dump / Restore may take a few hours, please wait patiently. When the hard drive is DUMPED and RESTORED, after the new hard drive, you have to do just to remove the old hard disk (4G), set the new hard disk as the primary disk (Ide master) and restart (reboot). Now you can from the new hard drive ( 20g) Start the original installed FreeBSD! You can download the DISKCOPYSHELL script, extract the DriveCopy.sh file with tar xvf drivecopy.tar. If you customize the Custom Partitions, you need to modify the DriveCopy.sh file. Add you when you install the Standard FreeBSD Partitions, modify this file.

You can pass

Man Dump Man Restore Man Tar Man Mount Man Adjkerntz

Come get more information about these orders!

转载请注明原文地址:https://www.9cbs.com/read-12763.html

New Post(0)