Linux (centos7) recovery XFS file type

        XFS file system is an advanced journaling file system developed by SGI, XFS is very scalable and very robust. Fortunately, the SGI to be ported to Linux. In the linux environment. The latest version is currently available for the XFS file system version 1.2, can work well under the 2.4 kernel.

XFS is a Silicon Graphics, Inc. In the early 1990s development. It is still as SGI IRIX-based products (from workstations to supercomputers) of the underlying file system to use. Now, XFS can also be used for Linux. XFS for Linux arrival is exciting, first of all because it provides a robust, feature-rich and excellent file system for the Linux community, and this file system has the scalability to meet the most demanding storage demand   .

        Past versions are used Centos EXT file system, and Centos 7 XFS file system is used. When we accidentally deleted an important file on how to restore it to this document, this blog will mainly introduce how to back up data files with a recovery among XFS system.

        Here there are two major commands to use, xfs file system is for a complete recovery of the system partition, but for a single file for use with tar cp command is sufficient.

        xfsdump -f [specify the location to store the backup files] [want to back up files]

        xfsrestore -f [backup file location] [specify the recovery file location]

        Experimental environment: VMware14 

        System version: CentOS 7


        First we have to simulate a new partition system, which is adding a new disk format it to partition a system xfs.

        Linux system on a VMware virtual machine to add a hard drive, and then reboot. Because then reboot the system to recognize the newly added hard disk.

image.png

        First, using fdisk / dev / sdb command to enter the setting mode of the second block of the newly added disk.

image.png



        After re-entering the disk editing mode, type "n" to create a partition, enter "p" to create a primary partition, followed by the size of the set is not what you can directly enter, enter the last "w" to save and exit.

        image.png


        Then use mkfs.xfs / dev / sdb1 to the newly added partitions formatted with xfs file format, pay attention here, it must be xfs file format. Then mount / dev / sdb1 / mnt command to add a new partition to mount at the mnt directory, then we can write the data in it.

image.png



        Then in the partition which creates 15 folders and files with a data of "test.txt"

image.png


            Then use xfsdump -f / opt / dump_sdb / mnt command to back up sdb1 partition file to the / opt directory dump_sdb name for the name. please enter label for this dump session (timeout in 300 sec) meaning of this passage is to allow you to enter a session name, here the input file name on it. please enter label for media in drive 0 (timeout in 300 sec) meaning of this passage is to let you enter the file name of the backup disk is sdb.

        image.png

image.png


        Continued opt directory cd to find backup files has been generated, should take over the analog data is destroyed or deleted by mistake.

image.png


        To simulate the data is destroyed, here directly rm -rf / mnt delete all files on this partition, then use the ls command to see what findings have all been deleted.

image.png

.

            Then use xfsrestore -f / opt / dump_sdb / mnt command to restore the backup file you just go to the mnt directory.

image.png


        Next, use the cd command to enter the mnt directory, found just deleted all the files have been restored.

image.png

image.png

Guess you like

Origin blog.51cto.com/14451009/2433015