Linux Backup use of dd
2014-02-22 11:36
183 查看
The Backup Process
No matter what operating system you are using, or what sort of database you are administering, it is absolutely necessary to back up the server frequently. There are many software products you can download—some free and somefor a fee—that will handle backups quite eloquently. However, there are also shell commands that will back up your drives for you. And, of course, you can always write these as a script (which we will be covering in
Chapter 13, “Shell Scripting”) and then schedule that script, and thus create your own backup utility.
You can use the Linux dd command to create full or partial hard disk back-ups. The following example illustrates a full backup from the source disk, labeled
/dev/hda, to another target disk, labeled /dev/hdb, on the same system.
dd if=/dev/hda of=/dev/hdb
The
if represents inputfile and is not a logical if. The of represents output file. This code literally says to take
hda as the input file and write it to hdb. It’s not the most elegant backup solution, but it’s really easy.
The dd command has other options. For example, you may want to make an image of a partition. This is very common in corporate environments where one gets one workstation configured as needed and then makes an image of that
to install on additional workstations. It is also often a good idea if you need to set up a test server, to set up an actual image of the live machine, so you can ensure that the test server is a good match for the live server. Making an image, like copying
the drive, is very easy to do, and it takes just one line of code:
dd if=/dev/hda of=~/hdadisk.img
You can also use the dd command to restore a hard disk image as follows:
dd if=hdadisk.img of=/dev/hdb
Now you may want to copy the partition to a drive on another machine. This is a bit more complicated, but not overly so.
The netcat command can be used to clone or copy a hard drive. The following is the general format of the
netcat command:
nc -l -p <portnumber> | dd of=/dev/hda
Then on the source machine, you can send the contents of the disk to the target PC:
dd if=/dev/hda | nc <ipaddresstarget> <portnumber>
An example of these two commands is given here:
dd if=/dev/hda | nc 192.168.0.100 40
As you can see, backing up the hard drive is quite easy. There is really no excuse for administrators not to have their servers backed up at least daily. And high traffic database servers, such as one finds in ecommerce distributions,
are often backed up hourly.
相关文章推荐
- Linux 下的dd命令使用详解以及dd if=/dev/zero of=的含义
- How to use "man" effectively in the development of Linux
- Linux Backup: Hard Disk Clone with "dd"
- dd if=/dev/zero of=的含义是什么?Linux 下的dd命令使用详解
- dd if=/dev/zero of=的含义是什么?Linux 下的dd命令使用详解
- Use Dump and Restore for Linux Backup
- About the Use of Dot-Slash in Commands(Linux中点斜线的使用)
- dd if=/dev/zero of=的含义是什么?Linux 下的dd命令使用详解
- dd if=/dev/zero of=的含义是什么?Linux 下的dd命令使用详解
- dd if=/dev/zero of=的含义是什么?Linux 下的dd命令使用详解
- xmpp Use of undeclared identifier 'ddLogLevel'
- 21 of the Best Free Linux Backup Software
- dd if=/dev/zero of=的含义是什么?Linux 下的dd命令使用详解
- Linux 下的dd命令使用详解以及dd if=/dev/zero of=的含义
- use JDBC connact postgres on os of linux and windows
- dd if=/dev/zero of=的含义是什么?Linux 下的dd命令使用详解
- full backup of Linux OS
- 160 You want to use the automatic management of backup and recovery operations features for your dat
- the diary of how to backup one more files in linux
- dd if=/dev/zero of=的含义是什么?Linux 下的dd命令使用详解