分享
 
 
 

Linux下的各种有效的备份方法汇总

王朝system·作者佚名  2008-05-19
窄屏简体版  字體: |||超大  

一. 在单个服务器上的备份

最常见的备份方法是在命令行上用经典的备份程序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: href="http://www.redhat.com/support/docs/faqs/rhl_general_faq/FAQ.html"target="_blank"http://www.redhat.com/support/docs/faqs/rhl_general_faq/FAQ.html)

There are excellent references in the ZIP HOWTOs at href="http://www.redhat.com/mirrors/LDP."target="_blank"http://www.redhat.com/mirrors/LDP.

Also, there is a Zip HOWTO at:

target="_blank"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 Zipdrive 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 Zipdrive.

For more information, check target="_blank"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 aremounting it as partition 4 instead of 1. An example would be hdc4. The reason for this is thatthe 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 totalk to NetWare. This article tells you how a Linux box can access files on a Novellserver 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 protocol. As the Linux kernel has a completely newnetwork implementation compared to other operating systems like Unix, it supports a range of non-TCP/IP protocols including the IPX protocol. Kernels 2.x onwards have built-in IPX support. The Red Hat Linux distributed on our CD-ROM has it too. The Linux kernelsupports the IPX protocol only. It does not, yet, support protocols such as IPX/RIP, SAP, orNCP.

The first step is to configure your IPX interfaces.

Login as root

Type ipx_configure--auto_primary= on --auto_interface=on

Wait for a minute and type cat /proc/net/ipx_interface. You should see something like:

Network Node_Address Primary Device Frame_Type

000000E1 00A0C925164A Yes eth0 802.2

4.Type slist. You should see a list of the NetWare servers on your LAN.

Known NetWare File Servers Network Node Address

D74_SERVER 00000D74 00000000001

If you don't, wait for a few minutes and retry. If the slist command displays amessage like: ncp_connect: Invalid argument, then your kernel probably does not support IPX.

Check that you have actually booted off the appropriate kernel. When you boot youshould see messages about IPX and ncpfs in system startup messages. If the slist commanddoes not list all of your fileservers, then you may need to use the manual networkconfiguration method. Type cat /proc/net/ipx_interface. You should see something like:

At this point, your Linux box is setup for IPX networking. Check if your kernel has support for NetWare NCP file system. The default Red Hat kernel has NCP file system support. You simply have to load the ncpfs module /usr/sbin/lib/modules/2.0.32/fs/ncpfs.0.

You can also add the line to your local file to load it automatically at the boottime.

Once that is done

Login as root (only root can mount NetWare volumes).

Type mkdir/netware to create a directory for mounting the NetWare volumes.

Type ncpmount -S D74_SERVER -U user10 /netware. You will be prompted for a passwordfor user10.

At this point your server is mounted on /netware. The volumes are sub-directoriesunder /netware. So the SYS volume would be /netware/sys and the DATA volume would be/netware/data.

If you only want to mount a single volume, you can use ncpmount -S D74_SERVER -V sys-U user10 /netware. This will mount only the SYS volume to /netware.

When you finish using the Net-Ware volume, you can unmount usingncpumount/netware.

Tip: You don't need to manually unmount NetWare volumes when you shutdown.

When you want to share the mounted NetWare volume among other Linux users, you need to understand file permissions. The NetWare file system doesn't support user IDs andgroup IDs for directories. So all files and directories on the mounted directory have the permissions as the directory where it was mounted. For example, if you type ls-ld/netware, drwxrwxr-x 1 root root 512 Nov 24 1960 /netware is what you get.

So, all the NetWare files will have the above file permissions.

If you want non-root users to mount NetWare volumes, ncpmount command must be SetUserid Root, so you would need to type chmod 4755 ncpmount

Simplifying mounting of volumes

There is another way of configuring NetWare mounts-by creating a .nwclient file inyour home directory. This file contains details of temporary or user specific NetWare mountsthat would be performed regularly. It allows you to store the details of mounts so that you canrecreate them without specifying all details each time. Its format is quite straightforward:

# The first entry is the 'preferred server' entry and is

# used whenever you do not specify a server explicitly.

#

# User USER01 login to D74_SERVER files

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有