当前位置: 首页 > 图文教程 > 操作系统 > Unix/Linux > Linux下的各种备份方法汇总

Unix/Linux
Linux下Socket连接超时的一种实现方法
谈一谈至关重要的Linux系统Swap交换区
Linux系统GRUB引导单用户模式三种方式
实例解析:虚拟机中Lvs的负载均衡实验
实用技巧:DOS文件转换成UNIX文件格式
Linux系统多进程查看及调配管理方法
非常实用 Linux系统开机提速我有绝招!
Linux系统中的文件目录结构介绍(表)
Linux操作系统如何完美装载Windows分区
Linux系统访问Windows分区FAT32和NTFS
高手进阶 Linux系统下MTD/CFI驱动介绍
新手看招 Linux系统的参数配置优化技巧
Xmanager 远程登陆Linux系统后配置Xdm
新手学堂:Emacs只启动一个进程的方法
小技巧 在Linux桌面上建立“我的文档”
Linux slab 分配器详解
拨开云雾:Lastlog文件不断变大的原因
使用ImageMagick 的提示与技巧
认识Linux操作系统中的播客客户端
Linux系统中显示设备配置工具介绍

Unix/Linux 中的 Linux下的各种备份方法汇总


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-01   浏览: 119 ::
收藏到网摘: n/a

  一. 在单个服务器上的备份
最常见的备份方法是在命令行上用经典的备份程序tar .是最通用最简单也最有用的备份工具
# tar cvf  backup.tar /etc (备份整个etc 目录及下面的所有子目录和文件)
#gzip -9 backup.tar  (得到最大的压缩率)

你可以把备份后的backup.tar.gz转存到其它介质,CDR/CDRW光盘,私人信箱等

二. 跨服务器的备份
1. 利用ssh/scp功能直接把文件或目录从一台服务器拷贝到另一台服务器上。
参见文章荟萃中另一篇文章《如何不用密码进行ssh/scp》
2. 利用smbmount先mount另一台服务器上的Samba共享目录到这台机器的某目录下,直接进行cp操作。
 如:[root@sh/mnt]# smbmount //sh3/pub /mnt/sh3 -N
将服务器sh3上的Samba共享目录pub mount到服务器sh上的/mnt/sh3目录下面。且不提示密码
3.  利用NFS功能进行服务器间的备份,有一定程序的安全性问题,在此不多做介绍。

三. 备份到其它介质
你可以备份到磁带,ZIP drive , JAZ drive
1. 备份到磁带
假设你已经设置并安装好了磁带机,本人用的是HP SuitStore 500,外置,SCSI接口。
1. 查看磁带中的目录  tar tvf /dev/st0 
2. 查看磁带内容并输出到一个文件中 tar tvf /dev/st0 > stlist 
3.  备份档案  tar cvf /dev/st0 /etc 
 tar cvf /dev/st0 /etc/hosts /boot /etc/smb.conf 
4. 按指定的文件内容或目录释放出磁带中的相应文件
tar -T stlist -xvf /dev/st0 
 tar xvfz /dev/st0 /etc/ 
6. 附加个别文件到磁带后面
 tar -r /etc/hosts /etc/passwd -vf /dev/st0 
7. 从现有磁带中删除一个或几个文件
 tar --delete etc/hosts -vf /dev/st0 
8. 附加一个现有的tar文档到磁带后面 
 tar -A pamd.tar -vf /dev/st0
2. 备份到JAZ 驱动器
7.3 Getting a Zip drive to work 
(参见Redhat FAQ: http://www.redhat.com/support/docs/faqs/rhl_general_faq/FAQ.html )
There are excellent references in the ZIP HOWTOs at http://www.redhat.com/mirrors/LDP. 

Also, there is a Zip HOWTO at: 

http://www.linuxdoc.org/HOWTO/HOWTO-INDEX-3.html

In Red Hat Linux 6.1, there are a few extra steps needed to get a parallel port Zip drive to work: 

Edit your /etc/conf.modules and add: 

        alias parport_lowlevel parport_pc
        alias scsi_hostadapter ppa
        
Then log in as root and run: 
modprobe ppa 

Some people have had problems if they daisy chain a Zip drive off of a chain with a 
printer on it. Currently, we recommend that you use either the printer or the Zip drive. 

For more information, check www.torque.net/paraport 

If you are having problems with an IDE Zip drive, here is further information: 

First check and make sure there is a disk in the drive. Also, make sure you are mounting
 it as partition 4 instead of 1. An example would be hdc4. The reason for this is that 
the Macintosh uses partition 4 for its data partition and has problems if data is on 
another partition. 

3备份到 JAZ 驱动器
假定JAQ驱动器为SCSI接口,把JAZ驱动器当作SCSI链上的一个存储设备即可。
四. 跨操作系统进行备份
1. 把Linux服务器上的数据资料备份到windows 95/98机器上
 假定一台windows机器jephe有一完全读写共享目录 data ,且密码为 secret ,现希望把Linux上的
文件备份到这个共享目录下,则先把这个共享可写目录mount到Linux下,再做普通的cp操作

附:在Linux上对Novell服务器上的数据进行备份:(http://www.pcquest.com/linux/netware.asp) 
NetWare And Linux

Making your Linux server talk to NetWare servers and printers 

As almost every office-LAN has a NetWare server, your desktop client must be able to talk
 to NetWare. This article tells you how a Linux box can access files on a Novell server 
and print to a Novell print queue.

Linux, by default, uses the IP network protocol for network communication. However, Novell 
NetWare uses the IPX network pr