CN102243602B - Method for saving system configuration by using flash memory in Linux system - Google Patents

Method for saving system configuration by using flash memory in Linux system Download PDF

Info

Publication number
CN102243602B
CN102243602B CN 201010171231 CN201010171231A CN102243602B CN 102243602 B CN102243602 B CN 102243602B CN 201010171231 CN201010171231 CN 201010171231 CN 201010171231 A CN201010171231 A CN 201010171231A CN 102243602 B CN102243602 B CN 102243602B
Authority
CN
China
Prior art keywords
configuration
file
configuration item
backup
flash memory
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.)
Active
Application number
CN 201010171231
Other languages
Chinese (zh)
Other versions
CN102243602A (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.)
Shanghai Longcheer Technology Co Ltd
Original Assignee
XI'AN LONGFEI SOFTWARE 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 XI'AN LONGFEI SOFTWARE CO Ltd filed Critical XI'AN LONGFEI SOFTWARE CO Ltd
Priority to CN 201010171231 priority Critical patent/CN102243602B/en
Publication of CN102243602A publication Critical patent/CN102243602A/en
Application granted granted Critical
Publication of CN102243602B publication Critical patent/CN102243602B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a method for saving system configuration by using a flash memory in a Linux system, realizing balanced processing for abrasion caused by flash memory operation when the flash memory is used for saving configuration information and solving the problems of bad blocks and system configuration damages caused by system power-off in a flash memory erasing and writing process. In the method, a list is used for distinguishing current configuration and backup configuration, configuration items are made corresponding to configuration file names, the functions of file finding and file completeness detection of a file system are utilized, and when the configuration items are abnormal, the restoration of the current configuration and the backup configuration is realized.

Description

Use the method for flash memory saved system configuration in a kind of linux system
Technical field
The present invention relates to field of computer, relate in particular to a kind of in linux system the method based on the reliable saved system configuration that is based upon read-write file system on the flash memory.
Background technology
At present basically have two kinds with flash memory as the method for the embedded system saved system configuration of storage medium, a kind of is by the direct operating flash memory subregion of MTD interface, and system configuration is kept in the fixing MTD subregion; Another kind is that system configuration is kept in the read-write file system, uses existing database saved system configuration.First method needs structure and the querying method of designed, designed configuration item, and be difficult to realize the abrasion equilibrium processing of flash memory, especially for the flash memory of NAND type, if appearring in the subregion of saved system configuration, bad piece will cause the whole system configuration to damage, in addition, flash memory is generally erasable by piece, if device powers down will cause system configuration to need full recovery in erasable process; Second method has been utilized the abrasion equilibrium function of flash memory file system, but still faces the problem that outage need to recover whole system configuration in the erasable process.
Summary of the invention
In order to solve the deficiency of existing system configuration management mode, the present invention proposes a kind of method that under linux system, disposes based on the reliable saved system that is based upon the read-write file system on the flash memory.The characteristic that the method has mainly been utilized the ff of file system self, the abrasion equilibrium of flash memory is processed, with two different current configurations of catalogue saved system and system configuration backup, and each configuration item is saved in an independent file realizes, guaranteed that the damage of single configuration item file can not have influence on other configuration items.The specific implementation step of this method is as follows:
(1) default value of the configuration item of system configuration and configuration item is kept in the system in the mode of text, this file is kept at a fixed position, file reading out data and can not carry out write operation to this file from then on only during the administration configuration item recovers when the individual configuration item damages guaranteeing.
(2) system configuration is carried out initialization during device start, initialized process comprises: at first whether the current configuration of check system and system configuration backup directory exist, and if there is no then create; Then all configuration items in the Ergodic Theory default configuration file, with the configuration item file in the current config directory of open function opening system and the system configuration backup directory, judge whether the configuration item file exists or no normal with the rreturn value of this function, if two catalogue Files are all normal and identical then continue to judge next configuration item; If two catalogue Files all normally but not identical are then used the configuration item in the configuration item recovery system configuration backup catalogue in the current config directory of system; If the file in catalogue does not exist or occurs unusually, then recover with the file in another catalogue; If the file in two catalogues do not exist or occur unusual, the configuration item in recover these two catalogues with the default configuration in the system default configuration file.
When (3) needing to read the currency of a configuration item in system's operational process, only need the configuration item file in the current config directory of reading system; If this file occurs unusual, then the configuration item file in the reading system configuration backup catalogue; If these two files all have problems, then the default value in the reading system default configuration file.
When (4) needing the value of a configuration item is set in system's operational process, configuration item in the current config directory of system need to be set first, configuration item in the system configuration backup directory is set again, can guarantee like this if when the transition that two files are set is cut off the power supply constantly, can return to latest configuration during system initialization.
The invention has the beneficial effects as follows: when having realized utilizing flash memory to preserve configuration information, the abrasion equilibrium of flash disk operation is processed, solved the problem of the system configuration damage that system cut-off causes in bad piece and the flash memory wiping/writing process.
Advantage of the present invention is: and concrete flash type is irrelevant, and NOR and nand flash memory all are suitable for; Be convenient to transplant, can be applied to YAFFS2 and JFFS2 etc. and be based upon file system on the flash memory.
Description of drawings
Fig. 1 is system installing structure synoptic diagram of the present invention;
Fig. 2 is the process flow diagram of initialization system configuration of the present invention.
Implementation method
How further specify the present invention below in conjunction with accompanying drawing realizes:
Realize a configuration management function library, by this function library operation default configuration file, current configuration and backup configuration.
The initialize process of system need to carry out initialization to system configuration, and the initialization flow process as shown in Figure 2.At first enumerate the configuration item in the default configuration file, open under the current configuration respective file and check by the title of configuration item, if file is normal configuration item in the backup configuration is checked, the value that compares two configuration items if the backup configuration item is normal, process next configuration item if be worth identical then continue, cover the backup configuration item if the backup configuration item is unusual or value does not coexist with current configuration item; If current configuration item is checking the backup configuration item unusually, if the backup configuration item normally then recover current configuration item with the backup configuration item; If two configuration items all unusually then create configuration item according to default configuration.
Other processes must waiting system the configuration initialization could read and write configuration information after finishing.For same configuration item, if there is simultaneously the integrality that surpasses a read-write requests then lock to guarantee file content by file read-write.

Claims (5)

1. use the method for flash memory saved system configuration in the linux system, the method at linux system, file system and flash memory device in conjunction with realizing that it is characterized in that: the method for described use flash memory saved system configuration may further comprise the steps:
(1) default value of the configuration item of system configuration and configuration item is kept in the system in the mode of text, this file is kept at a fixed position, file reading out data and can not carry out write operation to this file from then on only during the administration configuration item recovers when the individual configuration item damages guaranteeing;
(2) system configuration is carried out initialization during device start, at first whether the current configuration of check system and system configuration backup directory exist, and if there is no then create; Then all configuration items in the Ergodic Theory default configuration file, with the configuration item file in the current config directory of open function opening system and the system configuration backup directory, judge whether the configuration item file exists or no normal with the rreturn value of this function, if two catalogue Files are all normal and identical then continue to judge next configuration item; If two catalogue Files all normally but not identical are then used the configuration item in the configuration item recovery system configuration backup catalogue in the current config directory of system; If the file in catalogue does not exist or occurs unusually, then recover with the file in another catalogue; If the file in two catalogues do not exist or occur unusual, the configuration item in recover these two catalogues with the default configuration in the system default configuration file;
When (3) needing to read the currency of a configuration item in system's operational process, only need the configuration item file in the current config directory of reading system; If this file occurs unusual, then the configuration item file in the reading system configuration backup catalogue; If these two files all have problems, then the default value in the reading system default configuration file;
When (4) needing the value of a configuration item is set in system's operational process, configuration item in the current config directory of system need to be set first, configuration item in the system configuration backup directory is set again, can guarantee like this when the transition that two files are set is cut off the power supply constantly, can return to latest configuration during system initialization.
2. use the method for flash memory saved system configuration in a kind of linux system described in according to claim 1, it is characterized in that: use different catalogues to preserve current configuration and configuration backup, each configuration item has an individual files in current config directory and backup configuration catalogue, guarantee that the damage of single configuration item can not affect other configuration items.
3. use the method for flash memory saved system configuration in a kind of linux system described in according to claim 1, it is characterized in that: the configuration item in described current config directory and the backup configuration catalogue backups each other, use backup configuration to recover during current arrangement abnormalities, use current configuration restore when backup configuration is unusual.
4. use the method for flash memory saved system configuration in a kind of linux system described in according to claim 1, it is characterized in that: use the configuration item title corresponding one by one with the file name in current config directory and the backup configuration catalogue, can utilize like this ff function of file system self to search configuration item.
5. use the method for flash memory saved system configuration in a kind of linux system described in according to claim 1, it is characterized in that: utilize the File Integrity Checking functional check configuration item file of file system self whether normal.
CN 201010171231 2010-05-11 2010-05-11 Method for saving system configuration by using flash memory in Linux system Active CN102243602B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201010171231 CN102243602B (en) 2010-05-11 2010-05-11 Method for saving system configuration by using flash memory in Linux system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201010171231 CN102243602B (en) 2010-05-11 2010-05-11 Method for saving system configuration by using flash memory in Linux system

