Linux File System Application---System data backup and migration (user perspective)

Source: Internet
Author: User
Tags gtk mongodb client system log ftp client filezilla mozilla thunderbird rsync robomongo

1 Preface

The first commitment: for users migrating from the Windows system, the "Linux system can be plagued by the system files and user files to the C-drive and the D-disk " problem can also be satisfactorily resolved.

The previous article had a rough introduction to the Linux file system, but what is the use of the file system structure after understanding it? This section will focus on the field application of Linux file system-related knowledge in the context of "User-oriented data backup and migration under Linux" , generating productivity.

After understanding the Linux file system, you can be bold to play the Linux file directory.

The case--- "data backup and migration based on user-perspective Linux" is described in the following scenarios:

After a new system has been installed, the data of the old system needs to be replicated or migrated, and the user needs to know what data needs to be migrated, what data needs to be backed up, and the backup and migration of the files at the lowest possible cost.

The main types of data involved are:

    • User Multimedia document data
    • User/System application configuration data
    • User/System application execution files
    • System Log data
2 FHS file model

In the previous section of the article, we mentioned the relevant conventions of the Linux Foundation file directory for each branch of Linux: Linux FHS (Filesystem hierachy standart).

FHS the Linux file system into four categories in terms of "mutable" and "can be shared" :

shareable unshareable
Static
  • /usr
  • /opt
  • /etc
  • /boot
Variable
  • /var/mail
  • /var/spool/news
  • /var/run
  • /var/lock

The largest benchmark classification framework is shown in the table above. For people who are beginning to know Linux, it's certainly confusing to see a series of files under the root directory. Therefore, it is absolutely necessary to study the relevant provisions of FHS, which has the following advantages:

    • Understand Linux design standards when using or developing a Linux file system and follow the guidelines as much as possible during use
    • When you touch and use different Linux branches, even if you have thousands of Linux branches, but you can never leave their parcels, FHS is not one of the "parcels"
    • Scientific, selective migration for system-level data migrations (for example, user-configured data migration after a reload of the system)
    • Physically isolated storage or backup can be carried out according to "critical level of file data" or "potential footprint growth of the directory" for file physical isolation storage
    • Assign different storage devices (e.g. mechanical hard drives or SSD SSDs) to different directories depending on the frequency of read and write during performance optimization
    • When deploying a system cluster, a static shareable directory can be deployed on a certain read-only memory and then mounted by the required machine to avoid unnecessary storage space
3 User Data

The user data referred to herein refers to the modified configuration or installed files that are generated by the user or system administrator in the process of using the standard native system.

3.1 Home

For each new user, a directory with the same name as the user name will be created under this directory to store the file data and user personalization data generated by this user.

All user directory files are listed through the command line:

?                      ~ Ls-a. . gconf. Pip.                     Xauthority. . Genymobile. PKI. Xinputrc.adobe. gimp-2.8. Profile. Xmind.android. Gitconfig proxychains-ng. Xsession-errors.            AndroidStudio1.3. Gksu.lock public. Xsession-errors.old.bash_history. Gnome .                 PyCharm40. zcompcache.bash_logout. gnome2 Pycharm-config.jar. ZCOMPDUMP.BASHRC           . Gphoto record-demo-plus-hold.mp4. Zcompdump-zheng-desktop-5.0.2.cache. Gradle . sample-music. zsh_history.config. gstreamer-0.10 shortcuts-images. zshr             C.cr3. Icons. ssh. Zshrc.pre-oh-my-zsh.cxoffice. java      . SSR. Zsh-update.dbus            . Kingsoft Templates public. Dde-dock-applets.ini Kuaipan Tencent Files Template desktop. Local themes video. Dlockpid. Macromedia. Th Umbnails pictures. dmrc. Mozilla Thunderbird Document documents Mus IC. Viminfo download downloads. oh-my-zsh. viminfo.tmp Music. Esd_aut H. pam_environment. Wireshark desktop. FileZilla Pictures. Wiznote

The main types of documents are as follows:

  • User-Generic document file

    Videos, pictures, documents, downloads, music, desktops

  • Application configuration file

    The configuration file for the program associated with the desktop application, starting with a . dot number, the default hidden file, for example:

    • . Adobe is a PDF reader for the Adobe application's configuration file directory
    • . FileZilla is the FTP client program filezilla configuration file directory
    • Other...
  • User environment variable configuration file
    • . Profile

      The environment variables that will be loaded when the user logs in

    • . BASHRC

      Script to execute every time the bash Shell is opened with the current user

In the user data migration, very concerned about the application configuration information, about the user application configuration file directory has two places:

    • Hidden files in the/home/xxx directory that begin with the dot number
    • Files under the/home/xxx/.config directory

Hidden profiles under the user directory, which are described in the front end, are also available under the . config directory:

?  . config cd/home/zheng/.config?           . config ls-a.          Deepin_monitors.json EOG htop Pencil trolltech.conf.  Deepin-movie fcitx Ipython Pulse Ubuntukylinautostart Deepin-software-center Fcitx-qimpanel kingsoft qtproject.conf user-dirs.dirsbleachbit deepin-terminal geany Kings OFT Retext Project User-dirs.localecalibre deepin-ui gedit launcher Robom    Ongo yelpchromium Desktop Genymobile liteide shutdown youdao-dictcompiz-1 Dock git matplotlib sogoupy zonedconf dolezel goog Le-chrome menus Sogoupy.usersdde-daemon dra gtk-2.0 nautilus sogou-q Impaneldeepin DUI gtk-3.0 Not_first_run_dde sublime-text-2

