WO2016188200A1 - 一种实现分区切换的方法及装置 - Google Patents
一种实现分区切换的方法及装置 Download PDFInfo
- Publication number
- WO2016188200A1 WO2016188200A1 PCT/CN2016/076506 CN2016076506W WO2016188200A1 WO 2016188200 A1 WO2016188200 A1 WO 2016188200A1 CN 2016076506 W CN2016076506 W CN 2016076506W WO 2016188200 A1 WO2016188200 A1 WO 2016188200A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- partition
- image file
- partition image
- file
- unit
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0638—Organizing or formatting or addressing of data
- G06F3/0644—Management of space entities, e.g. partitions, extents, pools
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/4401—Bootstrapping
- G06F9/4406—Loading of operating system
Definitions
- This application relates to, but is not limited to, the field of partition applications.
- an intelligent terminal generally includes a data partition and a cache partition.
- the data partition is used to install the system and store application data.
- the cache partition is used to store temporary data, for example, a temporary over-the-air software upgrade (FOTA) package.
- FOTA software upgrade
- (cache) partition can be planned partition. Due to the small number of storage media, when the size of the data partition and the cache partition are determined to be initialized, the partition size cannot be adjusted.
- the cache partition has a large storage space. As the number of applications increases or the installed application increases, the data partition cannot meet the requirements of the installation application. If the cache partition is small, the upgrade package cannot be downloaded, which affects the system upgrade.
- the size of the data partition and the cache partition when the size of the data partition and the cache partition can be determined, the size of the initial partition is unreasonable, and the storage space is insufficient during the process of installing the application or downloading the upgrade package, which affects the installation application or the system upgrade. Reduce the user's experience with the phone.
- This paper provides a method and device for implementing partition switching, which can solve the problem of insufficient data partition or cache partition space and improve user experience.
- a method for implementing partition switching includes:
- the second partition image file is created according to the system requirements, and the second partition image file is mapped to be continuous;
- the mount is mapped to a contiguous second partition image file to the third partition;
- mapping the second partition image file to consecutive includes:
- the method further includes:
- the content of the first partition image file is transferred to the image file of the second partition at the block device level.
- the method further includes: when the size of the first partition image file cannot meet the system requirement, before the second partition image file is created according to the system requirement, and the second partition image file is mapped to be continuous, the method further includes:
- the first partition image file is mounted according to a directory associated with the first partition image file established on the third partition.
- the method before the content of the first partition image file is transferred to the image file of the second partition at the block device level, the method further includes:
- the content of the image file of the first partition read from the file level is rewritten from the block device level to the first partition image file according to the storage block included in the first partition image file on the block device.
- the method further includes:
- the method further includes:
- the name of the second partition image file is replaced with the name of the first partition image file to start the new file system according to the name of the first partition image file.
- An apparatus for implementing zone switching includes: establishing a partition unit, a mounting unit, and establishing a system unit; wherein
- Establish a partition unit set to: when the size of the first partition image file cannot meet the system requirements, create a second partition image file according to the system requirements, and map the second partition image file to be continuous;
- Mounting unit set to: mount the mapping to a continuous second partition image file to the third partition;
- Establish a system unit set to: create a new file system on the second partition image file that is mounted.
- the establishment of the partition unit is set to,
- the second partition image file is created according to the system requirements
- the device further includes a mapping unit and a transfer unit; wherein
- mapping unit configured to: map the first partition image file to be continuous
- the transfer unit is configured to: when the new file system is established, transfer the content of the first partition image file to the image file of the second partition at the block device level.
- the device further includes: a packaging unit and a directory mounting unit; wherein
- Creating a packaging unit configured to: create the first partition image file according to the size of the first partition, and package the created first partition image file into the third partition;
- the directory mounting unit is configured to: mount the first partition image file according to a directory associated with the first partition image file established on the third partition.
- the device further includes an acquiring unit and a reading and writing unit; wherein
- An obtaining unit configured to: after the transfer unit transfers the content of the first partition image file to the image file of the second partition at the block device level, acquire all the storage blocks of the first partition image file on the block device;
- a reading and writing unit configured to: read the content of the first partition image file from a file level; and read the content of the image file of the first partition from a file level, according to the first partition image file on the block device The included memory block is rewritten from the block device level to the first partition image file.
- the device further includes a deleting unit, configured to: after the establishing the system unit establishes a new file system, deleting the first partition image file.
- a deleting unit configured to: after the establishing the system unit establishes a new file system, deleting the first partition image file.
- the establishing system unit is further configured to replace the name of the second partition image file with the name of the first partition image file after establishing a new file system on the completed second partition image file. To start the new file system based on the name of the first partition image file.
- a computer readable storage medium storing computer executable instructions for performing the method of any of the above.
- the technical solution of the present application includes: when the size of the first partition image file cannot meet the system requirements, the second partition image file is created according to the system requirement, and the second partition image file is mapped to be continuous; the mount mapping is continuous. The second partition image file is transferred to the third partition; a new file system is created on the completed second partition image file.
- the method of the embodiment of the present invention switches the first partition image file and the second partition image file that do not meet the system requirements by establishing a file system in the second partition image file, thereby realizing the adjustment of the partition size and avoiding the planned data partition.
- the fixed size of the cache partition affects the application installation or upgrade package download, which improves the user experience.
- FIG. 1 is a flowchart of a method for implementing partition switching according to an embodiment of the present invention
- FIG. 2 is a structural block diagram of an apparatus for implementing zone switching according to an embodiment of the present invention
- FIG. 3 is a flow chart of a method according to a first embodiment of the present invention.
- FIG. 4 is a schematic diagram showing the distribution of a first partition and a third partition according to an embodiment of the present invention
- Figure 5 is a flow chart of a method in accordance with a second embodiment of the present invention.
- FIG. 1 is a flowchart of a method for implementing zone switching according to an embodiment of the present invention. As shown in FIG. 1 , the method includes:
- Step 100 When the size of the first partition image file cannot meet the system requirements, create a second partition image file according to the system requirement, and map the second partition image file to be continuous;
- mapping the second partition image file to continuous includes:
- Mapping to continuous means logically arranging all the storage blocks of the partition so that all the storage blocks of the second partition image file are logically continuous.
- Step 101 The mount is mapped to a continuous second partition image file to the third partition.
- Step 102 Create a new file system on the second partition image file that is successfully mounted.
- the new file system that is started up to build includes:
- the method of the embodiment of the present invention completes the switching between the first partition and the second partition.
- the contents of the first partition image file are transferred to the image file of the second partition at the block device level.
- the method of mapping the first partition image file to the contiguous method is the same as the mapping of the second partition image file.
- all the storage blocks of the first partition image file are mapped to consecutive blocks on the block device in the operating system kernel. .
- the method before step 100, the method further includes:
- the first partition image file is mounted according to the directory associated with the first partition image file created on the third partition.
- the mounting of the third partition is exactly the same as that of the existing common partition, and will not be described here.
- the directory associated with the first partition is generated by packaging the created image file into the image of the second partition.
- the method of the embodiment of the present invention further includes:
- the content of the image file of the first partition read from the file level is rewritten from the block device level to the first partition image file according to the storage block included in the first partition image file on the block device.
- the method of the embodiment of the present invention further includes:
- the method of the embodiment of the present invention switches the first partition image file and the second partition image file that do not meet the system requirements by establishing a file system in the second partition image file, thereby realizing the adjustment of the partition size and avoiding the planned data partition.
- the fixed size of the cache partition affects the application installation or upgrade package download, which improves the user experience.
- FIG. 2 is a structural block diagram of an apparatus for implementing zone switching according to an embodiment of the present invention. As shown in FIG. 2, the method includes a partitioning unit 201, a mounting unit 202, and an establishing system unit 203.
- the partition unit 201 is set to be configured to: when the size of the first partition image file cannot meet the system requirements, establish a second partition image file according to the system requirement, and map the second partition image file to Continued
- the establishment partition unit 201 is set to,
- the second partition image file is created according to the system requirements
- the mounting unit 202 is configured to: mount the second partition image file mapped to the contiguous second partition image file to the third partition;
- the system unit 203 is set up to: establish a new file system on the second partition image file that is successfully mounted.
- the establishing system unit 203 is further configured to replace the name of the second partition image file with the name of the first partition image file after the new file system is created on the mounted second partition image file, to mirror the first partition image.
- the name of the file starts a new file system.
- the apparatus of the embodiment of the present invention further includes a mapping unit 204 and a forwarding unit 205;
- the mapping unit 204 is configured to: map the first partition image file to be continuous;
- the transferring unit 205 is configured to: when the new file system is created, transfer the content of the first partition image file to the image file of the second partition at the block device level.
- the device of the embodiment of the present invention further includes a packaging unit 206 and a directory mounting unit 207;
- the packaging unit 206 is configured to: create a first partition image file according to the size of the first partition, and package the created first partition image file into the third partition;
- the directory mount unit 207 is configured to mount the first partition image file according to the directory associated with the first partition image file created on the third partition.
- the device of the embodiment of the present invention further includes an obtaining unit 208 and a reading and writing unit 209;
- the obtaining unit 208 is configured to: after the transfer unit 205 transfers the content of the first partition image file to the image file of the second partition at the block device level, acquire all the storage blocks of the first partition image file on the block device;
- the reading and writing unit 209 is configured to: read the content of the first partition image file from the file level; the content of the image file of the first partition read from the file level, according to the storage included in the block device of the first partition image file The block rewrites the first partition image file from the block device level.
- the apparatus of the embodiment of the present invention further includes a deleting unit 210, configured to delete the first partition image file after the establishing system unit 210 establishes a new file system.
- FIG. 3 is a flowchart of the method according to the first embodiment of the present invention. As shown in FIG. 3, the method includes:
- Step 300 Create a first partition image file according to the first partition size, and package the created first partition image file into the third partition.
- Step 301 Download the third partition to the mobile phone, and mount the third partition.
- Step 302 Mount the first partition image file according to the directory associated with the first partition image file created on the third partition.
- FIG. 4 is a schematic diagram of distribution of a first partition and a third partition according to an embodiment of the present invention.
- the third partition is mounted by a common partition, and the third partition size is a sum of a mobile cache partition and a data partition.
- the first partition of this embodiment uses the space on the third partition.
- FIG. 5 is a flowchart of the method according to the second embodiment of the present invention. As shown in FIG. 5, when the size of the first partition image file cannot be satisfied, When required by the system, including:
- Step 500 Obtain all storage blocks of the first partition image file on the block device.
- the image file is contiguous from the file point of view, but the storage from the block device may be discrete, so all the storage blocks of the first partition image file on the block device need to be obtained. They may be one-by-one intervals, similar to 1- 3, 10-11.
- Step 501 Map the first partition image file to be continuous
- Step 502 After reading the content of the first partition image file from the file level, write the content of the image file back to the first partition at the block device level; here, the content of the image file is written back to the first partition at the block device level. According to the obtained first partition image file, all the storage blocks on the block device are performed.
- the image file of the first partition is not encrypted, but from the perspective of the block device, the file content is encrypted, so the content should be read out from the file level. Cleverly bypassing the encryption of the file system;
- Step 503 Create a second partition image file according to system requirements, obtain all storage blocks of the second partition image file on the block device, and map the second partition image file to be continuous;
- mapping the second partition image file to be continuous includes: in the security mode, all the storage blocks of the second partition image file are mapped to be consecutive on the block device in the operating system kernel.
- Partition switching is not possible during system operation. There are many services in the system that use partitions and must be restarted to safe mode. Safe mode has a specific partition that does not load encryption. This embodiment needs to consider the case of the first partition encryption when it is executed.
- Step 504 Mount the first partition image file and the second partition image file as block devices.
- Step 505 Create a new file system on the mounted second partition image file; here, the second partition image file is used as a new image file for file system installation.
- Step 506 Transfer the content included in the first partition image file to the second partition image file, and delete the first partition image file.
- Step 507 Replace the name of the second partition image file with the name of the first partition image file.
- Step 508 The mobile phone starts a new file system according to the name of the first partition image file.
- the switching of the first partition image file and the second partition image file is implemented by this embodiment.
- the first partition is a system data partition, and is mounted on the third partition.
- the third partition is divided into data blocks occupied by the data partition, and the other storage areas are used as cache partitions.
- the cache partition is insufficient.
- the upgrade package is stored, the user is notified by the embodiment of the present invention to perform the partition size switching, that is, the second partition image file is created; if the data partition does not have enough space for the second partition image file to be created, the first partition image needs to be mirrored. Some applications in the file are unloaded Load to meet space size requirements.
- a new file system is created and booted to complete the partition switch.
- partition switching is performed to obtain a data partition that meets the requirements.
- all or part of the steps of the above embodiments may also be implemented by using an integrated circuit. These steps may be separately fabricated into individual integrated circuit modules, or multiple modules or steps may be fabricated into a single integrated circuit module. achieve.
- the devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
- the device/function module/functional unit in the above embodiment When the device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium.
- the above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
- the embodiment of the present invention switches the first partition image file and the second partition image file that do not meet the system requirements, and implements the adjustment of the partition size, thereby avoiding the application installation or upgrade due to the fixed size of the planned data partition and the cache partition.
- Package downloads improve the user experience.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Human Computer Interaction (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
一种实现分区切换的方法及装置,所述方法包括:当第一分区镜像文件大小无法满足***要求时,根据***要求建立第二分区镜像文件,并映射第二分区镜像文件为连续(100);挂载映射为连续的第二分区镜像文件到第三分区(101);在完成挂载的第二分区镜像文件上建立新的文件***(102)。
Description
本申请涉及但不限于分区应用领域。
智能终端作为日常应用较多的设备,一般包含有数据(data)分区和缓存(cache)分区。以安卓手机(也可以是平板电脑)为例、data分区用于应用安装***和存放应用数据;cache分区用于存放临时的数据,例如、存放临时的空中下载软件升级(FOTA)包。市场上占有量较大的部分低端智能设备,为了实现成本的有效控制,一般采用较少的存储介质,例如、采用4千兆字节(GB)的存储介质作为数据(data)分区和缓存(cache)分区可以规划的分区。由于存储介质较少,当初始化确定data分区和cache分区大小后,分区大小将无法进行调整,容易出现下述问题:手机进行版本升级时,需要通过较大的cache分区来存储升级包,如果设置cache分区存储空间较大,则随着应用数量的增多或安装应用增大,data分区将无法满足安装应用要求;如果cache分区较小,则无法进行升级包的下载,影响***升级。
上述方法中,在可用于规划data分区和cache分区大小确定时,由于初始化分区大小不合理,导致用户安装应用、或下载升级包过程中出现存储空间不足问题,影响安装应用或***升级的同时,降低了用户对手机的使用体验。
发明内容
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。
本文提供一种实现分区切换的方法及装置,能够解决数据分区或缓存分区空间不足的问题,提高用户使用体验。
一种实现分区切换的方法,包括:
当第一分区镜像文件大小无法满足***要求时,根据***要求建立第二分区镜像文件,并映射第二分区镜像文件为连续;
挂载映射为连续的第二分区镜像文件到第三分区;
在完成挂载的第二分区镜像文件上建立新的文件***。
可选地,映射第二分区镜像文件为连续包括:
在安全模式下,在操作***内核中将所述第二分区镜像文件的所有存储块在块设备上映射为连续。
可选地,该方法还包括:
映射所述第一分区镜像文件为连续;
建立所述新的文件***时,在块设备层面将所述第一分区镜像文件的内容转移到第二分区的镜像文件。
可选地,所述当第一分区镜像文件大小无法满足***要求时,根据***要求建立第二分区镜像文件,并映射第二分区镜像文件为连续之前,该方法还包括:
根据所述第一分区的大小制作所述第一分区镜像文件,并将制作的所述第一分区镜像文件打包到所述第三分区中;
根据第三分区上建立的与所述第一分区镜像文件关联的目录挂载所述第一分区镜像文件。
可选地,在块设备层面将所述第一分区镜像文件的内容转移到第二分区的镜像文件之前,该方法还包括:
获取所述第一分区镜像文件在块设备上的所有存储块;
从文件层面读取所述第一分区镜像文件的内容;
将从文件层面读取的所述第一分区的镜像文件的内容,根据第一分区镜像文件在块设备上包含的存储块从块设备层面重新写入所述第一分区镜像文件。
可选地,建立新的文件***后,该方法还包括:
删除所述第一分区镜像文件。
可选地,在完成挂载的第二分区镜像文件上建立新的文件***之后,所述方法还包括:
将所述第二分区镜像文件的名称替换为所述第一分区镜像文件的名称,以根据第一分区镜像文件的名称启动所述新的文件***。
一种实现分区切换的装置,包括:建立分区单元、挂载单元和建立***单元;其中,
建立分区单元,设置为:当第一分区镜像文件大小无法满足***要求时,根据***要求建立第二分区镜像文件,并映射第二分区镜像文件为连续;
挂载单元,设置为:挂载映射为连续的第二分区镜像文件到第三分区;
建立***单元,设置为:在完成挂载的第二分区镜像文件上建立新的文件***。
可选地,建立分区单元是设置为,
当第一分区镜像文件大小无法满足***要求时,根据***要求建立第二分区镜像文件;
在安全模式下,在操作***内核中将所述第二分区镜像文件的所有存储块在块设备上映射为连续。
可选地,该装置还包括映射单元和转移单元;其中,
映射单元,设置为:映射所述第一分区镜像文件为连续;
转移单元,设置为:建立所述新的文件***时,在块设备层面将所述第一分区镜像文件的内容转移到第二分区的镜像文件。
可选地,该装置还包括制作打包单元和目录挂载单元;其中,
制作打包单元,设置为:根据所述第一分区的大小制作所述第一分区镜像文件,并将制作的所述第一分区镜像文件打包到所述第三分区中;
目录挂载单元,设置为:根据第三分区上建立的与所述第一分区镜像文件关联的目录挂载所述第一分区镜像文件。
可选地,该装置还包括获取单元和读写单元;其中,
获取单元,设置为:在转移单元在块设备层面将所述第一分区镜像文件的内容转移到第二分区的镜像文件之前,获取所述第一分区镜像文件在块设备上的所有存储块;
读写单元,设置为:从文件层面读取所述第一分区镜像文件的内容;将从文件层面读取的所述第一分区的镜像文件的内容,根据第一分区镜像文件在块设备上包含的存储块从块设备层面重新写入所述第一分区镜像文件。
可选地,该装置还包括删除单元,设置为:在建立***单元建立新的文件***后,删除所述第一分区镜像文件。
可选地,建立***单元还设置为,在完成挂载的第二分区镜像文件上建立新的文件***之后,将所述第二分区镜像文件的名称替换为所述第一分区镜像文件的名称,以根据第一分区镜像文件的名称启动所述新的文件***。
一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行上述任一项的方法。
与相关技术相比,本申请技术方案包括:当第一分区镜像文件大小无法满足***要求时,根据***要求建立第二分区镜像文件,并映射第二分区镜像文件为连续;挂载映射为连续的第二分区镜像文件到第三分区;在完成挂载的第二分区镜像文件上建立新的文件***。本发明实施例方法通过在第二分区镜像文件建立文件***,对不满足***要求的第一分区镜像文件与第二分区镜像文件进行切换,实现了分区大小的调整,避免了由于规划的数据分区和缓存分区大小固定影响应用安装或升级包下载,提高了用户的用户体验。
在阅读并理解了附图和详细描述后,可以明白其他方面。
附图概述
图1为本发明实施例实现分区切换的方法的流程图;
图2为本发明实施例实现分区切换的装置的结构框图;
图3为本发明第一实施例的方法流程图;
图4是本发明实施例第一分区和第三分区的分布示意图;
图5为本发明第二实施例的方法流程图。
下文中将结合附图对本发明的实施方式进行说明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。
图1为本发明实施例实现分区切换的方法的流程图,如图1所示,包括:
步骤100、当第一分区镜像文件大小无法满足***要求时,根据***要求建立第二分区镜像文件,并映射第二分区镜像文件为连续;
本步骤中,映射第二分区镜像文件为连续包括:
在安全模式下,在操作***内核中将第二分区镜像文件的所有存储块在块设备上映射为连续。
这里映射为连续是指将分区的所有存储块进行逻辑上的编排,使第二分区镜像文件的所有存储块在逻辑层面上是连续的。
步骤101、挂载映射为连续的第二分区镜像文件到第三分区;
步骤102、在完成挂载的第二分区镜像文件上建立新的文件***。
其中,建立新的文件***之后,还包括:启动建立的新的文件***。
启动建立的新的文件***包括:
将第二分区镜像文件的名称替换为第一分区镜像文件的名称,以根据第一分区镜像文件的名称启动新的文件***。
使用第二分区上建立的文件***时,本发明实施例方法完成了第一分区和第二分区的切换。
本发明实施例方法还包括:
映射第一分区镜像文件为连续;
建立新的文件***时,在块设备层面将第一分区镜像文件的内容转移到第二分区的镜像文件。
映射第一分区镜像文件为连续的方法与映射第二分区镜像文件为连续原理相同,即在安全模式下,在操作***内核中将第一分区镜像文件的所有存储块在块设备上映射为连续。
本实施例中,步骤100之前还包括:
根据第一分区的大小制作第一分区镜像文件,并将制作的第一分区镜像文件打包到第三分区中;
根据第三分区上建立的与第一分区镜像文件关联的目录挂载第一分区镜像文件。
第三分区的挂载与已有的普通分区的挂载方式完全相同,在此不再赘述。与第一分区关联的目录通过制作的镜像文件打包到第二分区的镜像中生成。
在块设备层面将第一分区镜像文件的内容转移到第二分区的镜像文件之前,本发明实施例方法还包括:
获取第一分区镜像文件在块设备上的所有存储块;
从文件层面读取第一分区镜像文件的内容;
将从文件层面读取的第一分区的镜像文件的内容,根据第一分区镜像文件在块设备上包含的存储块从块设备层面重新写入第一分区镜像文件。
建立新的文件***后,本发明实施例方法还包括:
删除第一分区镜像文件。
本发明实施例方法通过在第二分区镜像文件建立文件***,对不满足***要求的第一分区镜像文件与第二分区镜像文件进行切换,实现了分区大小的调整,避免了由于规划的数据分区和缓存分区大小固定影响应用安装或升级包下载,提高了用户的用户体验。
图2为本发明实施例实现分区切换的装置的结构框图,如图2所示,包括建立分区单元201、挂载单元202和建立***单元203;其中,
建立分区单元201,设置为:当第一分区镜像文件大小无法满足***要求时,根据***要求建立第二分区镜像文件,并映射第二分区镜像文件为连
续;
建立分区单元201是设置为,
当第一分区镜像文件大小无法满足***要求时,根据***要求建立第二分区镜像文件;
在安全模式下,在操作***内核中将第二分区镜像文件的所有存储块在块设备上映射为连续。
挂载单元202,设置为:挂载映射为连续的第二分区镜像文件到第三分区;
建立***单元203,设置为:在完成挂载的第二分区镜像文件上建立新的文件***。
建立***单元203还设置为,在完成挂载的第二分区镜像文件上建立新的文件***之后,将第二分区镜像文件的名称替换为第一分区镜像文件的名称,以根据第一分区镜像文件的名称启动新的文件***。
本发明实施例装置还包括映射单元204和转移单元205;其中,
映射单元204,设置为:映射第一分区镜像文件为连续;
转移单元205,设置为:建立新的文件***时,在块设备层面将第一分区镜像文件的内容转移到第二分区的镜像文件。
本发明实施例装置还包括制作打包单元206和目录挂载单元207;其中,
制作打包单元206,设置为:根据第一分区的大小制作第一分区镜像文件,并将制作的第一分区镜像文件打包到第三分区中;
目录挂载单元207,设置为:根据第三分区上建立的与第一分区镜像文件关联的目录挂载第一分区镜像文件。
本发明实施例装置还包括获取单元208和读写单元209;其中,
获取单元208,设置为:在转移单元205在块设备层面将第一分区镜像文件的内容转移到第二分区的镜像文件之前,获取第一分区镜像文件在块设备上的所有存储块;
读写单元209,设置为:从文件层面读取第一分区镜像文件的内容;将从文件层面读取的第一分区的镜像文件的内容,根据第一分区镜像文件在块设备上包含的存储块从块设备层面重新写入第一分区镜像文件。
本发明实施例装置还包括删除单元210,设置为:在建立***单元210建立新的文件***后,删除第一分区镜像文件。
以下通过实施例进行说明。
实施例1
本实施例通过对手机的进行分区的初始化和挂载对本发明实施例方法进行清楚详细的说明,图3为本发明第一实施例的方法流程图,如图3所示,包括:
步骤300、根据第一分区大小制作第一分区镜像文件,并将制作的第一分区镜像文件打包到第三分区中;
步骤301、将第三分区下载到手机中,挂载第三分区;
步骤302、根据第三分区上建立的与第一分区镜像文件关联的目录,挂载第一分区镜像文件。
图4是本发明实施例第一分区和第三分区的分布示意图,如图4所示,第三分区通过普通分区进行挂载,第三分区大小为手机缓存分区和数据分区的总和。本实施例第一分区使用的是第三分区上的空间。
实施例2
本实施以第一分区无法满足***要求为例,对本发明实施例方法进行说明,图5为本发明第二实施例的方法流程图,如图5所示,当第一分区镜像文件大小无法满足***要求时,包括:
步骤500、获取第一分区镜像文件在块设备上的所有存储块;
镜像文件从文件角度看是连续的,但从块设备上的存储可能是离散的,所以需要获取第一分区镜像文件在块设备上的所有存储块,它们可能是一个一个的区间,类似1-3,10-11。
步骤501、映射第一分区镜像文件为连续;
步骤502、将第一分区镜像文件的内容从文件层面读取后,以块设备层面将镜像文件的内容写回第一分区;这里,以块设备层面将镜像文件的内容写回第一分区需要根据获取的第一分区镜像文件在块设备上的所有存储块进行。
从文件角度看,第一分区的镜像文件是不加密的,但是从块设备角度看,文件内容是加密的,所以先要从文件层面把内容读出来。巧妙地绕过了文件***的加密;
步骤503、根据***要求建立第二分区镜像文件,获取第二分区镜像文件在块设备上的所有存储块,并映射第二分区镜像文件为连续;
可选的,映射第二分区镜像文件为连续包括:在安全模式下,在操作***内核中将第二分区镜像文件的所有存储块在块设备上映射为连续。
***运行期间是不能做分区切换的,***中有很多服务都会使用分区,必须重启到安全模式。安全模式有个特定不会加载加密的分区。本实施例执行时需要考虑到第一分区加密的情况。
步骤504、挂载第一分区镜像文件和第二分区镜像文件为块设备。
步骤505、在挂载的第二分区镜像文件上建立新的文件***;这里,第二分区镜像文件作为新的镜像文件用于文件***的安装。
步骤506、将第一分区镜像文件包含的内容转移到第二分区镜像文件中,并删除第一分区镜像文件;
步骤507、将第二分区镜像文件的名称替换为第一分区镜像文件的名称;
步骤508、手机根据第一分区镜像文件的名称启动新的文件***。
通过本实施例实现第一分区镜像文件和第二分区镜像文件的切换。
上述实施例中,第一分区为***数据分区,挂载在第三分区,第三分区除数据分区占用的数据块,其他的存储区间作为缓存分区;当手机接收到一个升级包,缓存分区不足以存储升级包时,通过本发明实施例通知用户进行分区大小切换,即建立第二分区镜像文件;如果数据分区没有足够的空间用于第二分区镜像文件的建立,则需要对第一分区镜像文件中部分应用进行卸
载,以满足空间大小要求。第二分区镜像文件建立完成后,建立新的文件***并启动就完成了分区的切换。当数据分区大小不足时,按照本实施例方法调整第二分区镜像文件大小后,进行分区切换即可获得满足要求的数据分区。
本领域普通技术人员可以理解上述实施例的全部或部分步骤可以使用计算机程序流程来实现,所述计算机程序可以存储于一计算机可读存储介质中,所述计算机程序在相应的硬件平台上(如***、设备、装置、器件等)执行,在执行时,包括方法实施例的步骤之一或其组合。
可选地,上述实施例的全部或部分步骤也可以使用集成电路来实现,这些步骤可以被分别制作成一个个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。
上述实施例中的装置/功能模块/功能单元可以采用通用的计算装置来实现,它们可以集中在单个的计算装置上,也可以分布在多个计算装置所组成的网络上。
上述实施例中的装置/功能模块/功能单元以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。上述提到的计算机可读取存储介质可以是只读存储器,磁盘或光盘等。
通过本发明实施例,对不满足***要求的第一分区镜像文件与第二分区镜像文件进行切换,实现了分区大小的调整,避免了由于规划的数据分区和缓存分区大小固定影响应用安装或升级包下载,提高了用户的用户体验。
Claims (15)
- 一种实现分区切换的方法,包括:当第一分区镜像文件大小无法满足***要求时,根据***要求建立第二分区镜像文件,并映射第二分区镜像文件为连续;挂载映射为连续的第二分区镜像文件到第三分区;在完成挂载的第二分区镜像文件上建立新的文件***。
- 根据权利要求1所述的方法,其中,所述映射第二分区镜像文件为连续包括:在安全模式下,在操作***内核中将所述第二分区镜像文件的所有存储块在块设备上映射为连续。
- 根据权利要求1或2所述的方法,该方法还包括:映射所述第一分区镜像文件为连续;建立所述新的文件***时,在块设备层面将所述第一分区镜像文件的内容转移到第二分区的镜像文件。
- 根据权利要求1或2所述的方法,其中,所述当第一分区镜像文件大小无法满足***要求时,根据***要求建立第二分区镜像文件,并映射第二分区镜像文件为连续之前,该方法还包括:根据所述第一分区的大小制作所述第一分区镜像文件,并将制作的所述第一分区镜像文件打包到所述第三分区中;根据第三分区上建立的与所述第一分区镜像文件关联的目录挂载所述第一分区镜像文件。
- 根据权利要求3所述的方法,其中,所述在块设备层面将所述第一分区镜像文件的内容转移到第二分区的镜像文件之前,该方法还包括:获取所述第一分区镜像文件在块设备上的所有存储块;从文件层面读取所述第一分区镜像文件的内容;将从文件层面读取的所述第一分区的镜像文件的内容,根据第一分区镜 像文件在块设备上包含的存储块从块设备层面重新写入所述第一分区镜像文件。
- 根据权利要求1所述的方法,其中,建立新的文件***后,该方法还包括:删除所述第一分区镜像文件。
- 根据权利要求1或6所述的方法,其中,所述在完成挂载的第二分区镜像文件上建立新的文件***之后,所述方法还包括:将所述第二分区镜像文件的名称替换为所述第一分区镜像文件的名称,以根据第一分区镜像文件的名称启动所述新的文件***。
- 一种实现分区切换的装置,包括:建立分区单元、挂载单元和建立***单元;其中,建立分区单元,设置为:当第一分区镜像文件大小无法满足***要求时,根据***要求建立第二分区镜像文件,并映射第二分区镜像文件为连续;挂载单元,设置为:挂载映射为连续的第二分区镜像文件到第三分区;建立***单元,设置为:在完成挂载的第二分区镜像文件上建立新的文件***。
- 根据权利要求8所述的装置,其中,所述建立分区单元是设置为,当第一分区镜像文件大小无法满足***要求时,根据***要求建立第二分区镜像文件;在安全模式下,在操作***内核中将所述第二分区镜像文件的所有存储块在块设备上映射为连续。
- 根据权利要求8或9所述的装置,该装置还包括映射单元和转移单元;其中,映射单元,设置为:映射所述第一分区镜像文件为连续;转移单元,设置为:建立所述新的文件***时,在块设备层面将所述第一分区镜像文件的内容转移到第二分区的镜像文件。
- 根据权利要求8或9所述的装置,该装置还包括制作打包单元和目录挂载单元;其中,制作打包单元,设置为:根据所述第一分区的大小制作所述第一分区镜像文件,并将制作的所述第一分区镜像文件打包到所述第三分区中;目录挂载单元,设置为:根据第三分区上建立的与所述第一分区镜像文件关联的目录挂载所述第一分区镜像文件。
- 根据权利要求11所述的装置,其中,该装置还包括获取单元和读写单元;其中,获取单元,设置为:在转移单元在块设备层面将所述第一分区镜像文件的内容转移到第二分区的镜像文件之前,获取所述第一分区镜像文件在块设备上的所有存储块;读写单元,设置为:从文件层面读取所述第一分区镜像文件的内容;将从文件层面读取的所述第一分区的镜像文件的内容,根据第一分区镜像文件在块设备上包含的存储块从块设备层面重新写入所述第一分区镜像文件。
- 根据权利要求8所述的装置,该装置还包括删除单元,设置为:在建立***单元建立新的文件***后,删除所述第一分区镜像文件。
- 根据权利要求8或13所述的装置,其中,建立***单元还设置为,在完成挂载的第二分区镜像文件上建立新的文件***之后,将所述第二分区镜像文件的名称替换为所述第一分区镜像文件的名称,以根据第一分区镜像文件的名称启动所述新的文件***。
- 一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行权利要求1-7任一项的方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510679970.3A CN106598475A (zh) | 2015-10-19 | 2015-10-19 | 一种实现分区切换的方法及装置 |
CN201510679970.3 | 2015-10-19 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2016188200A1 true WO2016188200A1 (zh) | 2016-12-01 |
Family
ID=57392592
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2016/076506 WO2016188200A1 (zh) | 2015-10-19 | 2016-03-16 | 一种实现分区切换的方法及装置 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN106598475A (zh) |
WO (1) | WO2016188200A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112579521A (zh) * | 2019-09-29 | 2021-03-30 | 北京君正集成电路股份有限公司 | 一种基于设备映射机制的文件***的实现方法 |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107908476B (zh) * | 2017-11-11 | 2020-06-23 | 许继集团有限公司 | 基于分布式集群的数据处理方法与装置 |
CN113126893B (zh) * | 2020-01-16 | 2023-06-16 | 深圳市万普拉斯科技有限公司 | 扩展***分区的方法、装置、存储介质和计算机设备 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090282195A1 (en) * | 2008-05-09 | 2009-11-12 | Kuo-Chu Wang | Method of managing memory storage space and a computer system |
CN102722444A (zh) * | 2012-05-23 | 2012-10-10 | 北京百纳威尔科技有限公司 | 扩展内部存储空间的方法、装置及终端 |
CN102831173A (zh) * | 2012-07-27 | 2012-12-19 | Tcl集团股份有限公司 | 基于Android***的内存扩展方法、装置及终端设备 |
CN103383660A (zh) * | 2013-04-01 | 2013-11-06 | 华为终端有限公司 | 一种Android***cache分区功能实现方法、装置及终端设备 |
CN104408053A (zh) * | 2014-10-29 | 2015-03-11 | 上海斐讯数据通信技术有限公司 | 一种移动终端存储卡扩展方法 |
-
2015
- 2015-10-19 CN CN201510679970.3A patent/CN106598475A/zh active Pending
-
2016
- 2016-03-16 WO PCT/CN2016/076506 patent/WO2016188200A1/zh active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090282195A1 (en) * | 2008-05-09 | 2009-11-12 | Kuo-Chu Wang | Method of managing memory storage space and a computer system |
CN102722444A (zh) * | 2012-05-23 | 2012-10-10 | 北京百纳威尔科技有限公司 | 扩展内部存储空间的方法、装置及终端 |
CN102831173A (zh) * | 2012-07-27 | 2012-12-19 | Tcl集团股份有限公司 | 基于Android***的内存扩展方法、装置及终端设备 |
CN103383660A (zh) * | 2013-04-01 | 2013-11-06 | 华为终端有限公司 | 一种Android***cache分区功能实现方法、装置及终端设备 |
CN104408053A (zh) * | 2014-10-29 | 2015-03-11 | 上海斐讯数据通信技术有限公司 | 一种移动终端存储卡扩展方法 |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112579521A (zh) * | 2019-09-29 | 2021-03-30 | 北京君正集成电路股份有限公司 | 一种基于设备映射机制的文件***的实现方法 |
Also Published As
Publication number | Publication date |
---|---|
CN106598475A (zh) | 2017-04-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20180150640A1 (en) | Policy aware unified file system | |
CN107111450B (zh) | 使用分区表进行的磁盘分区拼接和重新均衡 | |
CN105867947B (zh) | 预置应用程序升级后的数据处理方法及装置 | |
US9258357B2 (en) | Method for accessing plural cloud storages, electronic apparatus and non-transitory computer readable medium | |
US20130238844A1 (en) | Method and system for accessing a storage system with multiple file systems | |
JP2015513377A (ja) | クライアントプラットホーム及びクラウドストレージ端末 | |
US20140279904A1 (en) | Metadata-driven version management service in pervasive environment | |
CN108268299A (zh) | 一种基于OpenStack云平台的Docker共享存储解决方法 | |
WO2021143845A1 (zh) | 扩展***分区的方法、装置、存储介质和计算机设备 | |
CN101512485A (zh) | 用于作为后台任务更新固件的方法和装置 | |
CN106648462B (zh) | 数据存储方法及装置 | |
CN103716346A (zh) | 一种安卓手机客户端上应用的管理方法和装置 | |
WO2016188200A1 (zh) | 一种实现分区切换的方法及装置 | |
WO2015106511A1 (zh) | 一种移动终端的虚拟存储的实现方法及装置 | |
CN107728947A (zh) | 一种容器冷迁移方法与*** | |
CN112835524A (zh) | 存储资源配置方法、存储资源控制器及调度*** | |
Do et al. | Enforcing file system permissions on android external storage: Android file system permissions (afp) prototype and owncloud | |
WO2014180427A1 (zh) | 应用程序管理方法及装置 | |
CN110597568B (zh) | 一种插件部署方法、***及终端 | |
CN110209420A (zh) | 一种更新引导加载程序的方法及装置 | |
WO2016070655A1 (zh) | 一种信息备份方法、装置、服务器和终端 | |
CN103987064A (zh) | 接入点ap升级方法及装置 | |
CN105593839A (zh) | 分布式灾难恢复文件同步服务器*** | |
CN102281312A (zh) | 一种数据加载方法、***和数据处理方法、*** | |
JP7257554B2 (ja) | モデルファイルのディストリビューション方法、プラットホーム、システム、端末及び可読記憶媒体 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 16799089 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 16799089 Country of ref document: EP Kind code of ref document: A1 |