CN100334566C - Method for accessing any sector of hard disk from file system - Google Patents

Method for accessing any sector of hard disk from file system Download PDF

Info

Publication number
CN100334566C
CN100334566C CNB021293821A CN02129382A CN100334566C CN 100334566 C CN100334566 C CN 100334566C CN B021293821 A CNB021293821 A CN B021293821A CN 02129382 A CN02129382 A CN 02129382A CN 100334566 C CN100334566 C CN 100334566C
Authority
CN
China
Prior art keywords
mapping
hard disk
sector
operational zone
factor
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.)
Expired - Fee Related
Application number
CNB021293821A
Other languages
Chinese (zh)
Other versions
CN1480849A (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.)
Lenovo Beijing Ltd
Original Assignee
Lenovo Beijing 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 Lenovo Beijing Ltd filed Critical Lenovo Beijing Ltd
Priority to CNB021293821A priority Critical patent/CN100334566C/en
Publication of CN1480849A publication Critical patent/CN1480849A/en
Application granted granted Critical
Publication of CN100334566C publication Critical patent/CN100334566C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

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

Abstract

The present invention belongs to the technical field of an accessing, addressing or assigning method in a memory system or an architecture. The present invention comprises the steps that a hard disk is divided into a plurality of areas which are represented by definite physical positions; access quests for device files in a file system are processed by using a mapping algorithm; a current mapping factor is obtained through activation; when an access address is positioned in a current operational area, offset quantity in the operational area is calculated, and then the access address is accessed; if the access address is not positioned in the current operational area, a mapping loading process is invoked to reset the operational area so as to update the mapping factor, and then the access address is accessed according to the offset quantity in the new operational area after calculation. The present invention can solve the problems that data access is limited; arbitrary sectors of the hard disk can not be accessed through the file system; the access to the arbitrary sectors of the hard disk by a hard disk driver has risks caused by driver modification. The present invention has good applicability and is particularly applicable to operating environments similar to embedded systems.

Description

