Linux parted 分区
转自http://tilt.lib.tsinghua.edu.cn/node/889
如何使用parted对齐分区以得到最优性能
来源地址: http://rainbow.chard.org/2013/01/30/how-to-align-partitions-for-best-per...
How to align partitions for best performance using parted
There are two common problems when creating partitions in Linux on big storage arrays. The first is easy, and the warning message from fdisk is a bit of a giveaway:
WARNING: The size of this disk is 8.0 TB (7970004230144 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
partition table format (GPT).
The answer: use parted. Don’t have it? Install it!
The second problem is this warning from parted:
(parted) mklabel gpt
(parted) mkpart primary 0 100%
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel?
…and no matter what combination of numbers you use, the message just keeps coming back. It’s tempting to ignore it, but don’t.
There are a few posts on the subject, but this one from HP really gets to the guts of the problem.
Here’s a quick step-by-step guide to aligning partitions properly. It’s just an abstraction of the HP post, but hopefully easier to follow. This will work for most arrays (in fact it works for all the arrays that I’ve seen); there are more options in HP’s post, but I’ve included the most common configuration here.
1. Get the alignment parameters for your array (remember to replace sdb with the name of your device as seen by the kernel).
# cat /sys/block/sdb/queue/optimal_io_size
1048576
# cat /sys/block/sdb/queue/minimum_io_size
262144
# cat /sys/block/sdb/alignment_offset
0
# cat /sys/block/sdb/queue/physical_block_size
512
2. Add optimal_io_size to alignment_offset and divide the result by physical_block_size. In my case this was (1048576 + 0) / 512 = 2048.
3. This number is the sector at which the partition should start. Your new parted command should look like
mkpart primary 2048s 100%
The trailing ‘s’ is important: it tells parted that you’re talking about sectors, not bytes or megabytes.
4. If all went well, the partition will have been created with no warnings. You can check the alignment thusly (replacing ’1′ with the partition number if necessary):
(parted) align-check optimal 1
1 aligned
As I alluded to before, there are cases where this won’t work: if optimal_io_size is zero, for example, there are other rules to follow. Of course it would be nice if parted could do this—the values are all available as ioctls, after all—but then what would I write about? :)
末尾的最后一条评论更加实用:
Apparently, using % causes parted to automatically align the sectors for best performance:
(parted) mkpart primary ext4 0% 100%
Linux parted 分区的更多相关文章
- (转)硬盘分区备忘(主分区,扩展分区和逻辑分区)以及Linux硬盘分区工具parted 介绍
场景:最近在学习Linux的基础知识,不可避免的设计到Linux的磁盘分区,以前做过总结,但是那种总结就是复制别人的文章,总结完就不想看第二遍,所以很容易就遗忘了!清楚明白的理解分区后,我就可以在自己 ...
- (转)linux磁盘分区fdisk分区和parted分区
linux磁盘分区fdisk分区和parted分区 原文:http://www.cnblogs.com/jiu0821/p/5503660.html ~~~~~~~~~~~~~~~~~~~~~~~~~ ...
- linux磁盘分区模式
linux磁盘分区模式 模式一:MBR 1)主分区不超过四个 2)单个分区容量最大2TB 模式二:GPT 1)主分区个数"几乎"没有限制(原因:在GPT的分区表中最多可以支持128 ...
- <实训|第七天>横扫Linux磁盘分区、软件安装障碍附制作软件仓库
期待已久的linux运维.oracle"培训班"终于开班了,我从已经开始长期四个半月的linux运维.oracle培训,每天白天我会好好学习,晚上回来我会努力更新教程,包括今天学到 ...
- Linux 磁盘分区修改与管理
--Linux 磁盘分区修改与管理 -----------------------------2014/03/05 1. 目的,将磁盘卷/dev/cciss/c0d0p8修改成新的用途. 原: /de ...
- linux中分区、格式化文件系统、挂载
以前学linux的时候,毕竟自己没搞运维,就只注重了很多命令的运用,没太在意文件系统这块.买了本linux的书,这部分看了点东西,记个笔记哈哈. 有个场景,比如说我们现在的服务器上存储不够用了,那么当 ...
- fdisk与parted分区
我所接触的linux分区分为两种,一种是使用fdisk分区,另外一种是parted分区.前者是针对MBR模式分区的,后者是针对GPT模式分区的 fdisk分区: fdisk -l ---->查看 ...
- Linux磁盘分区工具的使用
----------fdisk分区工具---------- 一..下面来介绍fdisk分区工具的命令格式: fdisk是传统的Linux硬盘分区工具,也是Linux系统中最常用的一种硬盘分区 ...
- Linux磁盘分区--MBR分区
今天心情不高兴,做IT不容易被公司重视,一定要速度学会运营,成为一个高逼格的技术男. 今天我要熟练掌握linux系统分区的能力.大家都知道,linux系统分区有两种分区格式:GTP和MBR. MBR作 ...
随机推荐
- HDU-4742 Pinball Game 3D 三维LIS
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4742 题意:求3维的LIS.. 用分治算法搞得,参考了cxlove的题解.. 首先按照x排序,然后每个 ...
- Web Service学习之七:CXF拦截器
一.用途 CXF拦截器类似Struts2的拦截器,后者是拦截和处理请求,前者是对发送和接收的sope消息进行处理,一般用于WS请求响应中的权限验证.日志记录,Soap消息处理,消息的压缩处理等: 这个 ...
- Delphi实例-IdTCPServer和IdTCPClient的使用(支持文件发送)
相关资料: http://blog.csdn.net/earbao/article/details/46514313 结果注意: 1.Use IdContext.IdGlobal 这两个单元2.不能使 ...
- ZOJ 3911 Prime Query(线段树)
Prime Query Time Limit: 1 Second Memory Limit: 196608 KB You are given a simple task. Given a s ...
- ASP.NET Web Api返回对象类型为JSON还是XML
在Umbraco平台上开发过程中,我用WebApi返回JSON result给前端 前端使用React调用这个web api来获取JSON result 我写的web api方法是返回JSON 类型的 ...
- C#自定义控件的开发:Pin和Connector
C#自定义控件的开发:Pin和Connector 2009-08-03 14:46 wonsoft hi.baidu 我要评论(0) 字号:T | T 本文介绍了如何使用智能设备扩展C#自定义控件. ...
- CKeditor3.6.2 配置与精简
一.使用方法: 1.在页面<head>中引入ckeditor核心文件ckeditor.js <script type="text/javascript" src= ...
- velocity 快速入门
基本语法 1.变量定义 : $name 注意 : a.名字和$配合一起用 b.更规范的写法是 ${name} 2.赋值 : #set($name = "威少") 3.条 ...
- UdpClient的Connect究竟做了什么(转)
最近在写一个音频通信的系统,因为需要还要处理其他事件,所以就自己设计底层的通信协议,用了不少底层的Socket编程(.Net Framework),搞清楚了不少细节问题. 先做一些铺垫工作.音频系统服 ...
- Realsense 提取彩色和深度视频流
一.简要介绍 关于realsense的介绍,网上很多,这里不再赘述,sdk及相关文档可参考realsense SDK,也可参考开发人员专区. 运行代码之前,要确保你已经安装好了realsense的DC ...