免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1320 | 回复: 2
打印 上一主题 下一主题

备份与恢复 linux [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-12-14 20:46 |只看该作者 |倒序浏览
备份:
1) 挂接一块介质好的盘
2) kudzu
3) fdisk -l
Disk /dev/hda: 40.0 GB, 40027029504 bytes
255 heads, 63 sectors/track, 4866 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1       653   5245191    7  Linux
/dev/hda5           654       666    104359+  83  swap

   Device Boot    Start       End    Blocks   Id  System

4) 按照 /dev/hda, 为/dev/hdc划一样的分区
5) fdisk -l
Disk /dev/hda: 40.0 GB, 40027029504 bytes
255 heads, 63 sectors/track, 4866 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1       653   5245191    7  Linux
/dev/hda3           654       666    104359+  83  swap

   Device Boot    Start       End    Blocks   Id  System
/dev/hdc1             1       653   5245191    7  Linux
/dev/hdc3           654       666    104359+  83  swap

6) toggle a bootable flag on /dev/hdc1
7) fdisk -l /dev/hdc

Disk /dev/hda: 40.0 GB, 40027029504 bytes
255 heads, 63 sectors/track, 4866 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes


   Device Boot    Start       End    Blocks   Id  System
/dev/hdc1    *         1       653   5245191    7  Linux
/dev/hdc3           654       666    104359+  83  swap

8) mount /dev/hdc1 /mnt

9) df -k
文件系统               1K-块        已用     可用 已用% 挂载点
/dev/hda1              6190664   3310424   2565772  57% /
none                    192264         0    192264   0% /dev/shm
/dev/hdc1              6190664   2424   2565772  1%     /mnt

10) dump -0uf - /|(cd /mnt; restore -xaf -)

after dump/restore finish, setup grub on /dev/hdc

11) grub
> root (hd0,0)
> setup (hd0)
> quit

don't forget change fstab file, and grub.conf file
12) change /mnt/etc/fstab, vi /mnt/etc/fstab
LABEL=/boot             /boot                   ext3    defaults        1 2 -->
/dev/hdc1                /boot                   ext3    defaults        1 2

13) change /mnt/boot/grub/grub.conf, vi /mnt/boot/grub/grub.conf
title Red Hat 9
        root (hd0,0)
        kernel /vmlinuz-2.4.20-8 ro root=LABEL=/ --> kernel /vmlinuz-2.4.20-8 ro root=/dev/hdc1
        initrd /initrd-2.4.20-8.img

14) reboot

if the original disk is crashed, replace it with the good one and boot server.

ok!

论坛徽章:
0
2 [报告]
发表于 2005-12-14 21:59 |只看该作者
不错,收藏了,不过能否再问一句,是否可以用dd直接将磁盘复制到另一磁盘,是不是会更快些!

论坛徽章:
0
3 [报告]
发表于 2005-12-14 22:54 |只看该作者
不错,我也试试
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP