文件系统的管理方法和xfs文件系统备份恢复-v16.pdf
《文件系统的管理方法和xfs文件系统备份恢复-v16.pdf》由会员分享,可在线阅读,更多相关《文件系统的管理方法和xfs文件系统备份恢复-v16.pdf(17页珍藏版)》请在文库网上搜索。
1、otxuegod63 # echo set nu /root/.vimrc rootxuegod63 # vim /etc/passwd #发现默认已经有行号了 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 3、vim 打开多个文件方法 1:以上 下形势,打开两个文档 rootxuegod63 # vim -o /etc/passwd /etc/hosts 注:输入 :qa 一次退出所有打开的文件 方法
2、 2:以左右方式打开两个文档 rootxuegod63 # vim -O /etc/passwd /etc/hosts 注:ctrl+ww 在两文档之间进行切换编辑。大写 O 左右分屏,小写的 o 上下分屏 比较两个文件内容 rootxuegod63 # cp /etc/passwd mima.txt rootxuegod63 # echo aaa mima.txt 方法 1: rootxuegod63 # diff /etc/passwd mima.txt 40a41 aaa 方法 2: rootxuegod63 # vimdiff /etc/passwd mima.txt 学神IT 学神I
3、T 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 4.1.6 其它编辑器 nano 编辑器 emacs 编辑器 GHOME 编辑器 gedit 例: rootxuegod63 # gedit /etc/passwd 4.2 实战:在 Centos6/RHEL6 上恢复 ext4 文件系统下误删除的文件 rootxuegod63 # rm -rf / #这个可以执行成功吗? 执行不成功的, rm: 在/ 进行递归操作十分危险
4、 rm: 使用 -no-preserve-root 选项跳过安全模式 rootxuegod63 # rm -rf /* #这个可以执行成功。 ext4 文件系统上删除文件,可以恢复: extundelete ,ext3 恢复使用:ext3grep windows 恢复误删除的文件: final data v2.0 汉化版 和 easyrecovery xfs 文件系统上删除文件,暂时没有太好的办法进行完全恢复,需要找专业数据恢复公司 扩展: Linux 文件系统由三部分组成:文件名,inode,block windows 也由这三部分组成。 a.txt -inode - block 文件名 存
5、放文件元数据信息 真正存放数据查看文件文件名: rootxuegod63 # cp /etc/passwd a.txt rootxuegod63 # ls a.txt a.txt 查看 inode 号:常识: 每个文件,有 一个 inode 号。 rootxuegod63 # ls -i a.txt 440266 a.txt 查看 inode 中的文件属性; 通过 stat 命令查看 inode 中包含的内容 rootxuegod63 # stat a.txt #查看 inode 信息: rootxuegod63 # ls -l a.txt -rw-r-r- 1 root root 1720
6、Oct 25 10:21 a.txt 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT block 块:真正存储数据的地方逻 辑删除: 为什么删除比复制快? 误删除文件后,第一件事要做什么? 你不心删除把存了几十年的大片删除了。 避免误删除的文件内容被覆盖。 如何避免?卸载需要恢复文件的分区或以只读的方式挂载 4.2.2 实战:在 ext4 文件系统上恢复被误删除的文件 下载 extundelete htt
7、p:/ 开源软件发布中心 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 准备测试分区:先添加一块硬盘 rootxuegod63 /# fdisk /dev/sdb #创建一个 sdb1 分区 WARNING: DOS-compatible mode is deprecated. Its strongly recommended to switch off the mode (command c) and
8、 change display units to sectors (command u). Command (m for help): p #查看现有分区表 Disk /dev/sda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512
9、bytes / 512 bytes Disk identifier: 0 x000b8b35 Device Boot Start End Blocks Id System /dev/sda1 * 1 26 204800 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 26 1301 10240000 83 Linux /dev/sda3 1301 1428 1024000 82 Linux swap / Solaris Command (m for help): n #创建一个新分区 Command actio
10、n e extended p primary partition (1-4) p #创建一个主分区 Selected partition 4 First cylinder (1428-2610, default 1428): Using default value 1428 Last cylinder, +cylinders or +sizeK,M,G (1428-2610, default 2610): +1G #指定分区大小 Command (m for help): w #保存 The partition table has been altered! Calling ioctl() t
11、o re-read partition table. 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT 学神IT WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at
12、 the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks. rootxuegod63 #reboot 或 rootxuegod63 # partx -a /dev/sdb #获得新分区表 扩展:如果在根下删除文件了,想恢复,怎么办? 方法 1: 立即断电,然后把磁盘以只读方式,挂 载到另一个电脑中进行恢复方法 2:把 extundelete 在虚拟机上(虚拟机系统要和服务器版本一样) , 提前安装好后再复制到 U 盘中,把 U 盘插入服务器,恢复时,恢复的文件要保存到 U 盘中, (不要 让恢复的数据写到
13、/下,那样会覆盖之前删除的文件) 使用新的分区表: rootxuegod63 /# mkdir /tmp/sdb1 #创建挂载点 rootxuegod63 # mkfs.ext4 /dev/sdb1 #格式化 rootxuegod63 # mount /dev/sdb1 /tmp/sdb1 #挂载 4.2.3 准备测试环境 复制一些测试文件,然后把这些文件再删除,然后演示恢复: rootxuegod63 # cp /etc/passwd /tmp/sdb1 rootxuegod63 # cp /etc/hosts /tmp/sdb1 rootxuegod63 # echo aaa a.txt
14、rootxuegod63 # mkdir -p /tmp/sdb1/a/b/c rootxuegod63 # cp a.txt /tmp/sdb1/a rootxuegod63 # cp a.txt /tmp/sdb1/a/b rootxuegod63 # touch /tmp/sdb1/a/b/kong.txt 安装 tree 命令: rootxuegod63 # rpm -ivh /mnt/Packages/tree-1.5.3-2.el6.x86_64.rpm rootxuegod63 # tree /tmp/sdb1 /tmp/sdb1/ a a.txt b a.txt c #空目录
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 文件系统 管理 方法 法子 以及 xfs 备份 恢复 v16