马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
欢迎大家来到仓酷云论坛!1.装置软件(extundelete依附于体系的e2fsprogs三个软件包)
[root@redhat1home]#mkdir/mnt/cdrom--创立光盘挂载目次
[root@redhat1home]#mount/dev/cdrom/mnt/cdrom--挂载光盘
mount:blockdevice/dev/sr0iswrite-protected,mountingread-only
[root@redhat1home]#vim/etc/yum.repos.d/base.repo--设置装备摆设体系的当地源
[base]
name=base
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-REDHAT-6
[root@redhat1home]#yuminstalle2fs*--装置extundelete软件的依附包
[root@redhat1home]#rpm-aq|grepe2fs--检讨软件包能否装置
e2fsprogs-devel-1.41.12-14.el6.i686
e2fsprogs-libs-1.41.12-14.el6.i686
e2fsprogs-1.41.12-14.el6.i686
[root@redhat1home]#wgethttp://nchc.dl.sourceforge.net/project/extundelete/extundelete/0.2.4/extundelete-0.2.4.tar.bz2--下载extundelete软件包
[root@redhat1home]#tarxvfextundelete-0.2.4.tar.bz2--解压软件包
[root@redhat1home]#cdextundelete-0.2.4--进入软件包
[root@redhat1ext3grep-0.10.2]#./configure--prefix=/usr/local/extundelete&&make&&makeinstall--装置软件
[root@redhat1ext3grep-0.10.2]#ll/usr/local/|grepext--检查软件装置胜利
drwxr-xr-x.3rootroot4096Dec217:24extundelete
[root@redhat1ext3grep-0.10.2]#
2.创立块装备并挂载体系
[root@redhat1home]#ddif=/dev/zeroof=123bs=1Mcount=100--在home目次下新建一个块装备123
100+0recordsin
100+0recordsout
104857600bytes(105MB)copied,0.634943s,165MB/s
[root@redhat1home]#mkfs.ext4123--格局化块装备
mke2fs1.41.12(17-May-2010)
123isnotablockspecialdevice.
Proceedanyway?(y,n)y--输出y肯定
Filesystemlabel=
OStype:Linux
Blocksize=1024(log=0)
Fragmentsize=1024(log=0)
Stride=0blocks,Stripewidth=0blocks
25688inodes,102400blocks
5120blocks(5.00%)reservedforthesuperuser
Firstdatablock=1
Maximumfilesystemblocks=67371008
13blockgroups
8192blockspergroup,8192fragmentspergroup
1976inodespergroup
Superblockbackupsstoredonblocks:
8193,24577,40961,57345,73729
Writinginodetables:done
Creatingjournal(4096blocks):done
Writingsuperblocksandfilesystemaccountinginformation:done
Thisfilesystemwillbeautomaticallycheckedevery27mountsor
180days,whichevercomesfirst.Usetune2fs-cor-itooverride.
[root@redhat1home]#mkdir/mnt/123--新建块装备挂载的目次
[root@redhat1home]#mount123/mnt/123-oloop--将块装备123挂载到/mnt/123中
[root@redhat1home]#df-TH--检查目次能否挂载
FilesystemTypeSizeUsedAvailUse%Mountedon
/dev/mapper/VolGroup-lv_root
ext420G3.8G16G20%/
tmpfstmpfs262M0262M0%/dev/shm
/dev/sda1ext4508M32M451M7%/boot
df:`/mnt/cdrom:Nosuchfileordirectory
/dev/sr0iso96603.2G3.2G0100%/mnt
/home/123ext4102M5.8M91M7%/mnt/123--装备已挂载
3.添加和删除文件
[root@redhat1home]#cp-a/etc/passwd/etc/shadow/etc/group/mnt/123/--将文件挪动到装备中
[root@redhat1~]#ll/mnt/123/--检查能否有文件
total19
-rw-r--r--.1rootroot712Dec214:39group
drwx------.2rootroot12288Dec414:07lost+found
-rw-r--r--.1rootroot1509Dec214:39passwd
----------.1rootroot976Dec214:39shadow
[root@redhat1home]#sync--文件同步一下
[root@redhat1home]#rm-rf/mnt/123/passwd/mnt/123/shadow--删除文件
[root@redhat1home]#sync--文件同步一下
[root@redhat1home]#umount/mnt/123--卸载装备
4.恢复适才删除的文件
cd/usr/local/extundelete/bin--进入软件目次
[root@redhat1bin]#./extundelete--ls--inode2/home/123--检查块装备/home/123的文件具体信息
./extundelete:unrecognizedoption--ls
NOTICE:Extendedattributesarenotrestored.
Loadingfilesystemmetadata...13groupsloaded.
Group:0
Contentsofinode2:
0000|ed41000000040000fec69e5258c79e52|.A.........RX..R
0010|58c79e52000000000000030002000000|X..R............
0020|00000000050000001001000000000000|................
0030|00000000000000000000000000000000|................
0040|00000000000000000000000000000000|................
0050|00000000000000000000000000000000|................
0060|00000000000000000000000000000000|................
0070|00000000000000000000000000000000|................
InodeisAllocated
Filemode:16877
Low16bitsofOwnerUid:0
Sizeinbytes:1024
Accesstime:1386137342
Creationtime:1386137432
Modificationtime:1386137432
DeletionTime:0
Low16bitsofGroupId:0
Linkscount:3
Blockscount:2
Fileflags:0
Fileversion(forNFS):0
FileACL:0
DirectoryACL:0
Fragmentaddress:0
Directblocks:272,0,0,0,0,0,0,0,0,0,0,0
Indirectblock:0
Doubleindirectblock:0
Tripleindirectblock:0
Filename|Inodenumber|Deletedstatus
.2
..2
lost+found11
passwd12Deleted--Delete就是我们适才删除的文件
shadow13Deleted
group14
[root@redhat1bin]#./extundelete--restore-filepasswd/home/123--用文件名来恢复文件
NOTICE:Extendedattributesarenotrestored.
Loadingfilesystemmetadata...13groupsloaded.
Loadingjournaldescriptors...27descriptorsloaded.
Successfullyrestoredfilepasswd--恢复胜利
[root@redhat1bin]#./extundelete--restore-inode13/home/123--用节点号来恢复文件
NOTICE:Extendedattributesarenotrestored.
Loadingfilesystemmetadata...13groupsloaded.
Loadingjournaldescriptors...27descriptorsloaded.
[root@redhat1bin]#./extundelete--restore-all/home/123--恢复一切删除的文件
NOTICE:Extendedattributesarenotrestored.
Loadingfilesystemmetadata...13groupsloaded.
Loadingjournaldescriptors...27descriptorsloaded.
Searchingforrecoverableinodesindirectory/...
2recoverableinodesfound.
Lookingthroughthedirectorystructurefordeletedfiles...
0recoverableinodesstilllost.
[root@redhat1bin]#llRECOVERED_FILES/--检查一切恢复的文件
total20
drwxr-xr-x.2rootroot4096Dec316:21123
-rw-r--r--.1rootroot976Dec414:18file.13
-rw-r--r--.1rootroot1509Dec414:16passwd
-rw-r--r--.1rootroot1509Dec414:20passwd.v1
-rw-r--r--.1rootroot976Dec414:20shadow
[root@redhat1bin]#
!!!!!!好了半途而废,也祝人人胜利
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的小伙伴们! |