The method of access hard disk any sector in file system
Technical field
The invention belongs to access in accumulator system or architecture, addressing or distribution method technical field, especially a kind of in file system the method for access hard disk any sector.
Background technology
File in the computer system is the logical organization and the form of expression of data, in the time of will visiting data in the file usually, file could be showed by discernible logical form by the location and the tissue of file system.File system bring efficient access and rationally abstract in, also brought all restrictions to the data visit.Under a definite file system, the file storage location of user-accessible can be restricted, and this is not only relevant with the structure of file system, and also the bottom function interface that provides with operating system is relevant.Access hard disk any sector in file system is not all right by file system only.If direct driver access hard disk any sector by hard disk, the driver of then revising hard disk will be referred to many compatibility issues, danger is bigger, and directly provides such interface to upper-layer user's program by hard drive, will destroy the encapsulation of hardware.
Summary of the invention
For overcoming above-mentioned deficiency, the object of the present invention is to provide a kind of in file system the method for access hard disk any sector, it can be realized specifying the non-limited accass of any sector of hard disk.
For finishing the foregoing invention purpose, the technical scheme that the present invention takes is: a kind of in file system the method for access hard disk any sector, comprise hard disk partition being a plurality of by the wait operational zone of determining that physical location is represented, request of access to the device file in the file system is handled with mapping algorithm, activate and obtain current mapping-factor, when but being in current operational zone, calculates reference address the side-play amount in this current operational zone, conduct interviews, if but reference address is not in current operational zone, but then call the mapping loading procedure and reset the operational zone, upgrade mapping-factor, but and the step that conducts interviews according to the side-play amount in the new operational zone after calculating.
The dividing region size can allow the full-size of access file less than the file system of current use; Said Activiation method refers to by mapping algorithm determines a mapping-factor, this mapping-factor is passed to the loading function that is in operating system nucleus as parameter, but the hard drive space of being used in the system being represented to read or write between the physical location that on the block device file of operational zone and the hard disk that this mapping-factor is represented one section is used to store data by loading function connects; Said mapping-factor refers to prior ready-portioned wait operational zone on the numeral hard disk; But said loading function refers to being used in the system represented to read or write one section computer program means that the hard drive space between the physical location that on the hard disk that the mapping-factor of the block device file of operational zone and current system maintenance represents one section is used to store data connects; The loading method of dynamic load function comprises the mapping-factor that calculates of contrast and the mapping-factor of current system maintenance, if it is identical, do not carry out load operation, if it is different, by the system call of adding to oneself load request is proposed, but and finish the step that the space relationship between one section physical location on the hard disk that the mapping-factor of the block device file of being represented read or write the operational zone being used in the system and current system maintenance represents is got up by this system call in the operating system nucleus attitude; The sector that mapping algorithm is responsible for the calculation requirement visit is which to be in wait in the operational zone, and calculates corresponding mapping-factor and the position offset in this wait operational zone; But but only there is the operational zone of writing of reading an operational zone and an activation of an activation on any time hard disk; The mapping loading function that utilization is in the operating system kernel attitude dynamically loads the block device file in a certain wait operational zone to the pre-determined file system, realizes the sector of optional position on the hard disk is conducted interviews by the visit to this document.
The present invention adopts increases interface that operating system nucleus provides and the physical layer interface scheme that realizes in conjunction with existing file system characteristics, has significant technique effect, it had both utilized ripe operating system and file system in the operational high efficiency of file access, avoided the hard disk addressing space limited by file system again, but for the routine access of user's attitude not the hard drive space in the file system opereating specification a kind of good solution is provided, this especially has good applicability in the operating environment of similar embedded system.
Description of drawings
Fig. 1 is hard disk operation plot structure figure of the present invention;
Fig. 2 is the operational flowchart of interface of the present invention;
Fig. 3 is that the present invention waits for operational zone dynamic load process synoptic diagram.
Embodiment
One embedded Linux system (a kind of multiple-access computer operating system that can freely use) as memory device, is realized the backup and the restore funcitons of system with hard disk thereon.Data mode and the crash consistency of recovering the back data mode will realize read-write function to all data that are kept at the optional position on the hard disk in order to realize backing up, but this can't only rely on the existing operation to file of file system to realize.Use access mode of the present invention, use the block device file under two Linux, be respectively applied for read data and write data, the Data Position of read and write is distinguished by the logical block sevtor address of hard disk, by mapping to the logical block sevtor address of request visit, calculating is mapped to the request of data of read and write respectively on two device files that can use mapping loading function dynamic load at any time, physics on these two corresponding pre-determined hard disks of device files difference is waited for the operational zone, thereby by these two device files are constantly remapped the access mechanism of realizing any sector of appointment, the result has just realized the read-write function of any one sectors of data on the hard disk.
Consulting Fig. 1, is the whole LBA (Logical Block Addressing) spatial division of hard disk to determine wait operational zone 1,2, the 3......x+1 of size one by one, and each waits for that the size of operational zone is pre-determined.
Consult Fig. 2, the sector content of a certain definite position on the upper procedure request access system on a certain hard disk; This hard disk is by the expression of the numbering of the hard disk in the current system; this sector is represented by its LBA (Logical Block Addressing); these all pass to physical layer interface as parameter; judge the access permission authority of this process and the license restrictions of reference address; different processes has different accessible address restrictions; the security that this has increased the dirigibility of this interface and has increased interface and access process; prevent that undelegated malicious process from illegally reading and writing protected data; after request of access obtains permission; utilizing mapping algorithm that the LBA (Logical Block Addressing) sevtor address that passes accessing port is done mapping handles; obtain this sector and be arranged in which piece wait operational zone; mapping algorithm can be called projection algorithm; its principle is waited for the operational zone for which the concrete logic sector position of determining the requirement visit according to the physical location border of pre-determined wait operational zone is in, this wait operational zone of acquisition expression.
Mapping algorithm adopts the principle of projection, the size of supposing the wait operational zone on the pre-determined hard disk is pG, needing the access hard disk logical block number now is content in the sector of a, then a/ (p*1024*1024*1024/512) divide exactly b, complementation gets m, wherein 1024*1024*1024 represents the 1G byte number, divided by 512 expressions byte number is changed into sector number, the b that obtains, this number just represents that the numbering of the residing wait operational zone, sector of current requirement visit is a mapping-factor, it is since 0, and the m that obtains is the side-play amount in this wait operational zone.That is:
Mapping-factor b=rounds a/ (p*1024*1024*1024/512)
Side-play amount m=complementation a/ (p*1024*1024*1024/512)
Wherein a is the numbering that requires the sector visited, and p is the size of the wait operational zone on the pre-determined hard disk.
Simultaneously, utilize mapping algorithm to obtain representing that this sector is arranged in the mapping-factor which piece is waited for the operational zone, judge whether system has the mapping-factor of safeguarding, as do not have, represent the operational zone that is not activated in the current system, at this moment should call the dynamic load function that is in the operating system nucleus phychology according to the mapping-factor that mapping algorithm calculates, connect but be used for block device file readable or the write operation district in wait operational zone that the mapping-factor that calculates is represented and the system, promptly finish dynamic load one time.The loading method of dynamic load function is: the mapping-factor that contrast calculates and the mapping-factor of current system maintenance, if it is identical, do not carry out load operation, if it is different, by proposing load request to the system call of oneself adding, but and finish the function that the space relationship between one section physical location on the hard disk that the mapping-factor of the block device file of being represented read or write the operational zone being used in the system and current system maintenance represents is got up in the operating system nucleus attitude by this system call, because these operation stepss are driven by the comparative result of the mapping-factor that calculates, do not need the interference of upper procedure, so be transparent finishing automatically, can be called dynamic load for the program of calling interface.The mapping-factor of supposing to import into the operating system nucleus attitude for *, the size of the wait operational zone on the pre-determined hard disk is pG, but pre-determinedly be used for block device file that dynamic load reads the operational zone and be/dev/hda15, then the 16th (15+1) element appointment/dev/hda15 with hd->part array represents that reference position is logical block sector number x*p*1024*1024*1024/512 on the hard disk in the system call function body of kernel state, size is the p*1024*1024*1024/512 sector, that is:
hd->part[15].start_sect=x*p*1024*1024*1024/512
(start address in which section hard-disc storage space that block device file/dev/hda15 represents is a unit with the sector)
hd->part[15].nr_sects=p*1024*1024*1024/512,
(which section shared size in hard-disc storage space that block device file/dev/hda15 represents is a unit with the sector)
This moment just mapping-factor (since 0) but * the wait operational zone of expression is loaded as the current operational zone of reading, so far loading procedure finishes, but this is read the operational zone and can visit by/dev/hda15 now.Simultaneously, but this moment be used for representing that current system mapping-factor readable or the write operation district is the activation mapping-factor of system maintenance; Judge whether system has the mapping-factor of safeguarding, if any, represent to have existed in the current system operational zone that is activated, at this moment will compare with the mapping-factor of current system maintenance according to the mapping-factor that mapping algorithm calculates, if it is identical, show that but sector that current appointment will be visited just in time is in the readable or write operation district in the current system, at this moment do not need the dynamic load function to deal with, as long as visit according to the side-play amount that current mapping algorithm obtains, if the mapping-factor that calculates specifically is different with the mapping-factor of the current maintenance of system, show and this time require the sector of visit to be arranged in the current wait operational zone that is not activated of system, at this moment, call the dynamic load function that is in the operating system nucleus attitude, but being used for block device file readable or the write operation district in wait operational zone that the new mapping-factor that will calculate is again represented and the system connects, promptly finish dynamic load one time, simultaneously, be used for representing that but current system mapping-factor readable or the write operation district is the activation mapping-factor of system maintenance this moment, the new mapping-factor that activation mapping-factor is promptly calculated is now specifically replaced, through above-mentioned steps, the side-play amount address that obtain according to mapping algorithm this moment is with regard to addressable this designated sector.
But but only there is the operational zone of writing of reading an operational zone and an activation of an activation on any time hard disk, but wait operational zone physically just becomes the operational zone after activating, but a definite device file in the corresponding system in operational zone.Consult Fig. 3, the physics that activates waits for that the operational zone gets final product the operational zone and represented by a mapping-factor, read mapping-factor n before the dynamic load, write mapping-factor m before the dynamic load, read mapping-factor x after the dynamic load, write mapping-factor y after the dynamic load, each physics waits for that the position of operational zone is constant on hard disk, but mapping-factor is to wait for that with the physics that activates the operational zone changes, but shine upon by the sector position to request visit and to calculate the request visit that makes when opening device file and all be within the operational zone, this is to wait for that by changing the corresponding again physics that activates of mapping-factor the operational zone realizes.The mapping loading function that utilization is in the operating system kernel attitude loads this wait operational zone to pre-determined device file dynamically, realizes the sector of optional position on the hard disk is conducted interviews by the visit to this document.

