CN107885455B - 一种磁盘日志区动态调整方法 - Google Patents
一种磁盘日志区动态调整方法 Download PDFInfo
- Publication number
- CN107885455B CN107885455B CN201610863782.0A CN201610863782A CN107885455B CN 107885455 B CN107885455 B CN 107885455B CN 201610863782 A CN201610863782 A CN 201610863782A CN 107885455 B CN107885455 B CN 107885455B
- Authority
- CN
- China
- Prior art keywords
- disk
- log area
- area
- data
- log
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 21
- 238000010586 diagram Methods 0.000 description 4
- 238000013500 data storage Methods 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
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/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0608—Saving storage space on storage systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/0706—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
- G06F11/0727—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in a storage system, e.g. in a DASD or network based storage system
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/0766—Error or fault reporting or storing
- G06F11/0787—Storage of error reports, e.g. persistent data storage, storage using memory protection
-
- 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
-
- 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/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
- G06F3/0674—Disk device
- G06F3/0676—Magnetic disk device
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Quality & Reliability (AREA)
- Signal Processing For Digital Recording And Reproducing (AREA)
- Debugging And Monitoring (AREA)
Abstract
本发明公开了一种磁盘日志区动态调整方法,在磁盘中设定一个固定比例x%的区域为日志区;随着磁盘写入进度,根据剩余空间数量,对日志区进行调整,调整后日志区大小为剩余总空间的x%。本发明可动态地调整磁盘日志区,满足磁盘对较大预留和较小预留的需求情况。当日志区的比例为磁盘总空间的50%时,数据区容量与日志区容量大小相等,可满足数据区对任意比例日志区的需要。理论上磁盘利用率可达100%。使磁盘空间利用最大化,提高磁盘的利用率的优点。
Description
技术领域
本发明涉及磁盘存储领域,特别提供了一种磁盘日志区调整方法。
背景技术
随着计算机技术以及网络技术的高速发展,计算机自带的存储器逐渐难以满足存取速度快、存储容量大和成本低等诸多要求,于是发展出相对独立的存储系统。存储系统通常由存储服务器等存储设备组成,具有自己的接口和协议,通过同轴电缆、网线、光纤等方式与计算机主机连接,作为数据的存储中心为计算机主机提供存储服务。
独立磁盘冗余阵列(RAID,Redundant Array of Independent Disks)是把相同的数据存储在多个硬盘的不同的地方的方法,磁盘数据存储中,通常会使用多个磁盘构建RAID 阵列。一个RAID 阵列中包括有多个磁盘。
而磁盘在实际使用中具有有限的使用寿命。由于寿命原因等会出现坏块,如果磁盘存在多个坏道(通常是指有扇区损坏的空间,比如一个条带中的条带块)则可能会导致数据丢失。在实践中通常在磁盘中的数据区后设定一个日志区,数据存储遇到坏块时,数据将直接存到日志区中。并将相应存储地址、映射关系、存储时间存储在日志区中的日志中。为此一般在磁盘后部设定一个固定比例的日志区,如10%。在数据写入日志区时,一般是从前往后写入。
公布号为CN102226892A的中国发明专利公开了一种磁盘容错处理方法及设备,每一磁盘划分为数据区和日志区,当两块以上磁盘故障时,在日志区记录应当写入故障磁盘的数据、以及出错时间和/或出错地址:插入新磁盘后根据日志区记录的数据、以及数据的出错时间和/或出错地址将数据写入新磁盘的数据区。其日志区占磁盘总存储空间的10%。
这种方法存还两个问题:1.预留不足,当故障太多,日志区写完时,磁盘不能继续写入。2.预留过多,预留空间过多时会造成资源浪费,不能高效地利用磁盘空间。以上都造成了磁盘不能有效利用。
发明内容
本发明公开了一种磁盘预留动态调整方法,具体为:在磁盘中设定一个固定比例x%的区域为日志区。随着磁盘写入进度,根据剩余空间数量,对日志区进行调整,调整后日志区大小为剩余总空间的x%,0<x≤50。
该日志区设置在磁盘后部。
进一步地,为了使预留能足够满足磁盘损坏的最大情况,固定预留比例为50%。
磁盘写入一定量数据后,根据剩余空间总量、预留空间所占比例,计算出预留空间大小。并在磁盘尾部重新设定新的日志区。日志区末尾处即磁盘末尾处。数据区与日志区的写入顺序为从前向后。
由于传统数据从前往后的写入方法,日志区在写入数据后再调整会出现数据区与日志区出来交叉的情况。为此,在日志区设定时可设定在磁盘末尾,写入时,由后往前写入。
磁盘写入一定量数据后,根据剩余空间总量、预留空间所占比例,计算出预留空间大小。在原日志区写入数据的位置后设置新的日志区。
新日志区后部剩余磁盘空间设置为数据区II,用于存放数据。数据区II的写入方式为从后向前。这种方式,由于大部分的数据写入到数据区、少部分写入日志区,而数据区的写入方式是由前向后。这种方式会影响数据的写入速度。
优选的在数据区后部设置日志区,日志区的写入顺序为从后向前。当数据区随着写入变小后,调整日志区的大小,日志区的起始位置不变。
在写入过程中,当数据区向后写入与日志区向前写入相遇时,认为磁盘写满。
本发明可动态地调整磁盘日志区,满足磁盘对较大预留和较小预留的需求情况。当日志区的比例为磁盘总空间的50%时,数据区容量与日志区容量大小相等,可满足数据区对任意比例日志区的需要。理论上磁盘利用率可达100%。使磁盘空间利用最大化,提高磁盘的利用率的优点。
附图说明
下面结合附图及实施方式对本发明作进一步详细的说明:
图1为实施例1的磁盘存储空间使用变化图;
图2为实施例2的磁盘存储空间使用变化图;
图3为实施例3的磁盘存储空间使用变化图;
图4为实施例4的磁盘存储空间使用变化图。
其中,1.数据区、2.日志区、3.使用区、4.数据区II。
具体实施方式
实施例1
如图1所示,在磁盘的数据区1后部设置日志区2(如1a),日志区2占磁盘总容量的50%。日志区2的写入顺序为从前向后。数据写入时,当数据区1无坏块时,数据区1写入数据;当数据区1出现坏块时,相应数据写入到日志区2中,当数据区1、日志区2随着写入变小后,磁盘出现使用区3(如1b)。调整日志区2的大小,在磁盘尾部重新设定新的日志区2;日志区2末尾处即磁盘末尾处(如1c)。继续写入数据后磁盘区域分布(如1d)。
实施例2
如图2所示,在磁盘的数据区1后部设置日志区2(如2a),日志区2的写入顺序为从前向后。当数据区1随着写入变小后,出现使用区3,调整日志区2的大小,在原日志区写入数据的位置后设置新的日志区2。日志区2后部剩余空间为数据区1(如2b)。日志区2写入时顺序为从前向后,继续写入数据后分布如2c。
实施例3
如图3所示,在磁盘的数据区1后部设置日志区2(如3a),日志区2的写入顺序为从前向后。当数据区1随着写入变小后,调整日志区2的大小,在原日志区写入数据的位置后设置新的日志区2。日志区2后部剩余空间设为数据区II4(如3b)。日志区1写入时顺序为从前向后,数据区II4的写入时顺序为从后向前,继续写入区域分布(如3c)。
实施例4
如图4所示,在磁盘的数据区1后部设置日志区2(如4a),日志区2的写入顺序为从后向前。当数据区1随着写入变小后,调整日志区2的大小,日志区2的起始位置不变(如4b),继续写入区域分布(如4c)。在写入过程中,当数据区1向后写入与日志区2向前写入相遇时,认为磁盘写满。
Claims (10)
1.一种磁盘日志区动态调整方法,其特征在于:在磁盘中设定一个固定比例x%的区域为日志区;随着磁盘写入进度,根据剩余空间数量,对日志区进行调整,调整后日志区大小为剩余总空间的x%,0<x≤50。
2.按照权利要求1所述磁盘日志区动态调整方法,其特征在于:所述日志区设置在磁盘后部。
3.按照权利要求1所述磁盘日志区动态调整方法,其特征在于:所述x值为50。
4.按照权利要求2所述磁盘日志区动态调整方法,其特征在于:磁盘写入一定量数据后,根据剩余空间总量、预留空间所占比例,计算出预留空间大小;并在磁盘尾部重新设定新的日志区;日志区末尾处即磁盘末尾处。
5.按照权利要求4所述磁盘日志区动态调整方法,其特征在于:数据区与日志区的写入顺序为从前向后。
6.按照权利要求2所述磁盘日志区动态调整方法,其特征在于:磁盘写入一定量数据后,根据剩余空间总量、预留空间所占比例,计算出预留空间大小;在原日志区写入数据的位置后设置新的日志区。
7.按照权利要求6所述磁盘日志区动态调整方法,其特征在于:新日志区后部剩余磁盘空间设置为数据区II,用于存放数据。
8.按照权利要求7所述磁盘日志区动态调整方法,其特征在于:所述数据区II的写入方式为从后向前。
9.按照权利要求1所述磁盘日志区动态调整方法,其特征在于:所述日志区设置在磁盘后部;日志区的写入顺序为从后向前;当数据区随着写入变小后,调整日志区的大小,日志区的起始位置不变。
10.按照权利要求9所述磁盘日志区动态调整方法,其特征在于:在写入过程中,当数据区向后写入与日志区向前写入相遇时,认为磁盘写满。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610863782.0A CN107885455B (zh) | 2016-09-30 | 2016-09-30 | 一种磁盘日志区动态调整方法 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610863782.0A CN107885455B (zh) | 2016-09-30 | 2016-09-30 | 一种磁盘日志区动态调整方法 |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107885455A CN107885455A (zh) | 2018-04-06 |
CN107885455B true CN107885455B (zh) | 2020-02-07 |
Family
ID=61768979
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610863782.0A Active CN107885455B (zh) | 2016-09-30 | 2016-09-30 | 一种磁盘日志区动态调整方法 |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107885455B (zh) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112181298B (zh) * | 2020-09-25 | 2022-05-17 | 杭州宏杉科技股份有限公司 | 阵列访问方法、装置、存储设备及机器可读存储介质 |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102226892B (zh) * | 2011-05-20 | 2013-10-23 | 杭州华三通信技术有限公司 | 一种磁盘容错处理方法及设备 |
CN103559138B (zh) * | 2013-10-09 | 2016-03-30 | 华为技术有限公司 | 固态硬盘及其空间管理方法 |
CN105335100B (zh) * | 2015-09-29 | 2018-09-21 | 华为技术有限公司 | 一种数据处理方法、装置及闪存设备 |
CN106502587B (zh) * | 2016-10-19 | 2019-10-25 | 华为技术有限公司 | 硬盘数据管理方法和硬盘控制装置 |
-
2016
- 2016-09-30 CN CN201610863782.0A patent/CN107885455B/zh active Active
Also Published As
Publication number | Publication date |
---|---|
CN107885455A (zh) | 2018-04-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109213618B (zh) | 用于管理存储系统的方法、设备和计算机程序产品 | |
US7979635B2 (en) | Apparatus and method to allocate resources in a data storage library | |
US8103825B2 (en) | System and method for providing performance-enhanced rebuild of a solid-state drive (SSD) in a solid-state drive hard disk drive (SSD HDD) redundant array of inexpensive disks 1 (RAID 1) pair | |
CN103136074B (zh) | 多个磁盘阵列系统的数据储存方法及数据储存系统 | |
US20100306466A1 (en) | Method for improving disk availability and disk array controller | |
CN111124264B (zh) | 用于重建数据的方法、设备和计算机程序产品 | |
US20150286531A1 (en) | Raid storage processing | |
US20140019685A1 (en) | Method and Apparatus for Processing RAID Configuration Information and RAID Controller | |
US20180246793A1 (en) | Data stripping, allocation and reconstruction | |
US10095585B1 (en) | Rebuilding data on flash memory in response to a storage device failure regardless of the type of storage device that fails | |
US11474919B2 (en) | Method for managing multiple disks, electronic device and computer program product | |
US11385823B2 (en) | Method, electronic device and computer program product for rebuilding disk array | |
US9535619B2 (en) | Enhanced reconstruction in an array of information storage devices by physical disk reduction without losing data | |
US10324794B2 (en) | Method for storage management and storage device | |
CN111124262A (zh) | 独立盘冗余阵列(raid)的管理方法、设备和计算机可读介质 | |
US6954825B2 (en) | Disk subsystem | |
US20210318739A1 (en) | Systems and methods for managing reduced power failure energy requirements on a solid state drive | |
CN107885455B (zh) | 一种磁盘日志区动态调整方法 | |
EP3128429B1 (en) | Method for writing data into storage system and storage system | |
CN116501259A (zh) | 磁盘组双活同步方法、装置、计算机设备及存储介质 | |
US11188258B2 (en) | Distributed storage system | |
US10089202B1 (en) | Providing data high availability to a set of host computers via automatic failover | |
CN113424262B (zh) | 一种存储校验方法及装置 | |
JP2009054050A (ja) | Raid装置、raid装置の制御部およびraid装置のライトバック制御方法 | |
CN112445413A (zh) | 一种数据存储的方法、装置及相关设备 |
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 |