Terminal storage expansion method, device, equipment and readable storage medium
By adding the mount path and device information of the memory to the terminal device, the operating system allocates the device number and instantiates the memory, solving the problems of fixed storage capacity of the terminal device and high-cost expansion, achieving flexible and low-cost storage capacity expansion.
Patent Information
- Application Number
- CN202410506481.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-25
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2044-04-25
AI Technical Summary
The storage capacity of existing terminal devices is fixed, which is difficult to meet the needs. At the same time, the cost of using and maintaining the server is high, and a low-cost and flexible storage expansion solution is lacking.
By adding the mount path information of the memory and device information to the system partition mount configuration file and storage management unit file of the terminal, the operating system assigns a unique device number to the memory, associates the mount path based on the device number, instantiates the memory as a storage object, and realizes data storage.
It realizes flexible expansion of terminal storage, reduces the cost of storage expansion, and avoids high maintenance costs of server linking methods.
Smart Images

Figure CN118567551B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer storage, and particularly relates to a method, device, equipment and readable storage medium for expanding the storage of a terminal. Background Art
[0002] With the rapid development of terminal devices, in all walks of life, terminal devices are widely used to complete tasks such as production control, customer service, and intelligent display. However, most of the existing terminal devices adopt a storage scheme with a fixed storage capacity, or store data by connecting to a server. The storage method with a fixed storage capacity limits the storage of terminal devices and is difficult to meet the requirements; while the method of connecting to a server has a high cost of use and maintenance. Therefore, there is an urgent need for a storage scheme with low cost and flexible expansion to solve the storage problems of existing terminal devices. Summary of the Invention
[0003] The present invention provides a method, device, equipment and readable storage medium for expanding the storage of a terminal, so as to solve the technical problem of how to expand the storage of a terminal device at low cost and flexibly.
[0004] The present invention provides a method for expanding the storage of a terminal, including:
[0005] Adding the mounting path information of a memory to the system partition mounting configuration file of the terminal to be expanded;
[0006] Adding the device information of the memory to the storage management unit file of the terminal to be expanded;
[0007] Based on the device number, associating the mounting path of the memory, and instantiating the memory as a storage object, where the device number is a unique identifier assigned by the operating system of the terminal to be expanded;
[0008] When storing data, storing the data to be stored in the memory serving as the storage object.
[0009] According to the method for expanding the storage of a terminal provided by the present invention, both the mounting path information and the device information include Peripheral Component Interconnect Express (PCIe) interface information.
[0010] According to the method for expanding the storage of a terminal provided by the present invention, after adding the device information of the memory to the storage management unit file of the terminal to be expanded, it includes:
[0011] Compiling the system source code of the terminal to be expanded to generate a system image file, where the system source code includes the system partition mounting configuration file with the added mounting path information and the storage management unit file with the added device information;
[0012] Download the system image file to the firmware storage unit of the terminal to be expanded.
[0013] According to a terminal storage expansion method provided by the present invention, after downloading the system image file to the firmware storage unit of the terminal to be expanded, it includes:
[0014] When the memory is connected to the PCIe card slot, initialize the driver file of the memory with a PCIe interface to obtain the device number of the memory.
[0015] According to a terminal storage expansion method provided by the present invention, the associating the mounting path of the memory based on the device number includes:
[0016] Search for the memory with a PCIe interface in the storage management unit file based on the device number to determine the mounting path of the memory;
[0017] Associate the memory with the PCIe interface with the mounting path.
[0018] According to a terminal storage expansion method provided by the present invention, when storing data, storing the data to be stored in the memory as the storage object includes:
[0019] When storing data, call the memory as the storage object and store the data to be stored in the memory as the storage object.
[0020] The present invention also provides a terminal storage expansion device, including:
[0021] A mounting path information adding module, configured to add the mounting path information of the memory to the system partition mounting configuration file of the terminal to be expanded;
[0022] A device information adding module, configured to add the device information of the memory to the storage management unit file of the terminal to be expanded;
[0023] A memory instantiation module, configured to associate the mounting path of the memory based on the device number and instantiate the memory as a storage object, where the device number is a unique identifier assigned by the operating system of the terminal to be expanded;
[0024] A data storage module, configured to store the data to be stored in the memory as the storage object when storing data.
[0025] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the terminal storage expansion method as described in any one of the above.
[0026] The present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the terminal storage expansion method described in any one of the above.
[0027] The terminal storage expansion method, device, equipment and readable storage medium provided by the present invention add the mounting path information and device information of the memory to the system partition mounting configuration file and the storage management unit file of the terminal to be expanded respectively. The operating system of the terminal to be expanded assigns a unique device number to the memory, associates the mounting path of the memory through the device number, further instantiates the memory as a storage object, and finally, when the terminal to be expanded needs to store data, stores the data to be stored in the memory as a storage object. By mounting the memory, the memory is instantiated as the storage object of the terminal to be expanded, and the capacity of the mounted memory is flexibly adjusted, realizing flexible expansion of the terminal storage. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0029] Figure 1 is one of the flow diagrams of the terminal storage expansion method provided by the present invention;
[0030] Figure 2 is the structural diagram of the connection of the solid-state drive in the terminal storage expansion method provided by the present invention;
[0031] Figure 3 is the second flow diagram of the terminal storage expansion method provided by the present invention;
[0032] Figure 4 is the structural diagram of the terminal storage expansion device provided by the present invention;
[0033] Figure 5 is the structural diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0034] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below with reference to the accompanying drawings in the present invention. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present invention without creative efforts shall fall within the protection scope of the present invention.
[0035] Please refer to Figure 1 , the present invention provides a method for expanding the storage capacity of a terminal, including:
[0036] Step 100, adding the mounting path information of the memory to the system partition mounting configuration file of the terminal to be expanded; the mounting path information includes PCIe interface information;
[0037] Specifically, the specific implementation of the method for expanding the storage capacity of the terminal provided by the present invention includes the following steps:
[0038] Step 1: Modify the driver code of the terminal to be expanded, enable the PCIe interface function of the terminal to be expanded and enable the Non-Volatile Memory Host Controller Interface Specification (NVME) protocol, and specify the PCIe interface to access the solid-state drive by the NVME protocol. Set the PCIe bus clock and the number of channels of the PCIe node in the device tree file, and status = "okay" to enable the interface function. The code for implementing the above Step 1 is as follows:
[0039]
[0040]
[0041] Step 2: Modify the system partition mounting configuration file in the system source code of the terminal to be expanded, add a solid-state drive partition, and add a logical storage area in the operating system. The operating system of the terminal to be expanded is generally Android. Modifying the system partition mounting configuration file mainly involves adding the memory mounting path information to the system partition mounting configuration file. The memory in this embodiment can be a solid-state drive, and the solid-state drive will be used to replace the memory for description below. Among them, it is necessary to add the mounting path information of the solid-state drive with a peripheral component interconnect express (PCIe) interface to the system partition mounting configuration file.
[0042] The code for implementing the above Step 2 is as follows:
[0043] #Android fstab file.
[0044] +#For sata add
[0045] + / devices / platform / *.sata*auto vfat defaults voldmanaged=sata:auto
[0046] +#For pciessd add
[0047] + / devices / platform / *.pcie*auto vfat defaults voldmanaged=pcie:auto
[0048] Step 200, add the device information of the memory to the storage management unit file of the terminal to be expanded; the device information includes PCIe interface information;
[0049] Specifically, the specific implementation of the terminal storage expansion method provided by the present invention further includes the following steps:
[0050] Step 3. Modify the storage management unit code (the code is the source file written by the programmer in the language supported by the development tool, so the "code" will be replaced by "file" below) in the system source code of the terminal to be expanded. Modifying the storage management unit file mainly means adding the device identification code of the solid-state drive to the storage management unit code. It is necessary to add the device information of the solid-state drive with a PCIe interface, and the device number is associated with the mounting path.
[0051] The isNvmeBlkDevice() function in the following code is used to determine whether the solid-state drive device exists, and it is determined based on whether the device name "nvme" and the device number major exist within a specified range (reflected in Step 4 below). Add case kMajorBlockPCIENVME as the solid-state drive identification option number in the readMetadata() function, and this number is the same as the device number of the solid-state drive.
[0052] The implemented code is as follows:
[0053]
[0054]
[0055] In one embodiment, the terminal storage expansion method provided by the embodiments of the present application may further include:
[0056] Step 500: Compile the system source code of the to-be-expanded terminal to generate a system image file. The system source code includes a system partition mounting configuration file with the mounted path information added, and a storage management unit file with the device information added.
[0057] Step 600: Download the system image file to the firmware storage unit of the to-be-expanded terminal.
[0058] The terminal storage expansion method provided by the embodiments of this application may further include:
[0059] Step 700: When the memory is connected to the PCIe card slot, initialize the driver file of the memory with a PCIe interface to obtain the device number of the memory.
[0060] Specifically, the specific implementation of the terminal storage expansion method provided by the present invention further includes the following steps:
[0061] Step 4: Compile the Android source code to generate an image file and download the generated image file to the firmware storage unit. The compiled Android system source code includes a modified system partition mounting configuration file (i.e., a system partition mounting configuration file with the solid-state drive mounting path information added) and a modified storage management unit file (i.e., a storage management unit file with the device information of the solid-state drive added). Download the image file generated after compiling the Android system source code to the firmware storage unit of the to-be-expanded terminal.
[0062] As Figure 3 shown, the to-be-expanded terminal itself supports a PCIe interface. This application realizes the connection between the solid-state drive through the PCIe card slot and the PCIe interface through the above technical content, and expands the storage of the to-be-expanded terminal.
[0063] Step 5: As Figure 3 shown, fixedly insert the solid-state drive into the PCIe card slot;
[0064] Step 6: Power on the to-be-expanded terminal. After running the Android system therein, initialize the solid-state drive driver code with a PCIe interface. The Android system reads the device number of the solid-state drive. In the above step 1, the pcie0 node information in the device tree file is initialized, the PCIe interface is initialized, and register_blkdev(nvme_major, "nvme") is called in the nvme_init() initialization function; register the solid-state drive device to the operating system, where nvme_major is the device number and "nvme" is the device name.
[0065] Step 300: Based on the device number to associate the mounting path of the memory, instantiate the memory as a storage object, where the device number is the unique identifier assigned by the operating system of the terminal to be expanded.
[0066] Specifically, the specific implementation of the terminal storage expansion method provided by the present invention further includes the following steps:
[0067] Step 7: The system of the terminal to be expanded obtains the logical partition and device number of the solid-state drive from the mounted partition file.
[0068] Step 8: The memory management unit program of the terminal to be expanded obtains the solid-state drive logical partition information from the system, and determines whether the solid-state drive exists. In the above step 3, the isNvmeBlkDevice() function is used as the judgment basis. If the device name and device number exist, the storage access operation can be performed.
[0069] Step 400: When storing data, store the data to be stored in the memory that serves as the storage object.
[0070] The terminal storage expansion method provided by the embodiments of the present application may further include:
[0071] Step 410: When storing data, call the memory that serves as the storage object, and store the data to be stored in the memory that serves as the storage object.
[0072] Specifically, the specific implementation of the terminal storage expansion method provided by the present invention further includes the following steps:
[0073] Step 9: After the storage object is instantiated and the Android system starts up successfully, the storage management interface can be opened. The Android system calls the solid-state drive instantiated as the storage object, and the solid-state drive can be displayed in the form of a chart.
[0074] After completing the above 9 steps, the solid-state drive is integrated into the storage management unit of the terminal to be expanded and can store data as the storage object of the terminal to be expanded. That is, when data needs to be stored, the data to be stored is stored in the solid-state drive that serves as the storage object.
[0075] When the storage of the terminal to be expanded is insufficient, a hard disk (solid-state drive) is mounted through the PCIe bus. The PCIe bus is a high-speed bus directly connected to the CPU, and the access speed is relatively fast. However, the existing storage expansion uses an SD card for expansion, and the SD card is accessed through the SD card interface. The SD card interface is indirectly connected to the CPU. Compared with the direct connection of the PCIe interface, the access speed is slower. The present application mainly solves the above problems.
[0076] In this embodiment, by adding the mounting path information and device information of the memory to the system partition mounting configuration file and the storage management unit file of the terminal to be expanded respectively, the operating system of the terminal to be expanded assigns a unique device number to the memory, associates the mounting path of the memory through the device number, further instantiates the memory as a storage object, and finally when the terminal to be expanded needs to store data, stores the data to be stored in the memory serving as the storage object. By mounting the memory, the memory is instantiated as the storage object of the terminal to be expanded, and the capacity of the mounted memory is flexibly adjusted, realizing flexible expansion of the terminal storage.
[0077] Please refer to Figure 3 , in one embodiment, the terminal storage expansion method provided by the embodiments of the present application may further include:
[0078] Step 310, based on the device number, search in the storage management unit file for a memory with a PCIe interface, and determine the access path of the memory;
[0079] Step 320, associate the memory with the PCIe interface with the mounting path.
[0080] Specifically, the logic of this embodiment is: first obtain the logical access path from the partition configuration file, then find the device through the device number, and finally associate the device with the mounting path, and finally obtain the access path of the storage device accessible by the operating system.
[0081] As can be seen from the content described in step 300 above, after adding the device information of the solid-state drive to the storage management unit code of the terminal to be expanded, the Android system assigns a device number to the solid-state drive device. Through the device number, a solid-state drive with a PCIe interface can be found in the storage management unit of the terminal to be expanded, and then the solid-state drive with the PCIe interface is associated with the mounting path to realize the instantiation of the solid-state drive. The device number is determined based on the memory mounting path information and the device number of the solid-state drive. Through the device number of the solid-state drive, the solid-state drive can be accessed, laying a technical foundation for subsequently storing data in the solid-state drive.
[0082] This embodiment realizes the accessibility of the solid-state drive through technical features such as associating the mounting path and determining the device number, laying a technical foundation for storing data in the solid-state drive.
[0083] Next, the terminal storage expansion device provided by the present invention will be described. The terminal storage expansion device described below can be mutually corresponding and referred to with the terminal storage expansion method described above.
[0084] Please refer to Figure 4 , the present invention also provides a terminal storage expansion device, including:
[0085] A mounting path information adding module 401, configured to add the mounting path information of a memory to a system partition mounting configuration file of a terminal to be expanded;
[0086] A device information adding module 402, configured to add the device information of the memory to a storage management unit file of the terminal to be expanded;
[0087] A memory instantiation module 403, configured to associate the mounting path of the memory based on a device number, and instantiate the memory as a storage object, where the device number is a unique identifier assigned by an operating system of the terminal to be expanded;
[0088] A data storage module 404, configured to store data to be stored in the memory serving as a storage object when storing data.
[0089] Optionally, both the mounting path information and the device information include Peripheral Component Interconnect Express (PCIe) interface information.
[0090] Optionally, the terminal storage expansion device further includes:
[0091] A system image file generation module, configured to compile system source code of the terminal to be expanded to generate a system image file, where the system source code includes a system partition mounting configuration file with the added mounting path information and a storage management unit file with the added device information;
[0092] A system image file download module, configured to download the system image file to a firmware storage unit of the terminal to be expanded.
[0093] Optionally, the terminal storage expansion device further includes:
[0094] A device number determination module, configured to initialize a driver file of a memory with a PCIe interface when the memory is connected to a PCIe card slot to obtain the device number of the memory.
[0095] Optionally, the memory instantiation module includes:
[0096] A memory mounting path determination unit, configured to find a memory with a PCIe interface in the storage management unit file based on the device number and determine the access path of the memory;
[0097] A mounting path association unit, configured to associate the memory with the PCIe interface with the mounting path.
[0098] Optionally, the data storage module includes:
[0099] A data storage unit, which is used to call the memory as a storage object and store the data to be stored in the memory as a storage object when storing data.
[0100] Figure 5 An example of the physical structure diagram of an electronic device is shown as Figure 5 shown. The electronic device may include: a processor 510, a communication interface 520, a memory 530, and a communication bus 540. Among them, the processor 510, the communication interface 520, and the memory 530 complete mutual communication through the communication bus 540. The processor 510 can call the logical instructions in the memory 530 to execute the terminal storage expansion method.
[0101] In addition, when the logical instructions in the above-mentioned memory 530 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs, etc., which can store program codes.
[0102] On the other hand, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it is used to execute the terminal storage expansion method provided by the above-mentioned various methods.
[0103] The device embodiments described above are only illustrative. The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative labor.
[0104] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0105] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A terminal storage expansion method, characterized in that: include: Add the mount path information of the storage to the system partition mount configuration file of the terminal to be expanded; Adding the device information of the memory to the storage management unit file of the terminal to be expanded; The mounting path information and the device information both include high-speed serial computer expansion bus standard PCIe interface information; Associating the mount path of the memory with the device number, instantiating the memory as a storage object, wherein the device number is a unique identifier assigned by the operating system of the terminal to be expanded; In the case of storing data, storing the data to be stored in the memory as the storage object; The step of adding the device information of the memory to the storage management unit file of the terminal to be expanded comprises: Compiling the system source code of the terminal to be expanded to generate a system image file, wherein the system source code includes a system partition mount configuration file to which the mount path information is added, and a storage management unit file to which the device information is added; Downloading the system image file to the firmware storage unit of the terminal to be expanded; When the memory is connected to the PCIe card slot, the driver file of the memory with the PCIe interface is initialized to obtain the device number of the memory.
2. The terminal storage expansion method according to claim 1, characterized in that: The mount path of the storage device associated with the storage device based on the device number includes: Searching for a memory with a PCIe interface in the storage management unit file based on the device number, and determining an access path to the memory; The memory with the PCIe interface is associated with the mount path.
3. The terminal storage expansion method according to claim 1, characterized in that: In the case of storing data, storing the data to be stored in the memory as the storage object includes: In the case of storing data, the memory as the storage object is called, and the data to be stored is stored in the memory as the storage object.
4. A terminal storage expansion device, characterized in that: include: A mount path information adding module, used to add the mount path information of the storage to the system partition mount configuration file of the terminal to be expanded; A device information adding module, used to add the device information of the memory to the storage management unit file of the terminal to be expanded; The mounting path information and the device information both include high-speed serial computer expansion bus standard PCIe interface information; A memory instantiation module, configured to associate a mount path of the memory with a device number to instantiate the memory into a storage object, wherein the device number is a unique identifier assigned by an operating system of the terminal to be expanded; A data storage module, used for storing the data to be stored in the memory as a storage object when storing data; A system image file generation module, used for compiling the system source code of the terminal to be expanded to generate a system image file, wherein the system source code includes a system partition mount configuration file to which the mount path information is added, and a storage management unit file to which the device information is added; A system image file downloading module, used for downloading the system image file to the firmware storage unit of the terminal to be expanded; The device number determination module is used to initialize the driver file of the memory with a PCIe interface to obtain the device number of the memory when the memory is connected to the PCIe card slot.
5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the terminal storage expansion method as described in any one of claims 1 to 3 is implemented.
6. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the terminal storage expansion method as described in any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Storage configuration adjustment method, device and system of server, equipment and medium
CN117472289A
Fault domain capacity expansion method and device, computer equipment and storage medium
CN117631996A