Claims (8)

1, a kind of in file system the method for access hard disk any sector, it is characterized in that it may further comprise the steps:
(a) be hard disk partition a plurality of by the wait operational zone of determining that physical location is represented;
(b) request of access of the device file in the file system is handled with mapping algorithm, activated and obtain current mapping-factor, but when the visit sector is in current operational zone, but the side-play amount of calculating in this current operational zone, the sector conducts interviews;
(c) if but the visit sector is not in current operational zone, reset the operational zone but then call the mapping loading procedure, upgrade mapping-factor, but and according to the sector that conducts interviews of the side-play amount in the new operational zone after calculating.
2, according to claim 1 in file system the method for access hard disk any sector, it is characterized in that: the dividing region size can allow the full-size of access file less than the file system of current use.
3, according to claim 1 in file system the method for access hard disk any sector, it is characterized in that: said activation step refers to by mapping algorithm determines a mapping-factor, this mapping-factor is passed to the loading function that is in operating system nucleus as parameter, but the hard drive space of being used in the system being represented to read or write between the physical location that on the block device file of operational zone and the hard disk that this mapping-factor is represented one section is used to store data by loading function connects.
4, according to claim 1 in file system the method for access hard disk any sector, it is characterized in that: said mapping-factor refers to prior ready-portioned wait operational zone on the numeral hard disk.
5, according to claim 1 in file system the method for access hard disk any sector, it is characterized in that: the sector that mapping algorithm is responsible for the calculation requirement visit is which to be in wait in the operational zone, and calculates corresponding mapping-factor and the position offset in this wait operational zone.
6, according to claim 1 in file system the method for access hard disk any sector, it is characterized in that: but but only have the operational zone of writing of reading an operational zone and an activation of an activation on any time hard disk.
7, according to claim 1 in file system the method for access hard disk any sector, it is characterized in that: utilize the loading function be in the operating system kernel attitude dynamically to load block device file in a certain wait operational zone to the pre-determined file system, realize the sector of optional position on the hard disk is conducted interviews by visit to this document.
8, according to claim 7 in file system the method for access hard disk any sector, it is characterized in that: the step of the dynamic load of said loading function:
The mapping-factor that contrast calculates and the mapping-factor of current system maintenance, if it is identical, do not carry out load operation, if it is different, propose load request by the system call of adding to oneself, but and finish space relationship between one section physical location on the hard disk that the mapping-factor of the block device file of being represented read or write the operational zone being used in the system and current system maintenance represents in the operating system nucleus attitude by this system call.
CNB021293821A 2002-09-06 2002-09-06 Method for accessing any sector of hard disk from file system Expired - Fee Related CN100334566C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB021293821A CN100334566C (en) 2002-09-06 2002-09-06 Method for accessing any sector of hard disk from file system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB021293821A CN100334566C (en) 2002-09-06 2002-09-06 Method for accessing any sector of hard disk from file system

