partition X does not end on cylinder boundary

理解分区警告
本文探讨了在使用fdisk工具时出现的“分区X未在柱面边界结束”的警告,并解释了为何在现代系统中这些警告可以被忽略。文章还介绍了如何通过sfdisk工具以扇区形式查看分区布局。
转载地址: h ttp://bbs.chinaunix.net/thread-3645102-1-1.html


Why “partition X does not end on cylinder boundary” warnings don’t matter
为什么 不必担心“partition X does not end on cylinder boundary”警告

While reviewing the partion layout on one of my hard drives, I noticed a number of “Partition X does not end on cylinder boundary” messages in the fdisk output:
当我查看硬盘的分区的时候,我主意到很多“Partition X does not end on cylinder boundary”信息在fdisk -l的输出里面:
  1. fdisk /dev/sda
复制代码
The number of cylinders for this disk is set to 9726.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xac42ac42

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26         287     2097152   83  Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3             287        9726    75822111+  8e  Linux LVM
This was a bit disconcerting at first, but after a few minutes of thinking it dawned on me that modern systems use LBA (Logical Block Addressing) instead of CHS (Cylinder/Head/Sector) to address disk drives. If we view the partition table using sectors instead of cylinders:
刚开始很让人困惑,但是几分钟之后,我意识到现代操作系统使用LBA而不是CHS来记录硬盘分区.如果用扇区代替柱面,我们将看到:
  1. sfdisk -uS -l /dev/sda
复制代码
Disk /dev/sda: 9726 cylinders, 255 heads, 63 sectors/track
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End   #sectors  Id  System
/dev/sda1   *        63    409662     409600  83  Linux
/dev/sda2        409663   4603966    4194304  83  Linux
/dev/sda3       4603967 156248189  151644223  8e  Linux LVM
/dev/sda4             0         -          0   0  Empty
We can see that we end at a specific sector number, and start the next partition at that number plus one. I must say that I have grown quite fond of sfdisk and parted, and they sure make digging through DOS and GPT labels super easy.
我们可以看到,扇区是结束在一个特定的扇区,并且下一个分区的起始扇区在前一个的后面+1扇区.

另外一个老外的:
Its almost certainly harmless, unless you need to install an OS that uses C/H/S addressing like DOS oe Windows up to and including Windows 95. 

Do check with another tool that you don't have overlapping partitions.


结论:这个warning可以忽略,不影响系统的使用,只要你确认下,分区不是重叠的,就没有问题.

### 解决 'partition 2 does not start on physical sector boundary' 错误并调整 sdb2 分区 #### 1. 理解物理扇区边界对齐的重要性 现代硬盘通常具有较大的物理扇区大小(通常是 4 KB),操作系统和文件系统需要确保分区起始位置与这些物理扇区边界的对齐一致。如果不这样做,则可能导致性能下降甚至数据损坏[^1]。 #### 2. 检查当前磁盘布局 在执行任何更改之前,建议使用以下命令获取详细的磁盘信息: ```bash lsblk fdisk -l /dev/sdb parted /dev/sdb unit s print ``` 此操作可以帮助确认 `/dev/sdb` 的总大小、现有分区的起点终点及其单位是否为扇区(sectors)。特别注意 `/dev/sdb1` 结束的位置以及 `/dev/sdb2` 开始的位置是否存在不对齐现象[^2]。 #### 3. 删除不正确的分区并对齐新建 为了消除警告消息并将整个剩余空间分配给第二个主要分区,请按照下面步骤操作: ##### 步骤 A: 启动 parted 工具 ```bash sudo parted /dev/sdb ``` ##### 步骤 B: 移除现有的第二分区 ```text rm 2 ``` ##### 步骤 C: 创建一个新的对齐良好的分区 尝试从第一个可用扇区开始直到最后一个可写入地址结束创建新分区。如果默认设置未能自动实现最佳性能,则手动指定合理的偏移量如 1 MiB 来代替原始字节数值。 ```text mkpart primary ext4 2TiB 100% ``` 这里假设您的首个分区正好位于 2 TiB 处结束;如果不是这种情况,请替换确切数值以匹配实际情况。另外,“ext4” 只是一个例子——您可以根据实际用途选择合适的文件系统类型。 ##### 步骤 D: 验证变更成果 最后再次打印表格查看结果是否满意无误后再保存退出。 ```text p q ``` #### 4. 格式化扩展后的分区 一旦成功建立了适当尺寸的新分区,就需要对其进行初始化才能投入使用: ```bash mkfs.ext4 /dev/sdb2 ``` #### 5. 调整引导记录(如有必要) 对于 CentOS 这样的发行版来说,当其根目录所在的设备编号发生变化时可能会阻止正常启动过程。这种情况下可能还需要修复 GRUB 或其他引导加载程序配置使其指向更新后的路径名。 --- ### 注意事项 - 在进行任何形式的大规模磁盘结构调整活动前务必做好充分备份以防万一发生意外丢失重要资料的风险; - 不同品牌型号之间可能存在细微差异因此某些特定参数或许需要依据官方文档进一步微调优化效果达到最好水平。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值