首页 > 代码库 > Linux文件备份
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.dumpDump date: Tue Sep 9 00:05:13 2014Dumped from: the epochLevel 0 dump of /boot on localhost.localdomain:/dev/sda1Label: /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 #常见的硬盘对拷
Linux文件备份
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。