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作 ...
随机推荐
- jackson 注解的使用
在实体对象上添加 @JsonAutoDetect , 表明对该实体对象序列化成json串. @JsonAutoDetect public class User{ private int id; pri ...
- jdk+jira配置
1.JDK.JIRA.MySQL安装完毕,停止JIRA服务 创建数据库:mysqlcreate database jiradb character set ‘UTF8′; 创建用户并赋与权限:crea ...
- OpenCDN2.0安装
部署说明 为网站加速,建立私有的CDN节点群,每部署一个CDN节点只需5分钟,无节点数量上限!参考 http://ocdn.me/ 安装需求 OpenCDN的Beta版目前在CentOS5.x - C ...
- Serializable 序列化使用限制
序列化不能跨语言 如果单纯为了传数据,完全可以被json代替.
- SQL Server中如何获取当前年,月,日,时,分,秒
分类: SQL Server select GETDATE() as '当前日期',DateName(year,GetDate()) as '年',DateName(month,GetDate()) ...
- Docker基本命令
1.搜索Docker镜像 docker search <镜像名> 2.获取镜像 docker pull <镜像名> 3.查看本地镜像 docker images 4.删除镜像 ...
- Volley使用指南第四回(来自developer.android)
Volley网络请求的第四篇,废话不多说,开始. 这一篇文章将会教你怎样在Volley支持的范围内定制一个请求. 第一步:写一个通用请求: 大多数请求都有已经写好的接口供你调用,如果你的请求是Stri ...
- C#客户端链接网页需要用到的WebClient
WebClient 类提供向 URI 标识的任何本地.Intranet 或 Internet 资源发送数据以及从这些资源接收数据的公共方法. WebClient 类使用 WebRequest 类提供对 ...
- CentOS6.4 64位系统安装jdk
1. CentOS操作安装好了以后,系统自带了openJDK,先查看相关的安装信息: $rpm -qa | grep java tzdata-java-2013b-1.el6.noarchjava-1 ...
- nginx将http重定向到https
1.rewrite server { listen 80; server_name test.com; rewrite ^(.*)$ https://$host$1 permanent; } 2. n ...