[go: up one dir, main page]

CN105138362A - Method and device for saving user configuration under Linux system - Google Patents

Method and device for saving user configuration under Linux system Download PDF

Info

Publication number
CN105138362A
CN105138362A CN201510515998.3A CN201510515998A CN105138362A CN 105138362 A CN105138362 A CN 105138362A CN 201510515998 A CN201510515998 A CN 201510515998A CN 105138362 A CN105138362 A CN 105138362A
Authority
CN
China
Prior art keywords
file
configuration
compressed
configuration file
new
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201510515998.3A
Other languages
Chinese (zh)
Other versions
CN105138362B (en
Inventor
李美欣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Beijing Electronic Information Industry Co Ltd
Original Assignee
Inspur Beijing Electronic Information Industry Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Beijing Electronic Information Industry Co Ltd filed Critical Inspur Beijing Electronic Information Industry Co Ltd
Priority to CN201510515998.3A priority Critical patent/CN105138362B/en
Publication of CN105138362A publication Critical patent/CN105138362A/en
Application granted granted Critical
Publication of CN105138362B publication Critical patent/CN105138362B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明公开了一种Linux系统下保存用户配置的方法及装置,该方法包括:利用开源工具建立根文件系统,并创建新目录;在根文件系统中查找出配置文件,打压缩包变为配置压缩文件,将其它系统文件打压缩包变为系统压缩文件;将配置压缩文件和系统压缩文件迁移至非易失性存储器中,将配置压缩文件解压至新目录中形成配置文件副本;在更改配置文件指令的作用下,对配置文件副本进行更改得到新配置文件,将新配置文件打压缩包,压缩形成新配置压缩文件;重新启动根文件系统时,解压新配置压缩文件得到新配置文件并作为当前Linux系统下的配置文件。该方法实现在保证系统文件安全性的同时,解决了用户配置的保存问题,能够保存用户配置。

The invention discloses a method and device for saving user configuration under a Linux system. The method includes: using an open-source tool to establish a root file system and creating a new directory; finding configuration files in the root file system, and compressing the package to become a configuration Compress files, compress other system files into system compressed files; migrate configuration compressed files and system compressed files to non-volatile memory, decompress configuration compressed files to a new directory to form a copy of configuration files; Under the action of the file command, change the copy of the configuration file to obtain a new configuration file, compress the new configuration file, and compress it to form a new configuration compressed file; when restarting the root file system, decompress the new configuration compressed file to obtain the new configuration file and use it as The configuration file under the current Linux system. The method solves the problem of saving user configurations while ensuring the security of system files, and can save user configurations.

Description

一种linux系统下保存用户配置的方法及装置Method and device for saving user configuration under linux system

技术领域technical field

本发明涉及的Linux系统技术领域,特别是涉及一种Linux系统下保存用户配置的方法及装置。The technical field of the Linux system that the present invention relates to, in particular, relates to a method and device for saving user configurations under the Linux system.

背景技术Background technique

目前,在为设备构建linux系统时,采用的方式很多,大致可分为两类:一类是根文件系统直接在非易失性存储器上,用户操作的文件即是非易失性存储器上的,例如直接选择磁盘、CF卡、DOM卡以及板载flash等非易失性存储器上的文件系统作为linux根文件系统;另一类是系统文件存放在RAM中,用户直接操作的是RAM中的文件。At present, when building a linux system for a device, many methods are used, which can be roughly divided into two categories: one is that the root file system is directly on the non-volatile memory, and the files operated by the user are on the non-volatile memory. For example, directly select the file system on non-volatile memory such as disk, CF card, DOM card, and onboard flash as the Linux root file system; the other type is that the system files are stored in RAM, and the user directly operates the files in RAM .

以上描述的第一类,被挂载的根文件系统在非易失性存储器上,可以是romfs等只读类型的,也可以是jiffs、yaffs、ext4等可读写类型的。只读类型的文件系统满足了文件安全性问题,用户是不能修改文件和删除文件的,所以也就导致了这种类型无法让用户保存配置;如果是可读写类型的文件系统,那么用户操作的即是非易失性存储器上的文件,操作完成即完成了保存,设备重启之后仍然是操作后的文件,但这种方式就失去了文件的安全性,用户的误操作可能会导致系统不可恢复。In the first category described above, the mounted root file system is on a non-volatile memory, which can be a read-only type such as romfs, or a read-write type such as jiffs, yaffs, or ext4. The read-only file system satisfies the file security problem, and the user cannot modify or delete the file, so this type cannot allow the user to save the configuration; if it is a read-write file system, then the user operation The file on the non-volatile memory is the file on the non-volatile memory. After the operation is completed, the file is saved. After the device is restarted, the file is still the file after the operation. However, this method loses the security of the file, and the user's misoperation may cause the system to be unrecoverable. .

上边描述的第二类系统文件存放在RAM中,在没有ramfs和tmpfs之前,通常把RAM的一部分制作成ramdisk,然后最终系统的系统文件都在ramdisk中,而非真实的非易失性存储器中。不论是较老的ramdisk还是较新的ramfs和tmpfs,都是把系统文件放入RAM中,用户直接操作的是RAM中的文件,这种情况下,如果用户修改或者删除系统中的文件,实际与非易失性存储器上的文件无关,设备重启后一切恢复原样。这种方式满足了文件的安全性,但没有解决用户配置的保存问题,也没有解决日志以及异常信息的实时保存。The second type of system files described above are stored in RAM. Before ramfs and tmpfs, a part of RAM is usually made into ramdisk, and then the system files of the final system are all in ramdisk, not real non-volatile memory. . Regardless of the older ramdisk or the newer ramfs and tmpfs, the system files are put into the RAM, and the user directly operates the files in the RAM. In this case, if the user modifies or deletes the files in the system, the actual Regardless of the files on the non-volatile memory, everything is back to normal after the device is restarted. This method satisfies the security of files, but it does not solve the problem of saving user configurations, nor does it solve the real-time saving of logs and abnormal information.

发明内容Contents of the invention

本发明的目的是提供一种Linux系统下保存用户配置的方法及装置,以实现在保证系统文件安全性的同时,解决了用户配置的保存问题,能够保存用户配置。The purpose of the present invention is to provide a method and device for saving user configurations under the Linux system, so as to solve the problem of saving user configurations and save user configurations while ensuring the security of system files.

为解决上述技术问题,本发明提供一种Linux系统下保存用户配置的方法,该方法包括:In order to solve the above-mentioned technical problems, the present invention provides a method for saving user configurations under a Linux system, the method comprising:

利用开源工具建立Linux系统下的根文件系统initrd,并在内存中创建新目录newroot;Use open source tools to establish the root file system initrd under the Linux system, and create a new directory newroot in memory;

在所述根文件系统initrd中查找出配置文件,将所述配置文件打压缩包变为配置压缩文件,将所述根文件系统initrd中除了所述配置文件的其它系统文件打压缩包变为系统压缩文件;Find the configuration file in the root file system initrd, compress the configuration file into a configuration compressed file, and compress other system files in the root file system initrd except the configuration file into a system Compressed file;

将所述配置压缩文件和所述系统压缩文件迁移至非易失性存储器中,并将所述配置压缩文件解压至所述内存中的新目录newroot中形成配置文件副本;Migrating the configuration compressed file and the system compressed file to a non-volatile memory, and decompressing the configuration compressed file to a new directory newroot in the internal memory to form a copy of the configuration file;

接收用户输入的更改配置文件指令,在所述更改配置文件指令的作用下,对所述内存中的配置文件副本进行更改得到新配置文件;receiving an instruction to change the configuration file input by the user, and under the action of the instruction to modify the configuration file, modify the copy of the configuration file in the memory to obtain a new configuration file;

利用配置保存命令将所述新配置文件打压缩包,将所述新配置文件压缩至所述非易失性存储器中形成新配置压缩文件;compressing the new configuration file by using the configuration saving command, and compressing the new configuration file into the non-volatile memory to form a new configuration compressed file;

重新启动所述根文件系统initrd时,在所述非易失性存储器中解压所述新配置压缩文件得到所述新配置文件,将所述新配置文件作为当前的Linux系统下的配置文件。When restarting the root file system initrd, decompress the new configuration compressed file in the non-volatile memory to obtain the new configuration file, and use the new configuration file as the configuration file under the current Linux system.

优选的,所述在内存中创建新目录newroot之后,还包括:Preferably, after the new directory newroot is created in the memory, it also includes:

将所述新目录newroot挂载ramfs文件系统或者tmpfs文件系统。Mount the new directory newroot to the ramfs file system or the tmpfs file system.

优选的,所述在所述根文件系统initrd中查找出配置文件,将所述配置文件打压缩包变为配置压缩文件,将所述根文件系统initrd中除了所述配置文件的其它系统文件打压缩包变为系统压缩文件,包括:Preferably, the configuration file is found in the root file system initrd, the configuration file is compressed into a configuration compressed file, and other system files in the root file system initrd except the configuration file are compressed. The compressed package becomes a system compressed file, including:

在所述根文件系统initrd中查找出涉及用户配置保存的配置文件;Find out the configuration files related to user configuration preservation in the root file system initrd;

将所述配置文件单独打压缩包,形成配置文件压缩包并命名为config-origin.tar.gz;Compress the configuration file separately to form a compressed configuration file and name it config-origin.tar.gz;

将所述根文件系统initrd中其它的系统文件分类打压缩包,形成分类的各个系统压缩文件。Classifying and compressing other system files in the root file system initrd to form compressed files of each classified system.

优选的,所述利用配置保存命令将所述新配置文件打压缩包,将所述新配置文件压缩至所述非易失性存储器中形成新配置压缩文件,包括:Preferably, using the configuration saving command to pack the new configuration file into a compressed package, and compress the new configuration file into the non-volatile memory to form a new configuration compressed file, including:

利用配置保存命令config-save,对所述新配置文件打压缩包,并命名为config-user.tar.gz,形成config-user.tar.gz压缩文件;Utilize the configuration preservation command config-save to compress the new configuration file and name it config-user.tar.gz to form a config-user.tar.gz compressed file;

挂载所述非易失性存储器,保存config-user.tar.g压缩文件到所述非易失性存储器;Mount the non-volatile memory, save the config-user.tar.g compressed file to the non-volatile memory;

保存完成之后卸载所述非易失性存储器。After the saving is completed, the non-volatile memory is unloaded.

优选的,所述重新启动所述根文件系统initrd时,在所述非易失性存储器中解压所述新配置压缩文件得到所述新配置文件,将所述新配置文件作为当前的Linux系统下的配置文件,包括:Preferably, when the root file system initrd is restarted, the new configuration compressed file is decompressed in the non-volatile memory to obtain the new configuration file, and the new configuration file is used as the new configuration file under the current Linux system. configuration files, including:

在所述根文件系统initrd启动初始化脚本时,利用mount命令挂载所述非易失性存储器到所述根文件系统initrd;When the root file system initrd starts the initialization script, utilize the mount command to mount the non-volatile memory to the root file system initrd;

检测所述非易失性存储器中是否存在config-user.tar.gz压缩文件;如果存在,解压config-user.tar.gz压缩文件到newroot/etc目录,形成所述新配置文件并作为当前linux系统的配置文件。Detect whether there is a config-user.tar.gz compressed file in the non-volatile memory; if it exists, decompress the config-user.tar.gz compressed file to the newroot/etc directory to form the new configuration file and use it as the current linux System configuration files.

本发明还提供一种Linux系统下保存用户配置的装置,包括:The present invention also provides a device for saving user configuration under the Linux system, including:

建立模块,用于利用开源工具建立Linux系统下的根文件系统initrd,并在内存中创建新目录newroot;Create a module for using open source tools to establish the root file system initrd under the Linux system, and create a new directory newroot in memory;

第一压缩模块,用于在所述根文件系统initrd中查找出配置文件,将所述配置文件打压缩包变为配置压缩文件,将所述根文件系统initrd中除了所述配置文件的其它系统文件打压缩包变为系统压缩文件;The first compression module is used to search out the configuration file in the root file system initrd, compress the configuration file into a configuration compressed file, and convert other systems in the root file system initrd except the configuration file The file is compressed into a system compressed file;

迁移模块,用于将所述配置压缩文件和所述系统压缩文件迁移至非易失性存储器中,并将所述配置压缩文件解压至所述内存中的新目录newroot中形成配置文件副本;A migration module, configured to migrate the configuration compressed file and the system compressed file to a non-volatile memory, and decompress the configuration compressed file to a new directory newroot in the memory to form a copy of the configuration file;

更改模块,用于接收用户输入的更改配置文件指令,在所述更改配置文件指令的作用下,对所述内存中的配置文件副本进行更改得到新配置文件;The modification module is configured to receive an instruction for modifying a configuration file input by a user, and under the action of the instruction for modifying a configuration file, modify the copy of the configuration file in the memory to obtain a new configuration file;

第二压缩模块,用于利用配置保存命令将所述新配置文件打压缩包,将所述新配置文件压缩至所述非易失性存储器中形成新配置压缩文件;The second compression module is used to compress the new configuration file by using the configuration saving command, and compress the new configuration file into the non-volatile memory to form a new configuration compressed file;

启动模块,用于重新启动所述根文件系统initrd时,在所述非易失性存储器中解压所述新配置压缩文件得到所述新配置文件,将所述新配置文件作为当前的Linux系统下的配置文件。The startup module is used to decompress the new configuration compressed file in the non-volatile memory to obtain the new configuration file when restarting the root file system initrd, and use the new configuration file as the current Linux system. configuration file.

优选的,所述装置还包括:Preferably, the device also includes:

挂载模块,用于将所述新目录newroot挂载ramfs文件系统或者tmpfs文件系统。The mounting module is used to mount the new directory newroot to the ramfs file system or the tmpfs file system.

优选的,所述第一压缩模块包括:Preferably, the first compression module includes:

查找单元,用于在所述根文件系统initrd中查找出涉及用户配置保存的配置文件;A search unit, configured to find configuration files related to user configuration storage in the root file system initrd;

单独压缩单元,用于将所述配置文件单独打压缩包,形成配置文件压缩包并命名为config-origin.tar.gz;A separate compression unit, configured to compress the configuration file separately to form a configuration file compression package and name it config-origin.tar.gz;

分类压缩单元,用于将所述根文件系统initrd中其它的系统文件分类打压缩包,形成分类的各个系统压缩文件。The classification compression unit is used to classify and compress other system files in the root file system initrd to form compressed files of each system in classification.

优选的,所述第二压缩模块包括:Preferably, the second compression module includes:

保存单元,用于利用配置保存命令config-save,对所述新配置文件打压缩包,并命名为config-user.tar.gz,形成config-user.tar.gz压缩文件;The storage unit is used to utilize the configuration preservation command config-save to compress the new configuration file and name it config-user.tar.gz to form a config-user.tar.gz compression file;

挂载单元,用于挂载所述非易失性存储器,保存config-user.tar.g压缩文件到所述非易失性存储器;a mounting unit, configured to mount the non-volatile memory, and save the config-user.tar.g compressed file to the non-volatile memory;

卸载单元,用于保存完成之后卸载所述非易失性存储器。The unloading unit is configured to unload the non-volatile memory after saving.

优选的,所述启动模块包括:Preferably, the startup module includes:

初始化模块,用于在所述根文件系统initrd启动初始化脚本时,利用mount命令挂载所述非易失性存储器到所述根文件系统initrd;An initialization module, configured to use a mount command to mount the non-volatile memory to the root file system initrd when the root file system initrd starts the initialization script;

检测模块,用于检测所述非易失性存储器中是否存在config-user.tar.gz压缩文件;如果存在,解压config-user.tar.gz压缩文件到newroot/etc目录,形成所述新配置文件并作为当前linux系统的配置文件。The detection module is used to detect whether there is a config-user.tar.gz compressed file in the non-volatile memory; if it exists, decompress the config-user.tar.gz compressed file to the newroot/etc directory to form the new configuration The file is used as the configuration file of the current linux system.

本发明所提供的一种Linux系统下保存用户配置的方法及装置,配置文件是单独从根文件系统中分离出来,单独打包进行压缩,其他系统文件变成压缩包是存放在非易失性存储器中,那么系系统文件是存放在非易失性存储器中,用户不能对非易失性存储器上的数据进行更改,则系统文件是不能被更改的,这样系统文件的安全性是保证的。A method and device for storing user configurations under the Linux system provided by the present invention, the configuration files are separated from the root file system separately, packaged and compressed separately, and other system files become compressed packages and are stored in a non-volatile memory , then the system files are stored in the non-volatile memory, and the user cannot change the data on the non-volatile memory, and the system files cannot be changed, so the security of the system files is guaranteed.

而且,对于配置文件,配置文件是单独打包变成压缩文件,配置文件的压缩文件也存放在非易失性存储器中,该配置文件其实就是原始配置文件,则原始配置文件的压缩文件是存放在非易失性存储器中,而对配置文件的压缩文件解压后得到的配置文件是存放在内存上的目录中,即解压后的配置文件位于内存目录中,用户能对内存上的数据进行更改,则内存目录上的配置文件能被用户更改,更改后的新配置文件被压缩到非易失性存储器上,则新配置文件压缩后的压缩文件是存放在非易失性存储器中,在系统重新启动后,非易失性存储器上存在原始配置文件的压缩文件和新配置文件的压缩文件,在新配置文件的压缩文件存在的情况下,使用新配置文件,不使用原始配置文件,将新配置文件的压缩文件解压成新配置文件作为当前系统的配置文件,这样保存了用户设置,所以本发明所提供的一种Linux系统下保存用户配置的方法及装置,实现在保证系统文件安全性的同时,解决了用户配置的保存问题,能够保存用户配置。Moreover, for the configuration file, the configuration file is packaged separately into a compressed file, and the compressed file of the configuration file is also stored in the non-volatile memory. The configuration file is actually the original configuration file, and the compressed file of the original configuration file is stored in the In the non-volatile memory, the configuration file obtained after decompressing the compressed file of the configuration file is stored in the directory on the internal memory, that is, the configuration file after decompression is located in the internal memory directory, and the user can change the data on the internal memory. Then the configuration file on the memory directory can be changed by the user, and the changed new configuration file is compressed to the non-volatile memory, and the compressed file of the new configuration file is stored in the non-volatile memory, and will be saved when the system restarts. After startup, the compressed file of the original configuration file and the compressed file of the new configuration file exist in the non-volatile memory. If the compressed file of the new configuration file exists, the new configuration file is used instead of the original configuration file, and the new configuration The compressed file of the file is decompressed into a new configuration file as the configuration file of the current system, which saves the user settings, so the method and device for saving the user configuration under a Linux system provided by the present invention realize the security of the system files. , which solves the problem of saving user configuration and can save user configuration.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only It is an embodiment of the present invention, and those skilled in the art can also obtain other drawings according to the provided drawings on the premise of not paying creative efforts.

图1为本发明所提供的一种Linux系统下保存用户配置的方法的流程图;Fig. 1 is the flowchart of the method for preserving user configuration under a kind of Linux system provided by the present invention;

图2为本发明所提供的一种Linux系统下保存用户配置的装置的结构示意图。FIG. 2 is a schematic structural diagram of a device for saving user configurations under the Linux system provided by the present invention.

具体实施方式Detailed ways

本发明的核心是提供一种Linux系统下保存用户配置的方法及装置,以实现在保证系统文件安全性的同时,解决了用户配置的保存问题,能够保存用户配置。The core of the present invention is to provide a method and device for saving user configurations under the Linux system, so as to solve the problem of saving user configurations and save user configurations while ensuring the security of system files.

为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to enable those skilled in the art to better understand the solutions of the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

请参考图1,图1为本发明所提供的一种Linux系统下保存用户配置的方法的流程图,该方法括:Please refer to Fig. 1, Fig. 1 is the flowchart of the method for preserving user configuration under a kind of Linux system provided by the present invention, and this method comprises:

S11:利用开源工具建立Linux系统下的根文件系统initrd,并在内存中创建新目录newroot;S11: Use open source tools to establish the root file system initrd under the Linux system, and create a new directory newroot in memory;

其中,开源工具包括busybox工具,可以创建简单的文件系统。创建完新目录newrooot之后,挂载ramfs文件系统或者tmpfs文件系统。利用ramfs或tmpfs能改善ramdisk性能,并且无需多余占用系统内存,ramfs和tmpfs都能动态的调整占用内存大小,而不像ramdisk一样预先浪费内存空间。Among them, the open source tools include the busybox tool, which can create a simple file system. After creating the new directory newrooot, mount the ramfs file system or tmpfs file system. Using ramfs or tmpfs can improve the performance of ramdisk, and there is no need to occupy excessive system memory. Both ramfs and tmpfs can dynamically adjust the occupied memory size, instead of wasting memory space in advance like ramdisk.

S12:在根文件系统initrd中查找出配置文件,将配置文件打压缩包变为配置压缩文件,将根文件系统initrd中除了配置文件的其它系统文件打压缩包变为系统压缩文件;S12: Find the configuration file in the root file system initrd, compress the configuration file into a configuration compressed file, and compress other system files in the root file system initrd except the configuration file into a system compressed file;

其中,在根文件系统initrd中查找出涉及用户配置保存的配置文件,将配置文件单独打压缩包,形成配置文件压缩包并命名为config-origin.tar.gz,将根文件系统initrd中其它的系统文件分类打压缩包,形成分类的各个系统压缩文件。Among them, find the configuration file related to user configuration saving in the root file system initrd, compress the configuration file separately, form a configuration file compression package and name it config-origin.tar.gz, and compress other files in the root file system initrd The system files are categorized into compressed packages to form compressed files of each system in the category.

S13:将配置压缩文件和系统压缩文件迁移至非易失性存储器中,并将配置压缩文件解压至内存中的新目录newroot中形成配置文件副本;S13: Migrating the configuration compressed file and the system compressed file to a non-volatile memory, and decompressing the configuration compressed file to a new directory newroot in memory to form a copy of the configuration file;

S14:接收用户输入的更改配置文件指令,在更改配置文件指令的作用下,对内存中的配置文件副本进行更改得到新配置文件;S14: Receive an instruction to change the configuration file input by the user, and under the action of the instruction to change the configuration file, modify the copy of the configuration file in the memory to obtain a new configuration file;

S15:利用配置保存命令将新配置文件打压缩包,将新配置文件压缩至非易失性存储器中形成新配置压缩文件;S15: Use the configuration saving command to compress the new configuration file, and compress the new configuration file into a non-volatile memory to form a new configuration compressed file;

其中,利用配置保存命令config-save,对新配置文件打压缩包,并命名为config-user.tar.gz,形成config-user.tar.gz压缩文件,挂载所述非易失性存储器,保存config-user.tar.g压缩文件到非易失性存储器,保存完成之后卸载非易失性存储器。Among them, use the configuration saving command config-save to compress the new configuration file and name it config-user.tar.gz to form a config-user.tar.gz compressed file, and mount the non-volatile memory, Save the config-user.tar.g compressed file to the non-volatile memory, and uninstall the non-volatile memory after saving.

S16:新启动根文件系统initrd时,在非易失性存储器中解压新配置压缩文件得到新配置文件,将新配置文件作为当前的Linux系统下的配置文件。S16: When the root file system initrd is newly started, the new configuration compressed file is decompressed in the non-volatile memory to obtain a new configuration file, and the new configuration file is used as a configuration file under the current Linux system.

其中,在根文件系统initrd启动初始化脚本时,利用mount命令挂载非易失性存储器到所述根文件系统initrd,检测非易失性存储器中是否存在config-user.tar.gz压缩文件,如果存在,解压config-user.tar.gz压缩文件到newroot/etc目录,形成新配置文件并作为当前linux系统的配置文件。Wherein, when the root file system initrd starts the initialization script, use the mount command to mount the non-volatile memory to the root file system initrd, and detect whether there is a config-user.tar.gz compressed file in the non-volatile memory, if If it exists, decompress the config-user.tar.gz compressed file to the newroot/etc directory to form a new configuration file and use it as the configuration file of the current linux system.

以上具体的,例如,首先使用busybox工具,制作简易的文件系统,用于制作initrd。Specifically, for example, first use the busybox tool to make a simple file system for making initrd.

把最终运行的系统文件分类打压缩包,例如/etc目录中涉及用户配置保存的文件单独打一个压缩包命名为config-origin.tar.gz,其他的系统文件再按自己的需要分类打压缩包。把所有压缩包放置到非易失性存储器,非易失性存储器可以是硬盘,DOM盘、CF卡、板载flash等。Classify the final running system files into compressed packages, for example, create a separate compressed package for the files related to user configuration preservation in the /etc directory and name it config-origin.tar.gz, and then classify and compress other system files according to your needs . Put all compressed packages into non-volatile memory, which can be hard disk, DOM disk, CF card, onboard flash, etc.

接着,在initrd启动初始化脚本中增加以下功能:创建newroot目录,newroot目录挂载ramfs或者tmpfs;Next, add the following functions to the initrd startup initialization script: create a newroot directory, mount ramfs or tmpfs on the newroot directory;

其次,在initrd启动初始化脚本中继续添加以下过程:mount命令挂载非易失性存储器到initrd的/mnt目录,检查是否存在config-user.tar.gz,如果存在解压config-user.tar.gz到newroot/etc目录,作为最终系统的配置文件;如果不存在config-user.tar.gz则解压config-origin.tar.gz,用config-origin.tar.gz的内容作为最终系统的配置文件。Secondly, continue to add the following process in the initrd startup initialization script: The mount command mounts the non-volatile memory to the /mnt directory of the initrd, checks whether config-user.tar.gz exists, and decompresses config-user.tar.gz if it exists Go to the newroot/etc directory as the configuration file of the final system; if config-user.tar.gz does not exist, decompress config-origin.tar.gz, and use the content of config-origin.tar.gz as the configuration file of the final system.

再次,在initrd启动初始化脚本的最后,解压其他必须的系统文件到newroot目录,并用umount卸载非易失性存储器,最后执行chroot或者switch_root命令,把系统切换到newroot,经过以上操作之后,呈现给用户操作的最终系统的根目录即是initrd的newroot目录。Again, at the end of the initrd startup initialization script, decompress other necessary system files to the newroot directory, and use umount to unmount the non-volatile memory, and finally execute the chroot or switch_root command to switch the system to newroot. After the above operations, present it to the user The root directory of the final operating system is the newroot directory of the initrd.

在使用switch_root等命令切换到最终系统后,利用mount命令挂载存放日志的非易失性存储器到/var/log目录。After using the switch_root command to switch to the final system, use the mount command to mount the non-volatile memory storing the log to the /var/log directory.

最后,制作的最终系统中需要增加一个用户配置保存的命令,例如命名config-save,此命令的功能是对配置文件打压缩包,压缩包命名为config-user.tar.gz,挂载非易失性存储器,保存config-user.tar.gz到非易失性存储器,卸载非易失性存储器。Finally, a command to save the user configuration needs to be added to the final system produced, such as named config-save. The function of this command is to compress the configuration file. The compressed package is named config-user.tar.gz, and it is not easy to mount. volatile storage, save config-user.tar.gz to non-volatile storage, unmount non-volatile storage.

因此,利用ramfs或tmpfs能改善ramdisk性能,并且无需多余占用系统内存,ramfs和tmpfs都能动态的调整占用内存大小,而不像ramdisk一样预先浪费内存空间。解决系统文件安全性问题的同时,有独立的命令让用户保存配置,提高了修改配置文件的可靠性,用户任意配置,出现混乱时,很容易恢复出厂值,仅需提供命令把config-user.tar.gz删除即可完成,即在用户配置出现混乱时,只需要删除非易失性存储器上的新配置压缩文件就可以了,留下配置压缩文件,该配置压缩文件就是原始配置文件的压缩文件,这样容易恢复原始配置。而且,有独立的保存日志的非易失性存储器,方便异常信息跟踪。Therefore, using ramfs or tmpfs can improve the performance of ramdisk, and there is no need to occupy excessive system memory. Both ramfs and tmpfs can dynamically adjust the occupied memory size, instead of wasting memory space in advance like ramdisk. While solving the security problem of the system file, there is an independent command for the user to save the configuration, which improves the reliability of modifying the configuration file. When the user configures it arbitrarily, when there is confusion, it is easy to restore the factory value. It is only necessary to provide the command to set the config-user. The deletion of tar.gz can be completed, that is, when the user configuration is in confusion, you only need to delete the new configuration compressed file on the non-volatile memory, leaving the configuration compressed file, which is the compression of the original configuration file file so that it is easy to restore the original configuration. Moreover, there is an independent non-volatile memory for saving logs, which is convenient for abnormal information tracking.

本发明所提供的一种Linux系统下保存用户配置的方法,配置文件是单独从根文件系统中分离出来,单独打包进行压缩,其他系统文件变成压缩包是存放在非易失性存储器中,那么系系统文件是存放在非易失性存储器中,用户不能对非易失性存储器上的数据进行更改,则系统文件是不能被更改的,这样系统文件的安全性是保证的。According to the method for saving user configuration under a Linux system provided by the present invention, the configuration file is separated from the root file system separately, packed and compressed separately, and other system files become compressed packages and are stored in the non-volatile memory. Then the system file is stored in the non-volatile memory, and the user cannot change the data on the non-volatile memory, so the system file cannot be changed, so the security of the system file is guaranteed.

而且,对于配置文件,配置文件是单独打包变成压缩文件,配置文件的压缩文件也存放在非易失性存储器中,该配置文件其实就是原始配置文件,则原始配置文件的压缩文件是存放在非易失性存储器中,而对配置文件的压缩文件解压后得到的配置文件是存放在内存上的目录中,即解压后的配置文件位于内存目录中,用户能对内存上的数据进行更改,则内存目录上的配置文件能被用户更改,更改后的新配置文件被压缩到非易失性存储器上,则新配置文件压缩后的压缩文件是存放在非易失性存储器中,在系统重新启动后,非易失性存储器上存在原始配置文件的压缩文件和新配置文件的压缩文件,在新配置文件的压缩文件存在的情况下,使用新配置文件,不使用原始配置文件,将新配置文件的压缩文件解压成新配置文件作为当前系统的配置文件,这样保存了用户设置,所以该方法实现在保证系统文件安全性的同时,解决了用户配置的保存问题,能够保存用户配置。Moreover, for the configuration file, the configuration file is packaged separately into a compressed file, and the compressed file of the configuration file is also stored in the non-volatile memory. The configuration file is actually the original configuration file, and the compressed file of the original configuration file is stored in the In the non-volatile memory, the configuration file obtained after decompressing the compressed file of the configuration file is stored in the directory on the internal memory, that is, the configuration file after decompression is located in the internal memory directory, and the user can change the data on the internal memory. Then the configuration file on the memory directory can be changed by the user, and the changed new configuration file is compressed to the non-volatile memory, and the compressed file of the new configuration file is stored in the non-volatile memory, and will be saved when the system restarts. After startup, the compressed file of the original configuration file and the compressed file of the new configuration file exist in the non-volatile memory. If the compressed file of the new configuration file exists, the new configuration file is used instead of the original configuration file, and the new configuration The compressed file of the file is decompressed into a new configuration file as the configuration file of the current system, which saves the user settings, so this method solves the problem of saving the user configuration while ensuring the security of the system files, and can save the user configuration.

请参考图2,图2为本发明所提供的一种Linux系统下保存用户配置的装置的结构示意图,该装置包括:Please refer to Fig. 2, Fig. 2 is a schematic structural diagram of a device for saving user configuration under a Linux system provided by the present invention, the device includes:

建立模块101,用于利用开源工具建立Linux系统下的根文件系统initrd,并在内存中创建新目录newroot;Build module 101, be used for utilizing open source tool to set up the root file system initrd under Linux system, and create new directory newroot in memory;

第一压缩模块102,用于在根文件系统initrd中查找出配置文件,将配置文件打压缩包变为配置压缩文件,将根文件系统initrd中除了配置文件的其它系统文件打压缩包变为系统压缩文件;The first compression module 102 is used to find out the configuration file in the root file system initrd, compress the configuration file into a configuration compressed file, and compress other system files except the configuration file in the root file system initrd into a system Compressed file;

迁移模块103,用于将配置压缩文件和系统压缩文件迁移至非易失性存储器中,并将配置压缩文件解压至内存中的新目录newroot中形成配置文件副本;The migration module 103 is used to migrate the configuration compressed file and the system compressed file to a non-volatile memory, and decompress the configuration compressed file to a new directory newroot in memory to form a copy of the configuration file;

更改模块104,用于接收用户输入的更改配置文件指令,在更改配置文件指令的作用下,对内存中的配置文件副本进行更改得到新配置文件;The modification module 104 is configured to receive an instruction to modify the configuration file input by the user, and under the action of the instruction to modify the configuration file, modify the copy of the configuration file in the memory to obtain a new configuration file;

第二压缩模块105,用于利用配置保存命令将新配置文件打压缩包,将新配置文件压缩至非易失性存储器中形成新配置压缩文件;The second compression module 105 is used to pack the new configuration file into a compressed package by using the configuration saving command, and compress the new configuration file into a non-volatile memory to form a new configuration compressed file;

启动模块106,用于重新启动所述根文件系统initrd时,在非易失性存储器中解压新配置压缩文件得到新配置文件,将新配置文件作为当前的Linux系统下的配置文件。The startup module 106 is configured to decompress the new configuration compressed file in the non-volatile memory to obtain a new configuration file when restarting the root file system initrd, and use the new configuration file as the configuration file under the current Linux system.

其中,所述装置还包括:Wherein, the device also includes:

挂载模块,用于将新目录newroot挂载ramfs文件系统或者tmpfs文件系统。The mount module is used to mount the new directory newroot to the ramfs file system or tmpfs file system.

其中,所述第一压缩模块包括:Wherein, the first compression module includes:

查找单元,用于在根文件系统initrd中查找出涉及用户配置保存的配置文件;A search unit is used to find configuration files related to user configuration storage in the root file system initrd;

单独压缩单元,用于将配置文件单独打压缩包,形成配置文件压缩包并命名为config-origin.tar.gz;The separate compression unit is used to compress the configuration file separately to form a configuration file compression package and name it config-origin.tar.gz;

分类压缩单元,用于将根文件系统initrd中其它的系统文件分类打压缩包,形成分类的各个系统压缩文件。The classification compression unit is used to classify and compress other system files in the root file system initrd to form compressed files of each system in classification.

其中,所述第二压缩模块包括:Wherein, the second compression module includes:

保存单元,用于利用配置保存命令config-save,对新配置文件打压缩包,并命名为config-user.tar.gz,形成config-user.tar.gz压缩文件;The saving unit is used to utilize the configuration saving command config-save to compress the new configuration file and name it config-user.tar.gz to form a config-user.tar.gz compressed file;

挂载单元,用于挂载所述非易失性存储器,保存config-user.tar.g压缩文件到非易失性存储器;A mounting unit, configured to mount the non-volatile memory, and save the config-user.tar.g compressed file to the non-volatile memory;

卸载单元,用于保存完成之后卸载非易失性存储器。The unloading unit is used for unloading the non-volatile memory after saving.

其中,所述启动模块包括:Wherein, the startup module includes:

初始化模块,用于在根文件系统initrd启动初始化脚本时,利用mount命令挂载非易失性存储器到根文件系统initrd;The initialization module is used to mount the non-volatile memory to the root file system initrd by using the mount command when the root file system initrd starts the initialization script;

检测模块,用于检测非易失性存储器中是否存在config-user.tar.gz压缩文件;如果存在,解压config-user.tar.gz压缩文件到newroot/etc目录,形成新配置文件并作为当前linux系统的配置文件。The detection module is used to detect whether there is a config-user.tar.gz compressed file in the non-volatile memory; if it exists, decompress the config-user.tar.gz compressed file to the newroot/etc directory to form a new configuration file and use it as the current The configuration file of the linux system.

本发明所提供的一种Linux系统下保存用户配置的装置,该装置包括建立模块、第一压缩模块、迁移模块、更改模块、第二压缩模块和启动模块。在该装置中,配置文件是单独从根文件系统中分离出来,单独打包进行压缩,其他系统文件变成压缩包是存放在非易失性存储器中,那么系系统文件是存放在非易失性存储器中,用户不能对非易失性存储器上的数据进行更改,则系统文件是不能被更改的,这样系统文件的安全性是保证的。The invention provides a device for saving user configuration under the Linux system, which includes a building module, a first compression module, a migration module, a modification module, a second compression module and a startup module. In this device, the configuration files are separated from the root file system, packaged and compressed separately, and other system files are stored in the non-volatile storage as compressed packages, and the system files are stored in the non-volatile storage. In the memory, the user cannot change the data on the non-volatile memory, and the system files cannot be changed, so the security of the system files is guaranteed.

而且,对于配置文件,配置文件是单独打包变成压缩文件,配置文件的压缩文件也存放在非易失性存储器中,该配置文件其实就是原始配置文件,则原始配置文件的压缩文件是存放在非易失性存储器中,而对配置文件的压缩文件解压后得到的配置文件是存放在内存上的目录中,即解压后的配置文件位于内存目录中,用户能对内存上的数据进行更改,则内存目录上的配置文件能被用户更改,更改后的新配置文件被压缩到非易失性存储器上,则新配置文件压缩后的压缩文件是存放在非易失性存储器中,在系统重新启动后,非易失性存储器上存在原始配置文件的压缩文件和新配置文件的压缩文件,在新配置文件的压缩文件存在的情况下,使用新配置文件,不使用原始配置文件,将新配置文件的压缩文件解压成新配置文件作为当前系统的配置文件,这样保存了用户设置,所以该装置实现在保证系统文件安全性的同时,解决了用户配置的保存问题,能够保存用户配置。Moreover, for the configuration file, the configuration file is packaged separately into a compressed file, and the compressed file of the configuration file is also stored in the non-volatile memory. The configuration file is actually the original configuration file, and the compressed file of the original configuration file is stored in the In the non-volatile memory, the configuration file obtained after decompressing the compressed file of the configuration file is stored in the directory on the internal memory, that is, the configuration file after decompression is located in the internal memory directory, and the user can change the data on the internal memory. Then the configuration file on the memory directory can be changed by the user, and the changed new configuration file is compressed to the non-volatile memory, and the compressed file of the new configuration file is stored in the non-volatile memory, and will be saved when the system restarts. After startup, the compressed file of the original configuration file and the compressed file of the new configuration file exist in the non-volatile memory. If the compressed file of the new configuration file exists, the new configuration file is used instead of the original configuration file, and the new configuration The compressed file of the file is decompressed into a new configuration file as the configuration file of the current system, which saves the user settings, so the device solves the problem of saving the user configuration while ensuring the security of the system files, and can save the user configuration.

以上对本发明所提供的一种Linux系统下保存用户配置的方法及装置进行了详细介绍。本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想。应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以对本发明进行若干改进和修饰,这些改进和修饰也落入本发明权利要求的保护范围内。A method and device for saving user configurations under the Linux system provided by the present invention have been introduced in detail above. In this paper, specific examples are used to illustrate the principle and implementation of the present invention, and the descriptions of the above embodiments are only used to help understand the method and core idea of the present invention. It should be pointed out that for those skilled in the art, without departing from the principle of the present invention, some improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.

Claims (10)

1.一种Linux系统下保存用户配置的方法,其特征在于,包括:1. A method for saving user configuration under a Linux system, characterized in that, comprising: 利用开源工具建立Linux系统下的根文件系统initrd,并在内存中创建新目录newroot;Use open source tools to establish the root file system initrd under the Linux system, and create a new directory newroot in memory; 在所述根文件系统initrd中查找出配置文件,将所述配置文件打压缩包变为配置压缩文件,将所述根文件系统initrd中除了所述配置文件的其它系统文件打压缩包变为系统压缩文件;Find the configuration file in the root file system initrd, compress the configuration file into a configuration compressed file, and compress other system files in the root file system initrd except the configuration file into a system Compressed file; 将所述配置压缩文件和所述系统压缩文件迁移至非易失性存储器中,并将所述配置压缩文件解压至所述内存中的新目录newroot中形成配置文件副本;Migrating the configuration compressed file and the system compressed file to a non-volatile memory, and decompressing the configuration compressed file to a new directory newroot in the internal memory to form a copy of the configuration file; 接收用户输入的更改配置文件指令,在所述更改配置文件指令的作用下,对所述内存中的配置文件副本进行更改得到新配置文件;receiving an instruction to change the configuration file input by the user, and under the action of the instruction to modify the configuration file, modify the copy of the configuration file in the memory to obtain a new configuration file; 利用配置保存命令将所述新配置文件打压缩包,将所述新配置文件压缩至所述非易失性存储器中形成新配置压缩文件;compressing the new configuration file by using the configuration saving command, and compressing the new configuration file into the non-volatile memory to form a new configuration compressed file; 重新启动所述根文件系统initrd时,在所述非易失性存储器中解压所述新配置压缩文件得到所述新配置文件,将所述新配置文件作为当前的Linux系统下的配置文件。When restarting the root file system initrd, decompress the new configuration compressed file in the non-volatile memory to obtain the new configuration file, and use the new configuration file as the configuration file under the current Linux system. 2.如权利要求1所述的方法,其特征在于,所述在内存中创建新目录newroot之后,还包括:2. The method according to claim 1, further comprising: 将所述新目录newroot挂载ramfs文件系统或者tmpfs文件系统。Mount the new directory newroot to the ramfs file system or the tmpfs file system. 3.如权利要求1或2所述的方法,其特征在于,所述在所述根文件系统initrd中查找出配置文件,将所述配置文件打压缩包变为配置压缩文件,将所述根文件系统initrd中除了所述配置文件的其它系统文件打压缩包变为系统压缩文件,包括:3. The method according to claim 1 or 2, wherein the configuration file is found in the root file system initrd, the configuration file is compressed into a configuration compressed file, and the root In the file system initrd, other system files except the configuration file are compressed into system compressed files, including: 在所述根文件系统initrd中查找出涉及用户配置保存的配置文件;Find out the configuration files related to user configuration preservation in the root file system initrd; 将所述配置文件单独打压缩包,形成配置文件压缩包并命名为config-origin.tar.gz;Compress the configuration file separately to form a compressed configuration file and name it config-origin.tar.gz; 将所述根文件系统initrd中其它的系统文件分类打压缩包,形成分类的各个系统压缩文件。Classifying and compressing other system files in the root file system initrd to form compressed files of each classified system. 4.如权利要求3所述的方法,其特征在于,所述利用配置保存命令将所述新配置文件打压缩包,将所述新配置文件压缩至所述非易失性存储器中形成新配置压缩文件,包括:4. The method according to claim 3, wherein the new configuration file is compressed into a compressed package using the configuration saving command, and the new configuration file is compressed into the non-volatile memory to form a new configuration Zip files, including: 利用配置保存命令config-save,对所述新配置文件打压缩包,并命名为config-user.tar.gz,形成config-user.tar.gz压缩文件;Utilize the configuration preservation command config-save to compress the new configuration file and name it config-user.tar.gz to form a config-user.tar.gz compressed file; 挂载所述非易失性存储器,保存config-user.tar.g压缩文件到所述非易失性存储器;Mount the non-volatile memory, save the config-user.tar.g compressed file to the non-volatile memory; 保存完成之后卸载所述非易失性存储器。After the saving is completed, the non-volatile memory is unloaded. 5.如权利要求4所述的方法,其特征在于,所述重新启动所述根文件系统initrd时,在所述非易失性存储器中解压所述新配置压缩文件得到所述新配置文件,将所述新配置文件作为当前的Linux系统下的配置文件,包括:5. The method according to claim 4, wherein when the root file system initrd is restarted, the new configuration compressed file is decompressed in the non-volatile memory to obtain the new configuration file, The new configuration file is used as the configuration file under the current Linux system, including: 在所述根文件系统initrd启动初始化脚本时,利用mount命令挂载所述非易失性存储器到所述根文件系统initrd;When the root file system initrd starts the initialization script, utilize the mount command to mount the non-volatile memory to the root file system initrd; 检测所述非易失性存储器中是否存在config-user.tar.gz压缩文件;如果存在,解压config-user.tar.gz压缩文件到newroot/etc目录,形成所述新配置文件并作为当前linux系统的配置文件。Detect whether there is a config-user.tar.gz compressed file in the non-volatile memory; if it exists, decompress the config-user.tar.gz compressed file to the newroot/etc directory to form the new configuration file and use it as the current linux System configuration files. 6.一种Linux系统下保存用户配置的装置,包括:6. A device for saving user configurations under a Linux system, comprising: 建立模块,用于利用开源工具建立Linux系统下的根文件系统initrd,并在内存中创建新目录newroot;Create a module for using open source tools to establish the root file system initrd under the Linux system, and create a new directory newroot in memory; 第一压缩模块,用于在所述根文件系统initrd中查找出配置文件,将所述配置文件打压缩包变为配置压缩文件,将所述根文件系统initrd中除了所述配置文件的其它系统文件打压缩包变为系统压缩文件;The first compression module is used to search out the configuration file in the root file system initrd, compress the configuration file into a configuration compressed file, and convert other systems in the root file system initrd except the configuration file The file is compressed into a system compressed file; 迁移模块,用于将所述配置压缩文件和所述系统压缩文件迁移至非易失性存储器中,并将所述配置压缩文件解压至所述内存中的新目录newroot中形成配置文件副本;A migration module, configured to migrate the configuration compressed file and the system compressed file to a non-volatile memory, and decompress the configuration compressed file to a new directory newroot in the memory to form a copy of the configuration file; 更改模块,用于接收用户输入的更改配置文件指令,在所述更改配置文件指令的作用下,对所述内存中的配置文件副本进行更改得到新配置文件;The modification module is configured to receive an instruction for modifying a configuration file input by a user, and under the action of the instruction for modifying a configuration file, modify the copy of the configuration file in the memory to obtain a new configuration file; 第二压缩模块,用于利用配置保存命令将所述新配置文件打压缩包,将所述新配置文件压缩至所述非易失性存储器中形成新配置压缩文件;The second compression module is used to compress the new configuration file by using the configuration saving command, and compress the new configuration file into the non-volatile memory to form a new configuration compressed file; 启动模块,用于重新启动所述根文件系统initrd时,在所述非易失性存储器中解压所述新配置压缩文件得到所述新配置文件,将所述新配置文件作为当前的Linux系统下的配置文件。The startup module is used to decompress the new configuration compressed file in the non-volatile memory to obtain the new configuration file when restarting the root file system initrd, and use the new configuration file as the current Linux system. configuration file. 7.如权利要求6所述的装置,其特征在于,所述装置还包括:7. The device of claim 6, further comprising: 挂载模块,用于将所述新目录newroot挂载ramfs文件系统或者tmpfs文件系统。The mounting module is used to mount the new directory newroot to the ramfs file system or the tmpfs file system. 8.如权利要求6或7所述的装置,其特征在于,所述第一压缩模块包括:8. The device according to claim 6 or 7, wherein the first compression module comprises: 查找单元,用于在所述根文件系统initrd中查找出涉及用户配置保存的配置文件;A search unit, configured to find configuration files related to user configuration storage in the root file system initrd; 单独压缩单元,用于将所述配置文件单独打压缩包,形成配置文件压缩包并命名为config-origin.tar.gz;A separate compression unit, configured to compress the configuration file separately to form a configuration file compression package and name it config-origin.tar.gz; 分类压缩单元,用于将所述根文件系统initrd中其它的系统文件分类打压缩包,形成分类的各个系统压缩文件。The classification compression unit is used to classify and compress other system files in the root file system initrd to form compressed files of each system in classification. 9.如权利要求8所述的装置,其特征在于,所述第二压缩模块包括:9. The apparatus of claim 8, wherein the second compression module comprises: 保存单元,用于利用配置保存命令config-save,对所述新配置文件打压缩包,并命名为config-user.tar.gz,形成config-user.tar.gz压缩文件;The storage unit is used to utilize the configuration preservation command config-save to compress the new configuration file and name it config-user.tar.gz to form a config-user.tar.gz compression file; 挂载单元,用于挂载所述非易失性存储器,保存config-user.tar.g压缩文件到所述非易失性存储器;a mounting unit, configured to mount the non-volatile memory, and save the config-user.tar.g compressed file to the non-volatile memory; 卸载单元,用于保存完成之后卸载所述非易失性存储器。The unloading unit is configured to unload the non-volatile memory after saving. 10.如权利要求9所述的装置,其特征在于,所述启动模块包括:10. The device according to claim 9, wherein the startup module comprises: 初始化模块,用于在所述根文件系统initrd启动初始化脚本时,利用mount命令挂载所述非易失性存储器到所述根文件系统initrd;An initialization module, configured to use a mount command to mount the non-volatile memory to the root file system initrd when the root file system initrd starts the initialization script; 检测模块,用于检测所述非易失性存储器中是否存在config-user.tar.gz压缩文件;如果存在,解压config-user.tar.gz压缩文件到newroot/etc目录,形成所述新配置文件并作为当前linux系统的配置文件。The detection module is used to detect whether there is a config-user.tar.gz compressed file in the non-volatile memory; if it exists, decompress the config-user.tar.gz compressed file to the newroot/etc directory to form the new configuration The file is used as the configuration file of the current linux system.
CN201510515998.3A 2015-08-20 2015-08-20 The method and device of user configuration is preserved under a kind of Linux system Active CN105138362B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510515998.3A CN105138362B (en) 2015-08-20 2015-08-20 The method and device of user configuration is preserved under a kind of Linux system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510515998.3A CN105138362B (en) 2015-08-20 2015-08-20 The method and device of user configuration is preserved under a kind of Linux system

Publications (2)

Publication Number Publication Date
CN105138362A true CN105138362A (en) 2015-12-09
CN105138362B CN105138362B (en) 2018-09-07

Family

ID=54723719

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510515998.3A Active CN105138362B (en) 2015-08-20 2015-08-20 The method and device of user configuration is preserved under a kind of Linux system

Country Status (1)

Country Link
CN (1) CN105138362B (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105786489A (en) * 2016-02-18 2016-07-20 山东乾云启创信息科技股份有限公司 Safe and state-free construction method for virtualized computational node
CN105825126A (en) * 2016-03-08 2016-08-03 北京网康科技有限公司 File protecting method and device
CN107861751A (en) * 2017-11-22 2018-03-30 出门问问信息科技有限公司 The amending method and device of configuration file
CN109271206A (en) * 2018-08-24 2019-01-25 晶晨半导体(上海)股份有限公司 A kind of memory compression and store method that exception is live
CN109739823A (en) * 2018-12-27 2019-05-10 郑州云海信息技术有限公司 A method and device for building a parallel file system
CN111242577A (en) * 2020-01-13 2020-06-05 中国建设银行股份有限公司 RPA process automation robot deployment method and device and electronic equipment
CN111367854A (en) * 2018-12-25 2020-07-03 成都鼎桥通信技术有限公司 Construction method of multi-container root file system
CN111813460A (en) * 2020-06-01 2020-10-23 北京百卓网络技术有限公司 Access method, device, equipment and storage medium for application program matching file
CN113132354A (en) * 2021-03-19 2021-07-16 重庆扬成大数据科技有限公司 Working method for carrying out file processing optimization configuration by remotely logging in government affair data network
CN115629811A (en) * 2022-12-21 2023-01-20 苏州浪潮智能科技有限公司 System stability control method and device
CN115640758A (en) * 2022-12-23 2023-01-24 南京维拓科技股份有限公司 Three-dimensional model digital quality inspection method based on knowledge construction

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102831022A (en) * 2012-07-27 2012-12-19 曙光信息产业(北京)有限公司 Method and device for modifying system configuration
CN103634144A (en) * 2013-11-15 2014-03-12 新浪网技术(中国)有限公司 Method, system and equipment for managing multi-IDC (internet data center) cluster configuration file
CN103888491A (en) * 2012-12-20 2014-06-25 鸿富锦精密工业(深圳)有限公司 Diskless workstation start system and method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102831022A (en) * 2012-07-27 2012-12-19 曙光信息产业(北京)有限公司 Method and device for modifying system configuration
CN103888491A (en) * 2012-12-20 2014-06-25 鸿富锦精密工业(深圳)有限公司 Diskless workstation start system and method
CN103634144A (en) * 2013-11-15 2014-03-12 新浪网技术(中国)有限公司 Method, system and equipment for managing multi-IDC (internet data center) cluster configuration file

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105786489B (en) * 2016-02-18 2019-05-17 山东乾云启创信息科技股份有限公司 A kind of construction method of the stateless virtualization calculate node of safety
CN105786489A (en) * 2016-02-18 2016-07-20 山东乾云启创信息科技股份有限公司 Safe and state-free construction method for virtualized computational node
CN105825126A (en) * 2016-03-08 2016-08-03 北京网康科技有限公司 File protecting method and device
CN107861751A (en) * 2017-11-22 2018-03-30 出门问问信息科技有限公司 The amending method and device of configuration file
CN109271206A (en) * 2018-08-24 2019-01-25 晶晨半导体(上海)股份有限公司 A kind of memory compression and store method that exception is live
CN111367854B (en) * 2018-12-25 2023-02-28 成都鼎桥通信技术有限公司 Construction method of multi-container root file system
CN111367854A (en) * 2018-12-25 2020-07-03 成都鼎桥通信技术有限公司 Construction method of multi-container root file system
CN109739823A (en) * 2018-12-27 2019-05-10 郑州云海信息技术有限公司 A method and device for building a parallel file system
CN111242577A (en) * 2020-01-13 2020-06-05 中国建设银行股份有限公司 RPA process automation robot deployment method and device and electronic equipment
CN111813460A (en) * 2020-06-01 2020-10-23 北京百卓网络技术有限公司 Access method, device, equipment and storage medium for application program matching file
CN113132354A (en) * 2021-03-19 2021-07-16 重庆扬成大数据科技有限公司 Working method for carrying out file processing optimization configuration by remotely logging in government affair data network
CN115629811A (en) * 2022-12-21 2023-01-20 苏州浪潮智能科技有限公司 System stability control method and device
WO2024130986A1 (en) * 2022-12-21 2024-06-27 苏州元脑智能科技有限公司 System stability control method and apparatus
CN115640758A (en) * 2022-12-23 2023-01-24 南京维拓科技股份有限公司 Three-dimensional model digital quality inspection method based on knowledge construction

Also Published As

Publication number Publication date
CN105138362B (en) 2018-09-07

Similar Documents

Publication Publication Date Title
CN105138362B (en) The method and device of user configuration is preserved under a kind of Linux system
US10986179B1 (en) Cloud-based snapshot replication
US11681590B2 (en) File level recovery using virtual machine image level backup with selective compression
US8660994B2 (en) Selective data deduplication
CN103176864B (en) Backup method and device based on android system and mobile terminal
US9501492B2 (en) Combination journaling/non-journaling file system
US10970254B2 (en) Utilization of tail portions of a fixed size block in a deduplication environment by deduplication chunk virtualization
US9684665B2 (en) Storage apparatus and data compression method
US20110093437A1 (en) Method and system for generating a space-efficient snapshot or snapclone of logical disks
KR20080097196A (en) Computer-implemented method, system and computer readable medium for compressing individual files on a FAT volume and keeping other files uncompressed
US9274907B1 (en) Decommissioning of virtual backup appliances
CN109445861A (en) System start method, device, computer installation and storage medium
CN111258666B (en) Computer file reading method, device, computer system and storage medium
CN105205142A (en) Method, device and mobile terminal for saving log file
CN107783724A (en) A kind of generation method and device of full image file
US20150106334A1 (en) Systems and methods for backing up a live virtual machine
US10459807B2 (en) Determining modified portions of a RAID storage array
US10776342B2 (en) Systems and methods for recovering lost clusters from a mounted volume
CN104484132A (en) Data reduction method and device
US9405709B1 (en) Systems and methods for performing copy-on-write operations
US20210034265A1 (en) Compressed extent versions
CN107807791A (en) A kind of hard disc of computer sequence binding method and system
US20160077747A1 (en) Efficient combination of storage devices for maintaining metadata
US20150089486A1 (en) Method of Firmware Upgrade
WO2017173924A1 (en) Method and device for switching between file systems

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
OL01 Intention to license declared
OL01 Intention to license declared