
centos6.6 装系统的时候,选取系统默认分区。装好后发现少了一大部分空间,通过fdisk -l 找不到分区,另外使用 parted -l 同样找不到消失的柱面。
如:
[root@mysql]# fdisk -l Disk /dev/sda: 1198.0 GB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x0009600c Device Boot Start End Blocks Id System
/dev/sda1 * Linux
Partition does not end on cylinder boundary.
/dev/sda2 Linux
/dev/sda3 Linux swap / Solaris [root@mysql]# parted -l
Model: LSI Logical Volume (scsi)
Disk /dev/sda: 1198GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos Number Start End Size Type File system Flags
1049kB 211MB 210MB primary ext4 boot
211MB 126GB 126GB primary ext4
126GB 131GB 5243MB primary linux-swap(v1)
既然找不到剩余的空间,那么我们就来重新创建分区吧!
parted /dev/sda
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mkpart
Partition type? primary/logical? p
File system type? [ext2]? ext4
Start? 5244MB # 这里通过 parted -l 查看最后一个分区的end在哪里
End? -1s # 硬盘最后一个扇区,硬盘的最末尾处
Warning: You requested a partition from 5244MB to 1198GB.
The closest location we can manage is 131GB to 1198GB.
Is this still acceptable to you?
Yes/No? y
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy). As a
result, it may not reflect all of your changes until after reboot.
(parted) q
Information: You may need to update /etc/fstab.
然后 fdisk -l 已经发现了新的分区。新分区如果不能挂载请先格式化:mkfs.ext4 /dev/sda4