Publications (2)

Publication Number Publication Date
CN102243602A CN102243602A (en) 2011-11-16
CN102243602B true CN102243602B (en) 2013-03-27

Family

ID=44961671

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201010171231 Active CN102243602B (en) 2010-05-11 2010-05-11 Method for saving system configuration by using flash memory in Linux system

Country Status (1)

Country Link
CN (1) CN102243602B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102609336B (en) * 2012-01-19 2013-12-25 青岛海信传媒网络技术有限公司 Data administration method and data administration system
CN103514013A (en) * 2013-09-11 2014-01-15 深圳市共进电子股份有限公司 Gateway product FLASH configuration loss processing method
CN103500128A (en) * 2013-09-30 2014-01-08 上海斐讯数据通信技术有限公司 NVRAM data backup method
CN105718330A (en) * 2016-01-15 2016-06-29 浪潮(北京)电子信息产业有限公司 Linux system backup data recovery method and device
CN109522153A (en) * 2018-10-15 2019-03-26 广东宝莱特医用科技股份有限公司 A kind of configuration file self-repairing method and system for patient monitor

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1886729A (en) * 2003-09-24 2006-12-27 T1科技有限公司 Method and device for starting a computer system
CN101221507A (en) * 2008-01-24 2008-07-16 中兴通讯股份有限公司 Device, system and method for automatically installing network television incremental value service
CN101490645A (en) * 2006-07-10 2009-07-22 Vm设备有限公司 Method and apparatus for virtualization of appliances

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100642045B1 (en) * 2005-08-09 2006-11-10 (주)씨앤에스 테크놀로지 The system and method for downloading multimedia program from host processor to multimedia processor

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1886729A (en) * 2003-09-24 2006-12-27 T1科技有限公司 Method and device for starting a computer system
CN101490645A (en) * 2006-07-10 2009-07-22 Vm设备有限公司 Method and apparatus for virtualization of appliances
CN101221507A (en) * 2008-01-24 2008-07-16 中兴通讯股份有限公司 Device, system and method for automatically installing network television incremental value service

Also Published As

Publication number Publication date
CN102243602A (en) 2011-11-16

Similar Documents

Publication Publication Date Title
CN102243602B (en) Method for saving system configuration by using flash memory in Linux system
CN101477482B (en) Method for recovering flash memory data at power-off of built-in Linux system
CN101251826B (en) Flash memory, method and apparatus for data management of flash memory
US20100064127A1 (en) Method for updating basic input/output system and method for repairing thereof
US20070050675A1 (en) [method for restoring a booted system]
CN101582076A (en) Data de-duplication method based on data base
CN103049070A (en) Cache data power failure protection method and computer equipment
CN102792276A (en) Buffer disk in flashcopy cascade
CN104636217A (en) Root file system automatic backup and exception recovery method and partition structure
CN100437504C (en) Hard disc data backup system and method
US20100037092A1 (en) System and method for backup, reboot, and recovery
CN110502281A (en) A kind of method of embedded device starting linux kernel and file system
CN103530138A (en) Method and device for protecting file system data based on embedded LINUX
CN103366831A (en) Detection method for memory
EP1764687B1 (en) Method for restoring a booted system
CN103914407A (en) Secure digital memory (SD) card power down protection and restoring method and SD card with power down protection function
CN105468544A (en) Method and apparatus for realizing power-failure-proof file system, and power-failure-proof file system
CN108958978A (en) A kind of MCU data reconstruction method and system
CN1936866A (en) Flash memory body storing mechanism with data restoring function
JP2012530285A (en) Method and apparatus for maintaining key information area of file system
CN1277209C (en) Hard disk data controlling method
CN100395713C (en) Method of automatic repairing basic input output system element and module
CN103176867A (en) Fast file differential backup method
US8260748B1 (en) Method and apparatus for capturing data from a backup image
CN102360300B (en) Starting method and device of operation system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
ASS Succession or assignment of patent right

Owner name: SHANGHAI LONGCHEER TECHNOLOGY CO., LTD.

Free format text: FORMER OWNER: XI AN LONGFEI SOFTWARE CO., LTD.

Effective date: 20150814

C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20150814

Address after: 200233, No. 401, building 1, building No. 1, Caobao Road, Shanghai, Xuhui District

Patentee after: SHANGHAI LONGCHEER TECHNOLOGY CO., LTD.

Address before: High tech Zone technology two road 710000 Shaanxi city of Xi'an Province, No. 68 Xi'an Software Park Development Center Qingfeng Ge C201-5

Patentee before: Xi'an Longfei Software Co., Ltd.