Linux文件备份
1.tar -P是否保留根目录 -t查看压缩文件内容 -N 201401010备份日期以后
[root@localhost /]# tar -zcPf /tar/data2.tar.gz /etc/*.conf [root@localhost /]# cd tar/ [root@localhost tar]# ll 总计 80 -rw-r--r-- 1 root root 39051 09-08 23:42 data1.tar.gz -rw-r--r-- 1 root root 39046 09-08 23:43 data2.tar.gz
2.dump -0完全备份
3.restore恢复 -tf查看 -rf恢复
[root@localhost dump]# dump -0 -f /dump/data1.dump /dev/sda1 DUMP: Date of this level 0 dump: Tue Sep 9 00:05:13 2014 DUMP: Dumping /dev/sda1 (/boot) to /dump/data1.dump DUMP: Label: /boot DUMP: Writing 10 Kilobyte records DUMP: mapping (Pass I) [regular files] DUMP: mapping (Pass II) [directories] DUMP: estimated 6512 blocks. DUMP: Volume 1 started with block 1 at: Tue Sep 9 00:05:14 2014 DUMP: dumping (Pass III) [directories] DUMP: dumping (Pass IV) [regular files] DUMP: Closing /dump/data1.dump DUMP: Volume 1 completed at: Tue Sep 9 00:05:14 2014 DUMP: Volume 1 6560 blocks (6.41MB) DUMP: 6560 blocks (6.41MB) on 1 volume(s) DUMP: finished in less than a second DUMP: Date of this level 0 dump: Tue Sep 9 00:05:13 2014 DUMP: Date this dump completed: Tue Sep 9 00:05:14 2014 DUMP: Average transfer rate: 0 kB/s DUMP: DUMP IS DONE [root@localhost dump]#
[root@localhost boot]# restore -tf /dump/data1.dump Dump date: Tue Sep 9 00:05:13 2014 Dumped from: the epoch Level 0 dump of /boot on localhost.localdomain:/dev/sda1 Label: /boot 2 . 11 ./lost+found 16065 ./grub 16067 ./grub/grub.conf 16066 ./grub/splash.xpm.gz 16068 ./grub/menu.lst 16069 ./grub/device.map 16070 ./grub/stage1 16071 ./grub/stage2 16072 ./grub/e2fs_stage1_5 16073 ./grub/fat_stage1_5 16074 ./grub/ffs_stage1_5 16075 ./grub/iso9660_stage1_5 16076 ./grub/jfs_stage1_5 16077 ./grub/minix_stage1_5 16078 ./grub/reiserfs_stage1_5 16079 ./grub/ufs2_stage1_5 16080 ./grub/vstafs_stage1_5 16081 ./grub/xfs_stage1_5 17 ./initrd-2.6.18-348.el5.img 12 ./.vmlinuz-2.6.18-348.el5.hmac 13 ./System.map-2.6.18-348.el5 14 ./config-2.6.18-348.el5 15 ./symvers-2.6.18-348.el5.gz 16 ./vmlinuz-2.6.18-348.el5
[root@localhost boot]# restore -rf /dump/data1.dump
4.cp命令制作iso文件
[root@localhost boot]# cp /dev/cdrom /dump/linux.iso
[root@localhost boot]# [root@localhost boot]# mount -o loop /dump/linux.iso /mnt
5.dd命令 -if=输入设备 -of=输出设备
[root@localhost boot]# dd if=/dev/cdrom of=/dump/linux1.iso
[root@localhost boot]# dd if=/dev/sda of=/dev/sdb #常见的硬盘对拷
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。