Sunday, November 11, 2018

linux - Cannot allocate additional space after growing RAID array



I added three new drives to a Dell 2950 (running RHEL 5) with a PERC 6/i storage controller. The machine was previously running RAID 1 on two drives + hotswap. Rather than create an identical RAID 1 array with the new drives, I opted to gain additional storage by using OpenManage to convert the original Virtual Drive to a RAID 5 array that incorporated the new drives.



All of the above went off without a problem, but when I try to create a new partition with the additional space, fdisk informs me that there are "No free sectors available", even though it seems to recognize the additional space.



My current filesystem usage:




[root@local ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 9.7G 2.1G 7.1G 23% /
/dev/sda1 487M 35M 427M 8% /boot
none 4.0G 0 4.0G 0% /dev/shm
/dev/sda3 487M 11M 451M 3% /tmp
/dev/sda5 4.9G 1.2G 3.5G 25% /usr
/dev/mapper/VarGroup-var
50G 757M 47G 2% /var



fdisk output, showing additional disk space:



[root@local ~]# fdisk -l

Disk /dev/sda: 290.9 GB, 290984034304 bytes
255 heads, 63 sectors/track, 35376 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 1 64 514048+ 83 Linux
/dev/sda2 65 1339 10241437+ 83 Linux
/dev/sda3 1340 1403 514080 83 Linux
/dev/sda4 1404 8844 59769832+ 5 Extended
/dev/sda5 1404 2040 5116671 83 Linux
/dev/sda6 2041 2301 2096451 82 Linux swap
/dev/sda7 2302 8844 52556616 8e Linux LVM


Is there any way to incorporate the additional disk space without destructive repartitioning?



Answer



PC partition formats were decided 30+ years ago and aren't particularly flexible. You can only have four primary partitions, numbered 1 to 4. If you want more than four partitions, one of them must be an extended partition (sda4 in your setup); an extended partition is a container that contains any number (well, up to 11 in Linux under most common setups) of logical partitions.



You currently have 3 primary partitions (sda1 through sda3), so you can only create new logical partitions. But the extended partition is full, so there is no room for these new logical partitions. This explains fdisk's cryptic message.



As far as I remember, fdisk can't extend an extended partition. Try parted or cfdisk instead. Extend the extended partition (sda4) to range until the end of the disk, and create a new logical partition in the space now available.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...