CN104156175A - Virtual disk size smooth expansion method - Google Patents
Virtual disk size smooth expansion method Download PDFInfo
- Publication number
- CN104156175A CN104156175A CN201410383272.4A CN201410383272A CN104156175A CN 104156175 A CN104156175 A CN 104156175A CN 201410383272 A CN201410383272 A CN 201410383272A CN 104156175 A CN104156175 A CN 104156175A
- Authority
- CN
- China
- Prior art keywords
- virtual disk
- file
- sector
- size
- read
- 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.)
- Granted
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides a virtual disk size smooth expansion method. The method includes the following steps of firstly, setting the size of a virtual disk and the save path of a corresponding mirror image document; secondly, mounting a filtration driver of the virtual disk, redirecting the read-write operation for the last sector of the virtual disk to the first sector, and reading formatting information of the virtual disk; thirdly, uninstalling the virtual disk, and modifying the size of the virtual disk and the corresponding mirror image document; fourthly, remounting the virtual disk to complete expansion of the size of the virtual disk. The virtual disk size smooth expansion method has the advantages that rapid and smooth expansion can be conducted on the virtual disk; no reestablishment is needed when the virtual disk in the large size needs to be used; the problem that a system automatically conducts 0 value supplementation in the formatting process in the past is solved, the wait time is shortened when the virtual disk is established, and function experience of a user is improved.
Description
Technical field
The present invention relates to the level and smooth expanding method of a kind of virtual disk capacity.
Background technology
Virtual disk technology is more and more general in the application of secure data area, and the mode of shining upon at present virtual disk mainly contains file is mapped to virtual disk and creates image file and be mapped as two kinds of virtual disks.Wherein, although a file is mapped to the mode of a virtual disk, do not exist false disk size to be difficult for the problem of expanding; but there is following shortcoming in it: lack protection or protection weakness, in data security field, be difficult to meet the protection demand of safety and privacy.Therefore using the mode that creates virtual disk image file and be mapped to virtual disk is current main flow, the advantage of the virtual disk of this form is: combine virtual disk driver encryption and decryption, when carry virtual disk not, user file can be hidden in seamless, cannot get the file of depositing in wherein by search file, disk analysis etc., but also there is following shortcoming: 1, in the time will creating a larger virtual disk, need to create the image file of an equal size simultaneously, and carrying out initialization, this will spend compared with high latency; 2, when carrying out format, all need to write last sector that backups to virtual disk of first sector, this can cause starting all by automatic makeup 0, to be worth to the file content not yet writing between this position from file header; What 3, adopt at present is when image file creates, just to set virtual disk size, not support capacity is expanded, when capacity cannot meet user demand, can only re-create a virtual disk that capacity is larger, again by original file copy in the virtual disk of new establishment, this process is also not only time-consuming but also effort.
Summary of the invention
The technical problem to be solved in the present invention, be to provide a kind of virtual disk capacity level and smooth expanding method, by revising virtual disk partition table information, realize the smooth expansion to virtual disk, and according to the virtual disk size arranging, set the end position of corresponding image file, read-write operation for last sector of virtual disk is redirected in first sector simultaneously, thereby save the stand-by period that virtual disk creates, and improve user's functional experience.
The present invention is achieved in that the level and smooth expanding method of a kind of virtual disk capacity, specifically comprises the steps:
Step 1, the storing path of virtual disk size and corresponding image file is set;
Step 2, carry virtual disk filtration drive, be redirected to first sector by the read-write operation for last sector of virtual disk, and read the formatted message of virtual disk;
Step 3, unloading virtual disk, and the capacity of virtual disk and corresponding image file are modified;
Step 4, carry virtual disk again, complete the expansion of virtual disk capacity.
Further, described step 2 specifically comprises the following steps:
Step 21, carry virtual disk filtration drive, and by the read-write for virtual disk, according to the position of read-write, be reoriented in image file, the read-write operation for last sector of virtual disk is redirected in first sector simultaneously;
If the old virtual disk of step 22 open up appearance, read intrinsic formatted message in old virtual disk NTFS form subregion; If the establishment of new virtual disk, first creates the image file of low capacity virtual disk, then drive carry to become virtual disk, and be formatted into NTFS form, read afterwards the formatted message of this virtual disk.
Further, described formatted message comprises $ MFT document location, every sector-size, every bunch of sector number, total sector number, $ Bitmap document location, root directory position and $ BadClus document location.
Further, described step 3 specifically comprises the following steps:
Step 31, unloading virtual disk, and the virtual disk size arranging according to step 1 is set the end position of corresponding image file;
Step 32, big or small by the virtual disk arranging, and the formatted message reading in step 2 calculates total number of clusters of the virtual disk that makes new advances, total sector number and Bitmap file size, and remodify in image file the sector sum of corresponding new virtual disk partition heading bunch, and the actual size of the file record that in MFT, BadClus file is corresponding with Bitmap file, take size, compression sizes;
Step 33, revise $ Bitmap file reference position in the file record that $ Bitmap file is corresponding to the end position of former image file, and copy former $ Bitmap file content to new reference position, to in $ Bitmap file, represent for position that former $ Bitmap file takies bunch that 0 covers simultaneously, to discharge this segment space, in new $ Bitmap file, with 1, cover bunch position taking corresponding to $ Bitmap file, with 0 covering position to the end of file after 1, with the space that mark is newly-increased, do not use.
Tool of the present invention has the following advantages: 1, do not need to re-create virtual disk during dilatation, do not need to copy a large amount of files, realized the level and smooth expansion to virtual disk capacity, not only reduced the trouble of copy heap file, also saved the time; 2, the read-write operation for last sector of virtual disk is redirected in first sector, while making to format, does not have automatic makeup 0 value phenomenon, saved the expansion time; 3, according to the virtual disk size arranging, set the end position of corresponding image file, and unactual writing in files content, this has also saved the time of system initialization.
Accompanying drawing explanation
The present invention is further illustrated in conjunction with the embodiments with reference to the accompanying drawings.
Fig. 1 is the level and smooth expanding method flowchart of a kind of virtual disk capacity of the present invention.
Embodiment
Please refer to shown in Fig. 1, the level and smooth expanding method of a kind of virtual disk capacity, specifically comprises the following steps:
Step 1, at virtual disk, create interface required virtual disk size and the storing path of corresponding image file are set;
Step 2, carry virtual disk filtration drive, be redirected to first sector by the read-write operation for last sector of virtual disk, and read the formatted message of virtual disk; This step specifically comprises the following steps:
Step 21, carry virtual disk filtration drive, and by the read-write for virtual disk, according to the position of read-write, be reoriented in image file, the read-write operation for last sector of virtual disk is redirected in first sector simultaneously;
If the old virtual disk of step 22 open up appearance, read intrinsic formatted message in old virtual disk NTFS form subregion; If the establishment of new virtual disk, first creates the image file of low capacity virtual disk, then drive carry to become virtual disk, and be formatted into NTFS form, read afterwards the formatted message of this virtual disk;
Wherein, it is because when carry virtual disk becomes image file that read-write operation for last sector of virtual disk is redirected to first sector, if do not revise the first sector content backing up in last sector, will because of headed by sector and the backup of last sector do not conform to and cause being judged as zoned format and damage, if directly go to revise the content of this position, in the time of can causing operating system to detect, in former image file unactual part automatic makeup 0 value writing between the ending of new image file that ends up, thereby spend the regular hour.Described formatted message comprises $ MFT document location, every sector-size, every bunch of sector number, total sector number, $ Bitmap document location, root directory position and $ BadClus document location.
Step 3, unloading virtual disk, and the capacity of virtual disk and corresponding image file are modified; Concrete steps are as follows:
Step 31, carry out capacity while expanding, to first unload virtual disk, and the virtual disk size arranging according to step 1 is set the end position of corresponding image file, here we only arrange the end position of file and unactual writing in files content, are mainly in order to make the space that operating system can not newly increase because of deinitialization and to expend time in;
Step 32, big or small by the virtual disk arranging, and the every sector-size reading in step 2 and every bunch of sectors count make new advances total number of clusters of virtual disk, total sector number and $ Bitmap file size, and remodify in image file the sector sum of corresponding new virtual disk partition heading bunch, and in MFT file BadClus file and file record corresponding to Bitmap file actual size, take size, compression sizes;
Step 33, revise $ Bitmap file reference position in the file record that $ Bitmap file is corresponding to the end position of former image file, and copy former $ Bitmap file content to new reference position, to in $ Bitmap file, represent for position that former $ Bitmap file takies bunch that 0 covers simultaneously, to discharge this segment space, in new $ Bitmap file, with 1, cover bunch position taking corresponding to $ Bitmap file, with 0 covering position to the end of file after 1, with the space that mark is newly-increased, do not use.
Wherein, unloading virtual disk is because part operation system can be protected partition table; and at virtual disk in carry in the situation that; $ Bitmap file may have change to bunch taking the description of situation; this is unfavorable for the expansion work of disk size, so expand the process of virtual disk capacity, in unloading situation, carries out.
Step 4, carry virtual disk again, complete the expansion of virtual disk capacity.
In sum, we can know, the present invention has the following advantages: be first when dilatation, not need to re-create virtual disk, do not need to copy a large amount of documentations yet, realized the level and smooth expansion to virtual disk capacity, this has not only reduced the trouble of copy heap file, has also saved the time; Next is that the read-write operation for last sector of virtual disk is redirected in first sector, does not have automatic makeup 0 value phenomenon while making to format, and has saved the expansion time; Finally according to the virtual disk size arranging, to set the end position of corresponding image file, and unactual writing in files content, this has also saved the time of system initialization.
Although more than described the specific embodiment of the present invention; but being familiar with those skilled in the art is to be understood that; our described specific embodiment is illustrative; rather than for the restriction to scope of the present invention; those of ordinary skill in the art are in equivalent modification and the variation done according to spirit of the present invention, all should be encompassed in the scope that claim of the present invention protects.
Claims (4)
1. the level and smooth expanding method of virtual disk capacity, is characterized in that: comprise the steps:
Step 1, the storing path of virtual disk size and corresponding image file is set;
Step 2, carry virtual disk filtration drive, be redirected to first sector by the read-write operation for last sector of virtual disk, and read the formatted message of virtual disk;
Step 3, unloading virtual disk, and the capacity of virtual disk and corresponding image file are modified;
Step 4, carry virtual disk again, complete the expansion of virtual disk capacity.
2. the level and smooth expanding method of a kind of virtual disk capacity according to claim 1, is characterized in that: described step 2 specifically comprises the following steps:
Step 21, carry virtual disk filtration drive, and by the read-write for virtual disk, according to the position of read-write, be reoriented in image file, the read-write operation for last sector of virtual disk is redirected in first sector simultaneously;
If the old virtual disk of step 22 open up appearance, read intrinsic formatted message in old virtual disk NTFS form subregion; If the establishment of new virtual disk, first creates the image file of low capacity virtual disk, then drive carry to become virtual disk, and be formatted into NTFS form, read afterwards the formatted message of this virtual disk.
3. the level and smooth expanding method of a kind of virtual disk capacity according to claim 2, is characterized in that: described formatted message comprises $ MFT document location, every sector-size, every bunch of sector number, total sector number, $ Bitmap document location, root directory position and $ BadClus document location.
4. according to the level and smooth expanding method of a kind of virtual disk capacity described in claim 2 or 3, it is characterized in that: described step 3 specifically comprises the following steps:
Step 31, unloading virtual disk, and the virtual disk size arranging according to step 1 is set the end position of corresponding image file;
Step 32, big or small by the virtual disk arranging, and the formatted message reading in step 2 calculates total number of clusters of the virtual disk that makes new advances, total sector number and Bitmap file size, and remodify in image file the sector sum of corresponding new virtual disk partition heading bunch, and the actual size of the file record that in MFT, BadClus file is corresponding with Bitmap file, take size, compression sizes;
Step 33, revise $ Bitmap file reference position in the file record that $ Bitmap file is corresponding to the end position of former image file, and copy former $ Bitmap file content to new reference position, to in $ Bitmap file, represent for position that former $ Bitmap file takies bunch that 0 covers simultaneously, to discharge this segment space, in new $ Bitmap file, with 1, cover bunch position taking corresponding to $ Bitmap file, with 0 covering position to the end of file after 1, with the space that mark is newly-increased, do not use.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410383272.4A CN104156175B (en) | 2014-08-06 | 2014-08-06 | Virtual disk size smooth expansion method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410383272.4A CN104156175B (en) | 2014-08-06 | 2014-08-06 | Virtual disk size smooth expansion method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104156175A true CN104156175A (en) | 2014-11-19 |
CN104156175B CN104156175B (en) | 2017-05-24 |
Family
ID=51881685
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410383272.4A Active CN104156175B (en) | 2014-08-06 | 2014-08-06 | Virtual disk size smooth expansion method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104156175B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018045085A1 (en) * | 2016-08-30 | 2018-03-08 | Alibaba Group Holding Limited | Virtual disk expansion method and apparatus |
CN107861790A (en) * | 2017-10-27 | 2018-03-30 | 新华三云计算技术有限公司 | Magnetic disk of virtual machine Extend Methods of Spatial Distribution, device, host and readable storage medium storing program for executing |
CN109871183A (en) * | 2018-07-10 | 2019-06-11 | 四川中电启明星信息技术有限公司 | A kind of method and device that magnetic disk of virtual machine is simplified |
CN112597102A (en) * | 2020-12-29 | 2021-04-02 | 武汉噢易云计算股份有限公司 | High-efficiency mirror image file system implementation method |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101604226A (en) * | 2009-07-14 | 2009-12-16 | 浪潮电子信息产业股份有限公司 | A kind of method that makes up raising performance of storage system in dynamic buffering pond based on virtual RAID |
US20130041927A1 (en) * | 2011-08-10 | 2013-02-14 | Alibaba Group Holding Limited | Shrinking Virtual Hard Disk Image |
-
2014
- 2014-08-06 CN CN201410383272.4A patent/CN104156175B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101604226A (en) * | 2009-07-14 | 2009-12-16 | 浪潮电子信息产业股份有限公司 | A kind of method that makes up raising performance of storage system in dynamic buffering pond based on virtual RAID |
US20130041927A1 (en) * | 2011-08-10 | 2013-02-14 | Alibaba Group Holding Limited | Shrinking Virtual Hard Disk Image |
Non-Patent Citations (2)
Title |
---|
XUBO20109: "《Vmware增加虚拟磁盘空间》", 《HTTP://WENKU.BAIDU.COM/VIEW/C2B5E160376BAF1FFC4FADD4.HTML?FROM=SEARCH》 * |
焦术进等: "《基于写时重定向的虚拟机磁盘迁移技术》", 《电视技术》 * |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018045085A1 (en) * | 2016-08-30 | 2018-03-08 | Alibaba Group Holding Limited | Virtual disk expansion method and apparatus |
CN107861790A (en) * | 2017-10-27 | 2018-03-30 | 新华三云计算技术有限公司 | Magnetic disk of virtual machine Extend Methods of Spatial Distribution, device, host and readable storage medium storing program for executing |
CN107861790B (en) * | 2017-10-27 | 2020-05-15 | 新华三云计算技术有限公司 | Virtual machine disk space expansion method and device, host machine and readable storage medium |
CN109871183A (en) * | 2018-07-10 | 2019-06-11 | 四川中电启明星信息技术有限公司 | A kind of method and device that magnetic disk of virtual machine is simplified |
CN109871183B (en) * | 2018-07-10 | 2022-04-15 | 四川中电启明星信息技术有限公司 | Virtual machine disk simplification method and device |
CN112597102A (en) * | 2020-12-29 | 2021-04-02 | 武汉噢易云计算股份有限公司 | High-efficiency mirror image file system implementation method |
CN112597102B (en) * | 2020-12-29 | 2022-06-17 | 武汉噢易云计算股份有限公司 | High-efficiency mirror image file system implementation method |
Also Published As
Publication number | Publication date |
---|---|
CN104156175B (en) | 2017-05-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5386111B2 (en) | File system recording method | |
JP5314158B2 (en) | Method and computer readable medium for prestaging data based on dynamic storage tiering configuration | |
EP2169530B1 (en) | Method of managing memory storage space and a computer system | |
WO2011062861A1 (en) | Aligning data storage device partition to boundary of physical data sector | |
US7702845B2 (en) | Method and apparatus for managing blocks according to update type of data in block-type memory | |
US9916323B2 (en) | Support for worm cartridges realized by linear tape file system (LTFS) | |
CN103176864A (en) | Backup method, backup device and mobile terminal based on Android system | |
CN104156175A (en) | Virtual disk size smooth expansion method | |
CN100437504C (en) | Hard disc data backup system and method | |
US20120089765A1 (en) | Method for performing automatic boundary alignment and related non-volatile memory device | |
US9442656B2 (en) | Efficient use of metadata accompanying file writing to media | |
CN102096613B (en) | Method and device for generating snapshot | |
CN101324899B (en) | Method for rapidly writing NAND type FLASH | |
US20100174880A1 (en) | Method for fast format of a fully allocated volume when copied from a space efficient volume | |
US9235352B2 (en) | Datastore for non-overwriting storage devices | |
EP2678769B1 (en) | A device controller for a memory device | |
JP4765967B2 (en) | Information processing apparatus, information processing method, and program | |
KR20090119481A (en) | A log file of file system and method for recovering file system | |
CN101178676A (en) | Data backup method capable of modifying data revert structure and revert method | |
US7865472B1 (en) | Methods and systems for restoring file systems | |
CN101794254B (en) | NAND-FLASH data processing method | |
JP2005352535A (en) | Method of protecting data | |
JP5304154B2 (en) | Drive device, mount program, and mount method | |
US20140089356A1 (en) | Data storage device and operating method thereof | |
CN105573862A (en) | Method and equipment for recovering file systems |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information |
Address after: 361000 7FA unit B, innovation building, software park, torch hi tech Zone, Fujian, Xiamen Applicant after: Xiamen Tipray Technology Co., Ltd. Address before: 361000 7FA unit B, innovation building, software park, torch hi tech Zone, Fujian, Xiamen Applicant before: Xiamen Tipray Technology Co.,Ltd. |
|
COR | Change of bibliographic data | ||
GR01 | Patent grant | ||
GR01 | Patent grant |