1、dump ext2/3/4 filesystem backup
dump -f 指定备份生成的文件 要备份的设备
[root@fedora14 mnt]# dump -f /mnt/backup/ftp.back /dev/lvmtest/ftp DUMP: Date of this level 0 dump: Fri Apr 13 14:58:27 2012 DUMP: Dumping /dev/lvmtest/ftp (an unlisted file system) to /mnt/backup/ftp.back DUMP: Label: none …… DUMP: DUMP IS DONE [root@fedora14 mnt]#
2、restore 恢复数据
删除数据
[root@fedora14 mnt]# mkfs.ext4 /dev/lvmtest
……
[root@fedora14 mnt]# mount /dev/lvmtest/ftp /mnt/ftpdata/进入到要恢复的目录
[root@fedora14 mnt]# cd /mnt/ftpdata
读取备份文件并恢复
[root@fedora14 ftpdata]# restore -rf /mnt/backup/ftp.back restore: ./lost+found: File exists [root@fedora14 ftpdata]#
打包工具tar
tar -cf archive.tar foo bar
# Create archive.tar from files foo and bar.
tar -tvf archive.tar
# List all files in archive.tar verbosely.
tar -xf archive.tar
# Extract all files from archive.tar.
-j, --bzip2 filter the archive through bzip2
-z, --gzip, --gunzip, --ungzip filter the archive through gzip
-p 保留备份数据的原本权限与属性
-P 保留绝对路径 ,也就是允许路径中含有根目录
-t 查看压缩包中的文件
使用 gzip 算法,压缩文件
[root@fedora14 ftpdata]# tar -czvf /mnt/backup/ftpdata.tar.gz ./
解压所有文件,到当前文件夹
tar -zxvf /mnt/backup/ftp.tar.gz
解压到指定目录 使用 -C 选项
[root@fedora14 mnt]# tar -zxvf /mnt/backup/ftp.tar.gz -C /mnt/temp/
查看压缩包的文件
[root@fedora14 mnt]# tar -tzvf /mnt/backup/ftp.tar.gz
解压单个文件到指定目录
[root@fedora14 mnt]# tar -zxvf /mnt/backup/ftp.tar.gz "./host.conf" -C /mnt/temp
[root@fedora14 mnt]# tar -zxvf /mnt/backup/ftp.tar.gz "./host.conf" "yp.conf" -C /mnt/temp