CentOS Delete Files by mistake

Source: Internet
Author: User

Under CENTOS6: RM-RF/has been blocked.

Windows recover deleted files by mistake: Final data v2.0 and Easyrecovery
Removal of files on CentOS ext4 file system can restore Extundelete (using range EXT4 and previous ext series file types)
Extended:
The Linux file system consists of three parts: file name Inode block
To view the Inode method:
#ls-I. FileName
#stat filename
Question: Why is it faster to delete a file than to copy it?
Delete: essentially delete the inode.
Copy: Operate the block.
[email protected] data]# Touch a.txt
[Email protected] data]# ls-i
A.txt 100663744 Test
[email protected] data]# CP a.txt. /
[Email protected] data]# CD.
[Email protected]/]# ls-i a.txt
347 A.txt
Watch the point. The inode of the replication process has changed. The position is bound to change.
CentOS 6 deleted files by mistake: What should I do?
1. Avoid overwriting the contents of the file. (Uninstall the file partition that needs to be recovered.) or mounted in a read-only manner. )
2.extundelete software Download Center http://sourceforget.net/(open source software Release center)
Source Installation Method:
Tar
./configure
Make && make install

After mistakenly deleted, first umount and then recover with Extundelete
#umount/dev/sdax (if the current operation directory is in the mount point directory, to switch to another directory, or not uninstall)
# Extundelete/dev/sdax--inode 2 (view deleted files via inode tag)
# Extundelete/dev/sdax--restore-all (Full recovery)
# Extundelete/dev/sdax--restore-file filename (recover files)
# Extundelete/dev/sdax--restore-directory directoryname (Recover directory)
The disadvantage of this method is that you cannot recover empty files and directories for the highest version of EXT4 Ext series

The CENTOS7 is used with the system's own xfsdump and Xfsrestore. The file system recovered here is XFS
The principle is: first through Xfsdump backup. Then use Xfsrestore to restore the backup.
The advantage is that you don't have to unload the mount point. All of my operations are carried out under the mount point, with no problem at all.
Because it was a full backup, it can be restored even if it is an empty file or an empty directory.
The disadvantage is that you need to back up early.
Instance:
[Email protected] data]# df-h
/dev/sda2 24G 33M 24G 1%/data
[[email protected] data]# ls
A.txt Test
[[email protected] data]# xfsdump-f/home/jflinux/dump_data/data (mount point that parameter must not be added/)
You will be prompted to enter a 2 name. (It should be for the sake of distinction.) I don't have input or I can do it. The first one is dump_sda2.
The second media0, where the first dump is a prefix, can be named after the actual partition of the hard disk.
[Email protected] data]# RM-RF *; Ls-a (The reason here is using the-a parameter is to tell you that I'm not kidding you)
. ..
[Email protected] data]# xfsrestore-f/home/jflinux/dump_data/data
Take a look: process information is generally not error-free.
[[email protected] data]# ls
A.txt Test

This article is from the "Shong Linux Tour" blog, make sure to keep this source http://12042068.blog.51cto.com/12032068/1892663

CentOS Delete Files by mistake

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.