Publications (2)

Publication Number Publication Date
CN1480849A CN1480849A (en) 2004-03-10
CN100334566C true CN100334566C (en) 2007-08-29

Family

ID=34144135

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB021293821A Expired - Fee Related CN100334566C (en) 2002-09-06 2002-09-06 Method for accessing any sector of hard disk from file system

Country Status (1)

Country Link
CN (1) CN100334566C (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101373452B (en) * 2007-08-24 2010-06-16 英业达股份有限公司 Method for testing hard disk read-write operations
CN102236604A (en) * 2010-04-26 2011-11-09 智微科技股份有限公司 Control circuit and related method applied to physical storage device
CN104063641B (en) * 2014-06-23 2017-11-24 华为技术有限公司 Hard disk secure access control method and hard disk

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6032239A (en) * 1997-10-15 2000-02-29 Dell Usa, L.P. System and method for updating partition mappings to logical drives in a computer memory device
CN1265492A (en) * 2000-03-31 2000-09-06 清华同方光盘股份有限公司 Realizing method of plug-and-play (pnp) virtual CD memory system with very high capacity
US6253300B1 (en) * 1997-08-20 2001-06-26 Powerquest Corporation Computer partition manipulation during imaging
US6295575B1 (en) * 1998-06-29 2001-09-25 Emc Corporation Configuring vectors of logical storage units for data storage partitioning and sharing
US6324627B1 (en) * 1998-06-22 2001-11-27 Virtual Data Security, Llc Virtual data storage (VDS) system
US6330653B1 (en) * 1998-05-01 2001-12-11 Powerquest Corporation Manipulation of virtual and live computer storage device partitions
US6430653B1 (en) * 1998-05-01 2002-08-06 Nec Corporation Disk control unit and method for prefetching according to partition information and concatenation information

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6253300B1 (en) * 1997-08-20 2001-06-26 Powerquest Corporation Computer partition manipulation during imaging
US6032239A (en) * 1997-10-15 2000-02-29 Dell Usa, L.P. System and method for updating partition mappings to logical drives in a computer memory device
US6330653B1 (en) * 1998-05-01 2001-12-11 Powerquest Corporation Manipulation of virtual and live computer storage device partitions
US6430653B1 (en) * 1998-05-01 2002-08-06 Nec Corporation Disk control unit and method for prefetching according to partition information and concatenation information
US6324627B1 (en) * 1998-06-22 2001-11-27 Virtual Data Security, Llc Virtual data storage (VDS) system
US6295575B1 (en) * 1998-06-29 2001-09-25 Emc Corporation Configuring vectors of logical storage units for data storage partitioning and sharing
CN1265492A (en) * 2000-03-31 2000-09-06 清华同方光盘股份有限公司 Realizing method of plug-and-play (pnp) virtual CD memory system with very high capacity

Also Published As

Publication number Publication date
CN1480849A (en) 2004-03-10

Similar Documents

Publication Publication Date Title
US8037279B2 (en) Method and system for cross-domain data sharing
US9152824B2 (en) Method and system for automatically preserving persistent storage
US7171523B2 (en) Information processing system for updating data in a shared network storage system
US10248322B2 (en) Memory system
CN101506793B (en) Running operating system on dynamic virtual memory
US20040088513A1 (en) Controller for partition-level security and backup
EP1876528A2 (en) Controlling memory access in a multi-booting system
US20090157946A1 (en) Memory having improved read capability
KR20010071560A (en) Virtual data storage (vds) system
US20040111250A1 (en) Emulated read-write disk drive using a protected medium
US20090089500A1 (en) Memory cache sharing in hybrid hard disk
KR20030093079A (en) Method for Partitioning Memory Mass Storage Device
US20160202928A1 (en) Virtual Tape Library
US9336065B2 (en) Semiconductor device and memory protection method
US7921247B1 (en) Sharing a dynamically located memory block between components executing in different processor modes in an extensible firmware interface environment
KR20200123850A (en) Hybrid memory system
CN108228473A (en) The load balance distributed by dynamically transmitting memory range
US5875487A (en) System and method for providing efficient shared memory in a virtual memory system
CN101477477A (en) Kernel spacing isolation method, spacing management entity and system
US7577803B2 (en) Near instantaneous backup and restore of disc partitions
US20230273859A1 (en) Storage system spanning multiple failure domains
US7861074B2 (en) Electronic systems using flash memory modules as main storage and related system booting methods
US20040148459A1 (en) RAID configuration protocol for SCSI drives and RAID controllers
US20040268084A1 (en) Protected RAM filesystem
US5940869A (en) System and method for providing shared memory using shared virtual segment identification in a computer 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
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20070829

Termination date: 20090906