The configuration files for the main desktop applications installed by the user are here, for example:

    • Kingsoft

      Jinshan Office suite configuration file

    • Google-chrome

      Google Chrome Browser User Configuration and user data storage directory

    • Robomongo

      Client operating software for MONGODB database

Having said so much, what does the configuration file do specifically? Give the two simplest examples:

    • FTP client software FileZilla
    • MongoDB database client software Robomongo

If you are a system administrator, you will inevitably have to use the appropriate client software to manage multiple servers ( file servers or database servers ), in the process of using Linux desktop, Some client software is constantly accumulating application configuration files, for example:

FTP Client Configuration data:


MongoDB Client Configuration data:


If the above mentioned configuration directory is copied to the new machine, and then open the corresponding client software, these configuration information will follow the migration of the past (in essence, the configuration text data migration has passed, here for the sake of simplicity, simply the entire directory migrated over)

3.2 etc

With regard to the full name of the ETC catalogue, it is generally accepted that Editable text config: Editable textual configuration file.

It mainly stores some text configuration files that are used by the system when it is running. For example, by removing the user password information, basically all the configuration files associated with the server application are stored here. The meaning of the specific files in this directory is also not mentioned here, in the case of migration and backup, you need to playable the required configuration files for the migration backup.

If it is a Linux server system administrator, the most dealing with the directory should be the etc directory, to build a variety of servers must handle the configuration directory.

3.3 opt

From the command line, view the files in this directory:

?  /opt  ls-a ...  Cxoffice  deepin-boot-maker  google  kingsoft  point  Ubuntukylin

This directory is the installation directory for some applications, and the general case is that the directory of the application is placed here when installed through the deb/rpm file or make.

For example:

    • Google/chrome

      Chrome Browser installation directory

    • Kingsoft/wps-office

      Kingsoft Office suite Application installation directory

These applications are installed through the Deb package.

3.4 var

The Var directory mainly stores some frequently changing data, such as:

    • Mail

      Mail data

    • Log

      A log of a system application or user application, primarily a text file.

This piece is constantly changing as the system continues to run. This piece of data is not necessary for the system to run, but it is helpful for the system administrator to troubleshoot the status values in the application running.

3.5 usr

The full name of USR is the UNIX software Resource, which is designed to store UNIX system installation software, in the/OPT directory is different, this directory is generally stored by the command line installation of applications, for example, under Ubuntu is generally stored under the Apt-get Install the installed application.

The main file directories under this directory are as follows:

?  /usr  ls-a ...  Bin  Games  include  Lib  local  sbin  share  src

Basically, as long as this directory is migrated to the new system, applications installed through apt-get Install on the old system will also migrate past.

4 File Migration command

You can use the rsync command to implement a synchronized migration of files.

Use the man rsync command to view the specific uses of rsync:

NAME   rsync-a Fast, versatile, remote (and local) file-copying toolsynopsis       Local:  rsync [OPTION ...] Src... [DEST]       Access via remote shell:         pull:rsync [OPTION ...] [[email protected]] Host:src ... [DEST]         Push:rsync [OPTION ...] Src... [[email protected]] Host:dest       Access via rsync daemon:         pull:rsync [OPTION ...] [[email protected]] Host::src ... [DEST]               rsync [OPTION ...] rsync://[u[email protected]]host[:P ort]/src ... [DEST]         Push:rsync [OPTION ...] Src... [[email protected]] HOST::D est               rsync [OPTION ...] SRC ... rsync://[[email protected]]host[:P ort]/dest

Rsync is an extremely fast and versatile replication tool with the following main features:

    • Local a directory to copy files to B directory synchronously (locallycopy)
    • Local a directory synchronously replicates the push file to the remote RB directory (remotelypush )
    • Remote RC directory synchronously replicates pull files to local a directory ( remote Pull)

The main OPTION parameter can be viewed through the man rsync command

In this article to the new system to do data migration is mainly used in the archive function, the corresponding command is as follows:

Rsync-avzp Src_dir Dest_dir
    • A archive called archive mode, do the following
      • Recursive mode
      • Preserve Symbolic Links
      • Reserved permissions
      • Retention time stamp
      • Retain user name and group name
    • V Verbose intermediate procedure for input command execution

    • Z Compress compress the files in sync (rather CPU-intensive computing resources to save the IO cost of the transfer)

    • P progress percent of detailed progress during transfer

In general, you only need to use the rsync command to make the appropriate directory-synchronized copies of the data that the user needs to migrate.

5 Summary and Outlook

The Linux system below does not have the so-called registry under Windows System. The Linux system can be understood as a "pure green" Software installation system. As to why some programs can be launched directly (without the need to specify a path) through the command line, some cannot, this is not related to the "registry", just because the application if the standard installation method, the system will be in the environment variable path directory under a soft link is generated.

Through the Linux file Migration experiment, you can clearly understand how the various files in the Linux file system are the responsibility of each division, and stored in the corresponding directory, and then will not produce "because do not understand, so afraid of" the embarrassed mood.

When migrating to a new system, how the application migrates, this article provides direct file-level replication, and an automated approach is to perform the installation of batch files based on the command line, and if there is a faster network, it is recommended to perform an automated installation of the command line (later in this article).

Author: Harmo ha mo
Author Introduction: Https://zhengwh.github.io
Technical Blog: Http://www.cnblogs.com/beer
Email: [Email protected]
Qq: 1295351490
Time: 2015-10-02
Copyright Notice: Unlawful transmission for commercial purposes is prohibited without permission
To contact or reward: Http://zhengwh.github.io/contact-donate.html

Linux File System Application---System data backup and migration (user perspective)

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.