CN110764694B - Method and system for controlling storage space - Google Patents

Method and system for controlling storage space Download PDF

Info

Publication number
CN110764694B
CN110764694B CN201910890336.2A CN201910890336A CN110764694B CN 110764694 B CN110764694 B CN 110764694B CN 201910890336 A CN201910890336 A CN 201910890336A CN 110764694 B CN110764694 B CN 110764694B
Authority
CN
China
Prior art keywords
hard disk
list
file
directory
hard
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
CN201910890336.2A
Other languages
Chinese (zh)
Other versions
CN110764694A (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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN201910890336.2A priority Critical patent/CN110764694B/en
Publication of CN110764694A publication Critical patent/CN110764694A/en
Application granted granted Critical
Publication of CN110764694B publication Critical patent/CN110764694B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Management Or Editing Of Information On Record Carriers (AREA)

Abstract

The invention provides a method and a system for controlling a storage space, wherein the method adopts mount to realize batch mounting, and when a hard disk to be mounted is not recorded in a mounted hard disk list of a mounted hard disk space management area, the hard disk to be mounted is mounted; when the hard disk to be mounted is recorded in a mounting hard disk list of a mounting hard disk space management area and the universal unique identification code of the hard disk to be mounted is recorded in the mounting hard disk space management area, mounting the hard disk to be mounted; the mounted hard disk space management area is pre-configured on the hard disk and used for storing a mounted hard disk list and a UUID. umount unloads all hard disks mounted under a directory completely; mount show all hard disk information mounted to the directory. And writing or reading files into the directory after the hard disk is mounted. Based on the method, a system for controlling the storage space is provided. The invention uses a plurality of hard disks to be mounted to a certain same directory in batches, and the plurality of hard disks form a larger storage space.

Description

Method and system for controlling storage space
Technical Field
The invention belongs to the technical field of hardware storage, and particularly relates to a method and a system for controlling a storage space.
Background
In the LINUX operating system, a mount command is generally used to mount a local hard disk, a memory mapped hard disk, an NFS mapping space, and the like to a local directory of the operating system for reading, writing, and storing data, which is a flexible, simple, and convenient way to obtain the memory directory. Similar to the following command mount/dev/sdb1/data, mount the local hard disk of/dev/sdb 1 to the/data directory, and uninstall the local hard disk in the umount/data mode after the use is completed.
In the prior art, one hard disk can only be mounted to one directory, and one directory can only be mounted to one hard disk, and when the space capacity after one mounting is used up, the space capacity is generally difficult to expand. When more capacity is needed for one storage space and a single super-large file needs to be stored, the mounted space is difficult to expand the storage capacity, so that the requirement change of the storage space in various ways cannot be met.
Disclosure of Invention
The invention provides a method and a system for controlling storage space, wherein a plurality of hard disk spaces are mounted to the same directory, and a plurality of hard disks form larger storage space.
In order to achieve the above object, the present invention provides a method for controlling a storage space, the method comprising: when the hard disk to be mounted is not recorded in a mounted hard disk list of a mounted hard disk space management area, mounting the hard disk to be mounted;
when a hard disk to be mounted is recorded in a mounted hard disk list of a mounted hard disk space management area and a universal unique identification code of the hard disk to be mounted is recorded in the mounted hard disk space management area, mounting the hard disk to be mounted;
the mounted hard disk space management area is pre-configured on a hard disk and used for storing the mounted hard disk list and the universal unique identification code.
Further, after the hard disk to be mounted is mounted to the directory, the operating system writes a file into the directory; the method for writing the file comprises the following steps: firstly, an operating system finds an inode from a mounted first hard disk and allocates the inode to a file, and the inode records file attributes and allocated storage space; when the files are increased to the extent that the first hard disk cannot be stored, judging whether a second hard disk has a storage space, and if so, finding inodes from the second hard disk and allocating the inodes to the files; finding all hard disks mounted under the catalog in this way; and updating the file inode list; or
After a hard disk to be mounted is mounted to a directory, an operating system reads a file stored in the hard disk; the reading method comprises the following steps: and reading the file inode list, finding a hard disk corresponding to the file, and sequentially reading all inodes in the file inode list.
Further, when the hard disk is mounted, a hard disk file system to be mounted needs to be formatted, and the hard disk file to be mounted is divided into an index area and a data area; the index area comprises a plurality of inodes, and each inode corresponds to a file; the inode includes file related description information and a file data storage address.
Further, the mounted hard disk space management area comprises hard disk information, a mounted hard disk list and a file inode list;
the hard disk information comprises a hard disk name, a hard disk size and a universal unique hard disk identification code;
the mounted hard disk list is used for recording names and universal unique identification codes of all hard disks mounted to a directory;
the file inode list is used for recording inodes of files on all hard disks to be mounted.
Further, the method also comprises the steps that after the hard disk to be unloaded is unloaded from the specified directory, the hard disk is allowed to be mounted to the specified directory, but the hard disk and other hard disks are not allowed to be mounted to other directories; and if the hard disk to be unloaded is not mounted to the specified directory, adding identification parameters to the hard disk to be unloaded, and simultaneously removing the information in the mounted hard disk list.
Further, the method further comprises the step of displaying all hard disk information mounted to the directory by reading the information in the mounted hard disk list.
A storage space control system, the system comprising a mount module;
the mounting module is used for mounting the hard disk to be mounted when the hard disk to be mounted is not recorded in a mounting hard disk list of the mounting hard disk space management area; when a hard disk to be mounted is recorded in a mounted hard disk list of a mounted hard disk space management area and a universal unique identification code of the hard disk to be mounted is recorded in the mounted hard disk space management area, mounting the hard disk to be mounted; the mounted hard disk space management area is pre-configured on a hard disk and used for storing the mounted hard disk list and the universal unique identification code.
Furthermore, the mounting module further comprises a writing module and a reading module;
the writing module is used for writing a file into the directory by the operating system after the hard disk to be mounted is mounted to the directory; the method for writing the file comprises the following steps: firstly, an operating system finds an inode from a mounted first hard disk and allocates the inode to a file, and the inode records file attributes and allocated storage space; when the files are increased to the extent that the first hard disk cannot be stored, judging whether a second hard disk has a storage space, and if so, finding inodes from the second hard disk and allocating the inodes to the files; finding all hard disks mounted under the catalog in this way; and updating the file inode list;
the reading module is used for reading the file stored in the hard disk by an operating system after the hard disk to be mounted is mounted to the directory; the reading method comprises the following steps: and reading the file inode list, finding a hard disk corresponding to the file, and sequentially reading all inodes in the file inode list.
Further, the system also comprises an unloading module and a display module;
the unloading module is used for allowing the hard disk to be unloaded to be mounted to the specified directory but not allowing the hard disk to be mounted to other directories after the hard disk to be unloaded is unloaded from the specified directory; if the hard disk to be unloaded is not mounted to the specified directory, adding identification parameters to the hard disk to be unloaded, and simultaneously removing information in a mounted hard disk list;
the display module is used for displaying all hard disk information mounted to the directory by reading the information in the mounted hard disk list.
The effect provided in the summary of the invention is only the effect of the embodiment, not all the effects of the invention, and one of the above technical solutions has the following advantages or beneficial effects:
the embodiment of the invention provides a method and a system for controlling a storage space, wherein the method adopts mount commands to realize batch mounting, and when the hard disks to be mounted are not recorded in a mounted hard disk list of a mounted hard disk space management area, the hard disks to be mounted are mounted; when the hard disk to be mounted is recorded in a mounting hard disk list of a mounting hard disk space management area and the universal unique identification code of the hard disk to be mounted is recorded in the mounting hard disk space management area, mounting the hard disk to be mounted; the mounted hard disk space management area is configured on the hard disk in advance and used for storing a mounted hard disk list and a universal unique identification code. After the hard disk to be mounted is mounted in the directory, the operating system writes a file into the directory; the method for writing the file comprises the following steps: firstly, an operating system finds an inode from a mounted first hard disk and allocates the inode to a file, and the inode records file attributes and allocated storage space; when the files are increased to the extent that the first hard disk cannot be stored, judging whether a second hard disk has a storage space, and if so, finding inodes from the second hard disk and allocating the inodes to the files; finding all hard disks mounted under the catalog in this way; and updates the file inode list. Or after the hard disk to be mounted is mounted to the directory, the operating system reads the file stored in the hard disk; the reading method comprises the following steps: and reading the file inode list, finding the hard disk corresponding to the file, and sequentially reading all inodes in the file inode list. The method provided by the invention also comprises the steps of adopting a umount command to completely unload all the hard disks mounted to the directory, and allowing the hard disks to be mounted to the designated directory after the unloaded hard disks are unloaded from the designated directory, but not allowing the hard disks to be mounted to other directories; and if the hard disk to be unloaded is not mounted to the specified directory, adding identification parameters to the hard disk to be unloaded, and simultaneously removing the information in the mounted hard disk list. And displaying all hard disk information mounted to the directory by adopting a mount show command, and displaying all hard disk information mounted to the directory by reading the information in the mounted hard disk list. Based on the method for controlling the storage space provided by the invention, a system for controlling the storage space is also provided. The invention uses mount to mount a plurality of hard disks to a same directory in batches, the directory capacity is increased correspondingly after mounting, the capacity displayed by the mounted directory is the sum of the capacities of all the mounted hard disks, and the storage spaces of all the hard disks are uniformly managed and distributed by using a mounted hard disk space management table. The storage space of the hard disk mounted by mount is added into the mounted hard disk space management table, and when umount is used to unload a certain hard disk, the storage space of the hard disk is removed from the mounted hard disk space management table. The invention can meet the requirement of the service on the super-large storage space, and can flexibly expand and reduce the storage space along with the change of the requirement.
Drawings
Fig. 1 is a flowchart of a method for controlling a storage space according to embodiment 1 of the present invention;
FIG. 2 is a table of inode information in a method for controlling storage space according to embodiment 1 of the present invention;
fig. 3 shows an information table for mounting a hard disk space management area in a method for controlling a storage space according to embodiment 1 of the present invention;
fig. 4 is a schematic diagram of a system for controlling a storage space according to embodiment 1 of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the description of the present invention, it is to be understood that the terms "longitudinal", "lateral", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", and the like, indicate orientations or positional relationships based on those shown in the drawings, are merely for convenience of description of the present invention, and do not indicate or imply that the referenced devices or elements must have a particular orientation, be constructed and operated in a particular orientation, and thus, are not to be construed as limiting the present invention.
Example 1
The invention provides a method and a system for controlling a storage space, and as shown in fig. 1, the invention provides a method for controlling a storage space.
In step S101, when the hard disk file system is formatted, a mounted hard disk space management area is set on the hard disk, and is used for storing the hard disk information, the mounted hard disk list, and the file inode list.
Taking the ext3 file system as an example, when the ext3 file system format is performed on a hard disk, the hard disk is divided into an index area and a data area. The index area includes a plurality of inodes, each inode corresponds to a file, and includes file related description information, a file data storage address, and the like, as shown in fig. 2, an inode information table in the method for controlling a storage space according to embodiment 1 of the present invention is provided.
When the hard disk is formatted in a file system, a mounted hard disk space management area is arranged on the hard disk, and exists in a manner of mounting a hard disk space management table and comprises hard disk information, a mounted hard disk list and a file inode list; as shown in fig. 3, an information table for mounting a hard disk space management area in a method for controlling storage space according to embodiment 1 of the present invention is shown; the hard disk information comprises the name of the hard disk, the size of the hard disk, a UUID of the hard disk and the like; the mounted hard disk list records names and UUIDs of all hard disks mounted to a directory; file inode list: the files stored in the directory may be stored on a certain hard disk or may be stored across multiple hard disks, each hard disk has an inode for storing the file, and all the inodes of the file are recorded in the file inode list in order to record the storage sequence of the files on which hard disks exist.
In step S102, when the hard disk to be mounted is not recorded in the mounted hard disk list in the mounted hard disk space management area, mounting the hard disk to be mounted; when the hard disk to be mounted is recorded in a mounting hard disk list of a mounting hard disk space management area and the universal unique identification code of the hard disk to be mounted is recorded in the mounting hard disk space management area, mounting the hard disk to be mounted; the mounted hard disk space management area is configured on the hard disk in advance and used for storing a mounted hard disk list and a universal unique identification code.
Enhancing the mount command function, and enabling the mount command to mount a plurality of hard disks to the same directory; firstly, judging whether a mounted hard disk list of a mounted hard disk space management area records a mounted hard disk or not, if not, then not mounting the hard disk before, then allowing the mounting this time, and updating the mounted hard disk list; if the record exists, the hard disk UUID of the hard disk information is mounted before, whether the hard disk UUID of the hard disk information is consistent with the hard disk UUIDs of other mounted hard disk information is judged, and if the record exists, mounting is allowed; if not, the mounting is not allowed.
For a mount command, a/dev/sdb 1 hard disk can be mounted to an/data directory through a command format similar to mount/dev/sdb1/data, and mount is only allowed to mount one hard disk to one directory, so that error reporting information can be prompted when mount is carried out on another hard disk sdb2 to/data by using mount/dev/sdb2/data, and multiple hard disks are not allowed to be mounted to one directory at the same time. And performing function enhancement on the mount command to enable the mount command to mount a plurality of hard disks to the same directory. When mount is executed, whether a value exists in a mount hard disk list of a mount hard disk space management table is judged, if no value exists, the mount hard disk space management table indicates that mount has not been performed before, mount can be performed at this time, and the mount hard disk list is updated. If the value is positive, the hard disk information in the 'mounted hard disk list' of the hard disk is judged to be consistent with the uuid of other mounted hard disks, if so, the hard disk can be mounted, and if not, the mounting is not allowed.
In step S102, the method further includes using the umount command to unload the hard disk from the directory. And enhancing the command, and unloading all the hard disks mounted to the directory after the umount/data unloading is executed. And a certain hard disk is specified to be unloaded through umount/dev/sdb2, and after unloading, the user can still mount to the directory environment again, but cannot mount to other directories with other hard disks. If a certain hard disk is unloaded, the hard disk does not participate in the mounting of the directory any more, and a parameter-d is added, so that the mounted hard disk list is cleared while the hard disk is unloaded, and the hard disk can be mounted randomly again later.
And displaying the mounted directory and the mounted hard disk by adopting a mount show command, enhancing the command, reading information in a mounted hard disk list and displaying all hard disk information mounted to the directory.
In step S103, after the hard disk is normally mounted to the directory, a read operation or a write operation is performed on the hard disk.
After the hard disk is normally mounted to the directory, the operating system reads the hard disk information, including the size of the hard disk, the used space of the hard disk and the free space of the hard disk, and collects and manages the hard disk information and other hard disk information mounted to the directory in a unified manner. When a file is written into a directory, an inode is found from a first hard disk and allocated to the file, the inode records the file attribute and the allocated storage space, when the file is continuously increased to the extent that the hard disk cannot be stored, whether a second hard disk has a free space is judged, if not, whether a third hard disk has a free space is continuously judged, and all hard disks are searched in the same way, and if the second hard disk has a free space, an inode is found from the second hard disk and allocated to the file so as to continue writing. The file is already stored across the hard disks, so a "file inode list" is maintained at this time, the inode of the file on the first hard disk and the inode of the file on the second hard disk are recorded, and if other hard disks are continuously used, the inodes of the other hard disks are also added to the list.
After all the hard disks are mounted in the directory, when a file stored across the hard disks is to be read, the file inode list is read first, the hard disk corresponding to the file is found, after the file content corresponding to the first inode is read, the file content corresponding to the second inode is processed, and so on, until all the inodes in the file inode list are processed.
Based on the method for controlling the storage space provided in embodiment 1 of the present invention, a system for controlling the storage space is also provided, and as shown in fig. 4, a system for controlling the storage space is provided; comprises a mounting module;
the mounting module is used for mounting the hard disk to be mounted when the hard disk to be mounted is not recorded in a mounting hard disk list of the mounting hard disk space management area; when the hard disk to be mounted is recorded in a mounting hard disk list of a mounting hard disk space management area and the universal unique identification code of the hard disk to be mounted is recorded in the mounting hard disk space management area, mounting the hard disk to be mounted; the mounted hard disk space management area is configured on the hard disk in advance and used for storing a mounted hard disk list and a universal unique identification code.
When the hard disk is mounted, file system formatting is carried out on the hard disk, a mounted hard disk space management area is arranged on the hard disk, exists in a mounted hard disk space management table mode and comprises hard disk information, a mounted hard disk list and a file inode list, wherein the hard disk information comprises the name of the hard disk, the size of the hard disk, a hard disk UUID and the like; the mounted hard disk list records names and UUIDs of all hard disks mounted to a directory; file inode list: the files stored in the directory may be stored on a certain hard disk or may be stored across multiple hard disks, each hard disk has an inode for storing the file, and all the inodes of the file are recorded in the file inode list in order to record the storage sequence of the files on which hard disks exist.
Enhancing the mount command function, and enabling the mount command to mount a plurality of hard disks to the same directory; firstly, judging whether a mounted hard disk list of a mounted hard disk space management area records a mounted hard disk or not, if not, then not mounting the hard disk before, then allowing the mounting this time, and updating the mounted hard disk list; if the record exists, the hard disk UUID of the hard disk information is mounted before, whether the hard disk UUID of the hard disk information is consistent with the hard disk UUIDs of other mounted hard disk information is judged, and if the record exists, mounting is allowed; if not, the mounting is not allowed.
For a mount command, a/dev/sdb 1 hard disk can be mounted to an/data directory through a command format similar to mount/dev/sdb1/data, and mount is only allowed to mount one hard disk to one directory, so that error reporting information can be prompted when mount is carried out on another hard disk sdb2 to/data by using mount/dev/sdb2/data, and multiple hard disks are not allowed to be mounted to one directory at the same time. And performing function enhancement on the mount command to enable the mount command to mount a plurality of hard disks to the same directory. When mount is executed, whether a value exists in a mount hard disk list of a mount hard disk space management table is judged, if no value exists, the mount hard disk space management table indicates that mount has not been performed before, mount can be performed at this time, and the mount hard disk list is updated. If the value is positive, the hard disk information in the 'mounted hard disk list' of the hard disk is judged to be consistent with the uuid of other mounted hard disks, if so, the hard disk can be mounted, and if not, the mounting is not allowed.
The mounting module further comprises a writing module and a reading module.
The writing module is used for writing a file into the directory by the operating system after the hard disk to be mounted is mounted to the directory; the method for writing the file comprises the following steps: firstly, an operating system finds an inode from a mounted first hard disk and allocates the inode to a file, and the inode records file attributes and allocated storage space; when the files are increased to the extent that the first hard disk cannot be stored, judging whether a second hard disk has a storage space, and if so, finding inodes from the second hard disk and allocating the inodes to the files; finding all hard disks mounted under the catalog in this way; and updates the file inode list.
The reading module is used for reading the file stored in the hard disk by the operating system after the hard disk to be mounted is mounted to the directory; the reading method comprises the following steps: and reading the file inode list, finding the hard disk corresponding to the file, and sequentially reading all inodes in the file inode list.
After the hard disk is normally mounted to the directory, the operating system reads the hard disk information, including the size of the hard disk, the used space of the hard disk and the free space of the hard disk, and collects and manages the hard disk information and other hard disk information mounted to the directory in a unified manner. When a file is written into a directory, an inode is found from a first hard disk and allocated to the file, the inode records the file attribute and the allocated storage space, when the file is continuously increased to the extent that the hard disk cannot be stored, whether a second hard disk has a free space is judged, if not, whether a third hard disk has a free space is continuously judged, and all hard disks are searched in the same way, and if the second hard disk has a free space, an inode is found from the second hard disk and allocated to the file so as to continue writing. The file is already stored across the hard disks, so a "file inode list" is maintained at this time, the inode of the file on the first hard disk and the inode of the file on the second hard disk are recorded, and if other hard disks are continuously used, the inodes of the other hard disks are also added to the list.
After all the hard disks are mounted in the directory, when a file stored across the hard disks is to be read, the file inode list is read first, the hard disk corresponding to the file is found, after the file content corresponding to the first inode is read, the file content corresponding to the second inode is processed, and so on, until all the inodes in the file inode list are processed.
The system also comprises an unloading module and a display module;
the unloading module is used for allowing the hard disk to be unloaded to be mounted to the specified directory but not allowing the hard disk to be mounted to other directories after the hard disk to be unloaded is unloaded from the specified directory; and if the hard disk to be unloaded is not mounted to the specified directory, adding identification parameters to the hard disk to be unloaded, and simultaneously removing the information in the mounted hard disk list. The umount command is used to unload the hard disk from the directory. And enhancing the command, and unloading all the hard disks mounted to the directory after the umount/data unloading is executed. And a certain hard disk is specified to be unloaded through umount/dev/sdb2, and after unloading, the user can still mount to the directory environment again, but cannot mount to other directories with other hard disks. If a certain hard disk is unloaded, the hard disk does not participate in the mounting of the directory any more, and a parameter-d is added, so that the mounted hard disk list is cleared while the hard disk is unloaded, and the hard disk can be mounted randomly again later.
The display module is used for displaying all hard disk information mounted to the directory by reading the information in the mounted hard disk list. And displaying the mounted directory and the mounted hard disk by adopting a mount show command, enhancing the command, reading information in a mounted hard disk list and displaying all hard disk information mounted to the directory.
The foregoing is merely exemplary and illustrative of the present invention and various modifications, additions and substitutions may be made by those skilled in the art to the specific embodiments described without departing from the scope of the present invention as defined in the accompanying claims.

Claims (8)

1. A storage space control method, comprising:
when the hard disk to be mounted is not recorded in a mounted hard disk list of a mounted hard disk space management area, mounting the hard disk to be mounted;
when the hard disk to be mounted is recorded in a mounted hard disk list of a mounted hard disk space management area, judging whether the universal unique identification code of the hard disk to be mounted is consistent with the universal unique identification code in the mounted hard disk list or not, and mounting the hard disk to be mounted if the universal unique identification code of the hard disk to be mounted is consistent with the universal unique identification code in the mounted hard disk list;
the mounted hard disk space management area is pre-configured on a hard disk and used for storing the mounted hard disk list and the universal unique identification code; the mounted hard disk space management area comprises local hard disk information, a mounted hard disk list and a file inode list; the hard disk information comprises the name of the hard disk, the size of the hard disk and a universal unique identification code of the hard disk; the mounted hard disk list is used for recording names of all mounted hard disks mounted to the current directory and universal unique identification codes of all mounted hard disks; the file inode list is used for recording inodes of files on all hard disks to be mounted.
2. The storage space control method according to claim 1,
after the hard disk to be mounted is mounted in the directory, the operating system writes a file into the directory; the method for writing the file comprises the following steps: firstly, an operating system finds inodes from a mounted first hard disk and distributes the inodes to files, and the inodes record file attributes and distributed storage space; when the files are increased to the extent that the first hard disk cannot be stored, judging whether a second hard disk has a storage space, and if so, finding inodes from the second hard disk and allocating the inodes to the files; finding all hard disks mounted under the catalog in this way; and updating the file inode list; or
After the hard disk to be mounted is mounted to the directory, the operating system reads a file stored in the hard disk mounted to the directory; the hard disk mounted to the directory is a first hard disk or a second hard disk; the reading method comprises the following steps: and reading the file inode list, finding a hard disk corresponding to the file, and sequentially reading all inodes in the file inode list.
3. The storage space control method according to claim 1, wherein when the hard disk is mounted, a hard disk file system to be mounted is formatted, and the hard disk file to be mounted is divided into an index area and a data area; the index area comprises a plurality of inodes, and each inode corresponds to a file; the inode includes file related description information and a file data storage address.
4. The method of claim 1, further comprising:
after the uninstalled hard disk is uninstalled from the current directory, allowing the current directory to be installed, but not allowing the current directory to be installed with other hard disks; and if the hard disk to be unloaded is not mounted in the current directory, adding identification parameters to the hard disk to be unloaded, and simultaneously removing the information in the mounted hard disk list.
5. The method of claim 1, further comprising: and displaying all hard disk information mounted to the directory by reading the information in the mounted hard disk list.
6. A storage space control system, characterized in that the system comprises a mount module;
the mounting module is used for mounting the hard disk to be mounted when the hard disk to be mounted is not recorded in a mounting hard disk list of the mounting hard disk space management area; when the hard disk to be mounted is recorded in a mounted hard disk list of a mounted hard disk space management area, judging whether the universal unique identification code of the hard disk to be mounted is consistent with the universal unique identification code in the mounted hard disk list or not, and mounting the hard disk to be mounted if the universal unique identification code of the hard disk to be mounted is consistent with the universal unique identification code in the mounted hard disk list; the mounted hard disk space management area is pre-configured on a hard disk and used for storing the mounted hard disk list and the universal unique identification code; the mounted hard disk space management area comprises the hard disk information, a mounted hard disk list and a file inode list; the hard disk information comprises the name of the hard disk, the size of the hard disk and a universal unique identification code of the hard disk;
the mounted hard disk list is used for recording names of all mounted hard disks mounted to the current directory and universal unique identification codes of all mounted hard disks; the file inode list is used for recording inodes of files on all hard disks to be mounted.
7. The system according to claim 6, wherein the mounting module further comprises a writing module and a reading module;
the writing module is used for writing a file into the directory by the operating system after the hard disk to be mounted is mounted to the directory; the method for writing the file comprises the following steps: firstly, an operating system finds an inode from a mounted first hard disk and allocates the inode to a file, and the inode records file attributes and allocated storage space; when the files are increased to the extent that the first hard disk cannot be stored, judging whether a second hard disk has a storage space, and if so, finding inodes from the second hard disk and allocating the inodes to the files; finding all hard disks mounted under the catalog in this way; and updating the file inode list;
the reading module is used for reading the file stored in the hard disk after the hard disk to be mounted to the directory by the operating system; the hard disk mounted to the directory is a first hard disk or a second hard disk; the reading method comprises the following steps: and reading the file inode list, finding out a hard disk corresponding to the file, and sequentially reading all inodes in the file inode list.
8. The storage space control system according to claim 6, further comprising an unloading module and a display module;
the unloading module is used for allowing the hard disk to be unloaded to be mounted to the current directory but not to be mounted to other directories with other hard disks after the hard disk to be unloaded is unloaded from the current directory; if the hard disk to be unloaded is not mounted in the current directory, adding identification parameters to the hard disk to be unloaded, and simultaneously removing information in a mounted hard disk list;
the display module is used for displaying all hard disk information mounted to the directory by reading the information in the mounted hard disk list.
CN201910890336.2A 2019-09-20 2019-09-20 Method and system for controlling storage space Active CN110764694B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910890336.2A CN110764694B (en) 2019-09-20 2019-09-20 Method and system for controlling storage space

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910890336.2A CN110764694B (en) 2019-09-20 2019-09-20 Method and system for controlling storage space

Publications (2)

Publication Number Publication Date
CN110764694A CN110764694A (en) 2020-02-07
CN110764694B true CN110764694B (en) 2022-08-12

Family

ID=69330098

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910890336.2A Active CN110764694B (en) 2019-09-20 2019-09-20 Method and system for controlling storage space

Country Status (1)

Country Link
CN (1) CN110764694B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111459406B (en) * 2020-03-08 2022-10-25 苏州浪潮智能科技有限公司 Method and system for identifying NVME hard disk under storage unloading card
CN114443582B (en) * 2021-12-22 2022-11-29 科东(广州)软件科技有限公司 File system mounting method, device, equipment and medium on operating system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101840314A (en) * 2010-05-05 2010-09-22 北京星网锐捷网络技术有限公司 Method, device and server for expanding storage space of database
CN105589690A (en) * 2015-12-11 2016-05-18 浪潮电子信息产业股份有限公司 Method for binding hard disk mounting sequence in Linux system
CN106990915A (en) * 2017-02-27 2017-07-28 北京航空航天大学 A kind of SRM method based on storage media types and weighting quota

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101840314A (en) * 2010-05-05 2010-09-22 北京星网锐捷网络技术有限公司 Method, device and server for expanding storage space of database
CN105589690A (en) * 2015-12-11 2016-05-18 浪潮电子信息产业股份有限公司 Method for binding hard disk mounting sequence in Linux system
CN106990915A (en) * 2017-02-27 2017-07-28 北京航空航天大学 A kind of SRM method based on storage media types and weighting quota

Also Published As

Publication number Publication date
CN110764694A (en) 2020-02-07

Similar Documents

Publication Publication Date Title
US6823417B2 (en) Memory controller for memory card manages file allocation table
US8156165B2 (en) Transaction-safe FAT files system
US7752412B2 (en) Methods of managing file allocation table information
US7681008B2 (en) Systems for managing file allocation table information
US8589617B2 (en) Write once recording device
US20070288711A1 (en) Snapshot copy management method used for logic volume manager
US8977802B2 (en) Access device, information recording device, controller, real time information recording system, access method, and program
KR101049617B1 (en) Memory and memory systems
US20110107018A1 (en) Plural-partitioned type nonvolatile storage device and system
US20090077334A1 (en) Storage Apparatus for Preventing Falsification of Data
CN101582084B (en) Method and device for data storage
CN110764694B (en) Method and system for controlling storage space
US20050286377A1 (en) Record carrier having a main file system area and a virtual file system area
JP4347707B2 (en) Information recording medium formatting method and information recording medium
JP2012113789A (en) Hard disk drive device and processing device thereof
US8595426B2 (en) Handling commands within a write-once read-many storage device configuration
JP4130808B2 (en) Formatting method
CN111078159B (en) Writing method for avoiding DVR storage card writing damage
KR100954603B1 (en) A log file of file system and method for recovering file system
CN111741107A (en) Layering method and device based on file storage system and electronic equipment
US8200936B2 (en) Systems and methods for recording information to a memory card
KR101102754B1 (en) Nand flash memory file system and method for accessing file thereof
CN113296700A (en) Storage space management method and device and server
JPH1196685A (en) Computer system
CN111741106A (en) File archiving method and device based on file storage system and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant