Backup & Restore (dump & restore)
Posted by: admin at 1 Monday 29th, 2009
FreeBSD 7.1 and reliable backup procedures published in the test.The most important is the following.
- To make a backup of the backup must be able to quickly and reliably is necessary to single-user mode, you need to blank short time.
- Cumbersome backup process will not be able to continue.
- To restore OKONAE along the steps, others (including his own after a few months) if you can understand this state must be able to ensure.
Backup to tape, it takes time, and reliability of thin media experience greater capacity than what the HDD is a daily backup tapes must be enormous considering the life of the tape media, real There are無KUNARI.
Once in the past, RAID5 HDD configuration when two cars crashed at the same time, the backup of a few months ago ... I was getting myself in a situation that IMASHI think the best way to get a daily backup However, now we have settled down in this way.
Backup (dump)
Original server and the backup is as follows. ns# df
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad0s1a 1012974 153114 778824 16% /
devfs 1 1 0 100% /dev
/dev/ad0s1f 2025860 9122 1854570 0% /home
/dev/ad0s1d 6090094 2420298 3182590 43% /usr
/dev/ad0s1e 1012974 34662 897276 4% /var
Mount the device to store the backup data
Memory in the USB-in SCSI hard drive, the IDE-HDD to the primary-slave繋GIMASHITA.Equipment connected to the device name in dmesg to verify.
ns# dmesg
.....
ad0: 11264MB <VMware Virtual IDE Hard Drive 00000001> at ata0-master UDMA33
ad1: 13312MB <VMware Virtual IDE Hard Drive 00000001> at ata0-slave UDMA33
.....
ns# dmesg|more
[q] to quit the show. (See man more)
Initialize and mount a backup destination
It is necessary only if the first device connected.Second time is unnecessary.
ns# sysinstall
ns# /stand/sysinstall
/stand/sysinstall: Command not found.
ns# which sysinstall
/usr/sbin/sysinstall
Typically, / usr / sbin so should I go to the path, sysinstall is a good reason only.
[Configure] and select [Enter] button.
[Fdisk] select the [Enter] button.
Select the backup destination device [Enter] button. (This is ad1)
[c] and press [Enter] button.
[165] as the [Enter] button.
[w] button.
Confirmation dialog will be displayed [Yes] and select [Enter] button.
[None] Select the [Enter] button.
[q] and press.
[Cancel] and select [Enter] button.
[Label] and select [Enter] button.
[c] and press [Enter] button.
[FS] remains have been selected by the [Enter] button.
Enter the Mount. (The / backup)
Directory is created automatically mount.
[w] button.
[Yes] and select [Enter] button.
[q] menu and press return, [Cancel] button.
[Exit] or [Cancel] button.
[Exit Install] to select [Enter] button.
dump run
Backup of each partition. Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad0s1a 1012974 153114 778824 16% / <=== /backup/root.dump
devfs 1 1 0 100% /dev <=== バックアップ不要
/dev/ad0s1f 2025860 9122 1854570 0% /home <=== /backup/home.dump
/dev/ad0s1d 6090094 2420298 3182590 43% /usr <=== /backup/usr.dump
/dev/ad0s1e 1012974 34662 897276 4% /var <=== /backup/var.dump
ns# dump -0uaLC 32 -f /backup/root.dump /
Option Description
0 DANPUREBERU 0 (full)Likewise, do any of the other three. (High capacity
u after a successful dump, / etc / dumpdates database updates.
to detect the end of a media. (Maybe it's no tape.)
L FreeBSD5.0 use the snapshot feature on board.
With this feature, the need to reduce single-user mode.
C 8-32 cache size (unit: MB) by a number between, improving performance dramatically.
However, L is an option if you do not, C is a good option is removed.
(More info)
f you specify a file for backup power.
/usr
etc. It takes a little time) ns# dump -0uaLC 32 -f /backup/var.dump /var
ns# dump -0uaLC 32 -f /backup/usr.dump /usr
ns# dump -0uaLC 32 -f /backup/home.dump /home
ns# ls -al /backup
total 2662822
drwxr-xr-x 3 root wheel 512 Jan 27 17:26 .
drwxr-xr-x 23 root wheel 512 Jan 27 17:02 ..
drwxrwxr-x 2 root operator 512 Jan 27 17:02 .snap
-rw-r--r-- 1 root wheel 9646080 Jan 27 17:26 home.dump
-rw-r--r-- 1 root wheel 155197440 Jan 27 17:16 root.dump
-rw-r--r-- 1 root wheel 2524764160 Jan 27 17:36 usr.dump
-rw-r--r-- 1 root wheel 35655680 Jan 27 17:26 var.dump
Crunch! For at that moment in the versions of the ftp site to download the livefs.iso LiveFS CD you create.
And "FreeBSD XX emergency boot disk" is written near the server (where glaring) on you.
And "FreeBSD XX emergency boot disk" is written near the server (where glaring) on you.
Restore (restore)
We verify the following configurations.Start HDD ad0
- New server (the server boot disk OS What matters is not installed)
- Above the primary-slave server with the backup data to connect the IDE-HDD
The backup data is stored HDD ad1
Other needs LiveFS CD
Start in LiveFS CD
First, LiveFS CD into the server to start.(CD does not start if the BIOS is calm Let's review)
If you are good at Japanese,
[110 Japan]
and select [Enter] button. [PageUp]
7 times, [↓] 4 is quick and times) [Japanese 106 keymap]
because I have been selected, as [Enter] button. HDD startup initialization (create partition slice)
[Configure] and select [Enter] button.[Fdisk] select the [Enter] button.
Select the boot device [Enter] button. (Here is ad0)
Please do not specify a device that is not backed up data is stored.
[c] with the number that appears and press [Enter] button.
[165] as the [Enter] button.
[q] and press.
[Standard] and select [Enter] button.
[Cancel] to return to the menu and press.
[Label] and select [Enter] button.
[c] and then press.
Root (/) to specify the amount assigned to a partition. (Here is 1GB)
Old server (original backup) may have fewer problems than. dd and the problem is not unlike many minutes.
[FS] remains have been selected by the [Enter] button.
Enter the Mount (/), [Enter] button.
Similarly, [c] to set the swap button.
This is the amount of memory that is mounted on the new server is about good times. (Here is 1GB)
[Swap] select the [Enter] button.
Similarly, [c] by pressing the
/var
to specify the amount to allocate. (Here is 1GB) Old server (original backup) may have fewer problems than. dd and the problem is not unlike many minutes.
[FS] remains have been selected by the [Enter] button.
Enter the Mount (/
/var
button. Similarly, [c] by pressing the
/usr
and then assigned to the specified capacity. (Here is 4GB) Old server (original backup) may have fewer problems than. dd and the problem is not unlike many minutes.
/ home partition and do not create configuration in / usr割RI当TETAI if all the remaining space to the left of the displayed numbers do not specify the amount [Enter] button.
[FS] remains have been selected by the [Enter] button.
Enter the Mount (/
/usr
button. Similarly, [c] all the space left by pressing the /
/home
assigns. Do not change the number that appears [Enter] button.
/ home partition is not required if this work is unnecessary.
[FS] remains have been selected by the [Enter] button.
Enter the Mount (/
/home
button. You will like this.
I do not like, select the partition [d] can be deleted by pressing the, please re-set.
If [w] button.
Confirmation dialog will be displayed [Yes] and select [Enter] button.
[q] menu and press return, [Cancel] and select [Enter] button.
Start Fixt
[Fixit] select the [Enter] button.[CDROM / DVD] to select [Enter] button.
Run fixit.
Device partition you just created (ad0s1a ~ ad0s1f) Make sure you are registered.
Fixit# ls /dev
Partition you just created the / mnt
/mnt
located below. Fixit# ls /mnt
.snap/ dev/ home/ usr/ var/
Mount the HDD with the backup data
With backup data in order to mount the HDD / mntbk/mntbk
a directory. Fixit# mkdir /mntbk
Fixit# _
ad1s1 c of c for, please see here.
Fixit# mount /dev/ad1s1c /mntbk
Fixit# _
start restore
ルート( / )をrestore
Fixit# cd /mnt
Fixit# restore -rf /mntbk/root.dump
/varをrestore
Fixit# cd /mnt/var
Fixit# restore -rf /mntbk/var.dump
/usrをrestore
Fixit# cd /mnt/usr
Fixit# restore -rf /mntbk/usr.dump
/homeをrestore
Fixit# cd /mnt/home
Fixit# restore -rf /mntbk/home.dump
In many cases, usr and restore a large error in the following.
Fixit# cd /mnt/usr
Fixit# restore -rf /mntbk/usr.dump
/: write failed, filesystem is full
restore: /tmp//rstdir1233044785: cannot write directory database: No space left on device
Try making space in /tmp/, or set environment variable TMPDIR
to an alternate location with more disk space.
Fixit# _
If so, the following method to change the TMP again please restore directory.
Fixit# mkdir /mntbk/tmp
Fixit# TMPDIR=/mntbk/tmp
Fixit# export TMPDIR
TMP here to create a directory means that you use.
After this, the need is some SEMARA / mntbk / tmp if you delete the directory, run the command will prevent almost all.
In this case, as follows: Replace the TMP directory.
Fixit# TMPDIR=/tmp
Fixit# export TMPDIR
Rewriting fstab
It is not necessary to rewrite work, let's check.The difference between the order of the partition created, led to a situation that does not start, I caught two days ...
Make sure to mount the current situation.
Fixit# df
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/md0 4175 2449 1726 59% /
devfs 1 1 0 100% /dev
/dev/ad0s1a 1012974 153114 778524 16% /mnt
devfs 1 1 0 100% /mnt/dev
/mnt/dev/ad0s1f 8122034 9426 7462846 0% /mnt/home
/mnt/dev/ad0s1e 4058062 2434140 1299278 65% /mnt/usr
/mnt/dev/ad0s1d 1012974 34750 897180 4% /mnt/var
/dev/acd0 226150 226150 0 100% /dist
/dev/ad1s1c 13198878 2662822 9480146 22% /mntbk
Then open your fstab.
Fixit# vi /mnt/etc/fstab
# Device Mountpoint FStype Options Dump Pass#
/dev/ad0s1b none swap sw 0 0
/dev/ad0s1a / ufs rw 1 1
/dev/ad0s1f /home ufs rw 2 2
/dev/ad0s1d /usr ufs rw 2 2
/dev/ad0s1e /var ufs rw 2 2
/dev/acd0 /cdrom cd9660 ro,noauto 0 0
I notice the differences underlined.
Device name "ad0s1e" and "ad0s1d" have not been mounted in the reverse name.
If you like this, "/ mnt / etc / fstab" opens in the editor, please save corrected.
That's it!
LiveFS CD without a rise to restart.
Aftertreatment
When you perform a restore, the current directory of each partition will create a file called restoresymtable.This is what will be required to restore an incremental backup, restore and remove you when you are finished.
ns# ls /
.cshrc boot entropy mnt sys
.profile cdrom etc proc tmp
.snap compat home rescue usr
COPYRIGHT dev lib restoresymtable var
backup disk2 libexec root
bin dist media sbin
ns# rm /restoresymtable
ns# rm /var/restoresymtable
ns# rm /usr/restoresymtable
ns# rm /home/restoresymtable
At this
Long stop in the following message when you try to start the restore server.
Configuring syscons: keymap blanktime
Can not partition out the following message:
Unable to find device node for /dev/ad0s1b in /dev!
The creation of filesystems will be aborted.
Fdisk menu [w] is押SAZU, [q] and press only, Label from the end of the set, the last in the Label menu [w] button.
fails in sysinstall Fdisk Label
Have experienced many times during the verification.Fdisk Label in sysinstall please refer to fail.
One Response to "Backup & Restore (dump & restore)"
January 30th, 2009 at 1:07 PM
[...] Configuring syscons: keymap blanktime out the display, stop time, then sendmail is invoked because the wait for a timeout to not start correctly. DNS, and network around見直SHIMASHOU. If I do, dump & restore of VMware testing encounter this problem while on the go, because he was the wrong network adapter settings ... [...]