I need to use Unpartitioned Space and LVM is no help

Solution In Progress - Updated -

Environment

Red Hat Enterprise Linux 6

Issue

  • LVM is not being used.
  • From parted: It appears that I have over 200+ GB of space free
  • Is there a way to create a sda7 partition of 150 GB named /test and an sda8 partition of 30 GB called /ai ??
-bash-4.1# parted
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: DELL PERC 6/E Adapter (scsi)
Disk /dev/sda: 731GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size    Type      File system  Flags
 1      1049kB  168GB  168GB   primary   ext4
 2      168GB   336GB  168GB   primary   ext4
 3      336GB   368GB  32.5GB  primary   ext4
 4      368GB   583GB  215GB   extended
 5      368GB   401GB  33.3GB  logical   ext4
 6      401GB   583GB  181GB   logical   ext4
  • So my goal is to add 2 more partitions to my filesystem one of 150 GB and one of 30 GB:

Resolution

1. First create a backup of your partition table which can be used as a restore point if things go wrong:

# sfdisk -d /dev/sda > /tmp/sda.backup

2. Unmount all mountpoints using sda1 through sda6, ie:

# umount /home
# umount /db
# umount /backup
# umount /rd
# umount /progress
# umount /dump
  • Since /home will be unmounted, verify no unprivileged users are logged into the system prior as their home environment will be temp. unavailable.
    3. Use fdisk to delete partitions #4, #5, & #6:
Command (m for help): d
Partition number (1-6): 6

Command (m for help): d
Partition number (1-5): 5

Command (m for help): d
Partition number (1-5): 4

4. Alter fdisk view to change units to sectors:

Command (m for help): unit
Changing display/entry units to sectors  <<==

5. Recreate the extended partition #4 to consume the entire disk. The 'Start' sector must be the exact same as it was previously and using the new 'End' sector, ie:

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Selected partition 4
First sector: 718850048
Last sector: 1427374080   <<= * 

* The extended End sector was taken from here: 
---
Model: DELL PERC 6/E Adapter (scsi)
Disk /dev/sda: 1427374080s           <<== Extended partition 'End' sector

6. Recreate partitions #5, & #6 using the same previous sectors:

Command (m for help): n
First sector: 718850111
Last sector: 783875609

Command (m for help): n
First sector: 783875673
Last sector: 1138285574

7. Print the partition table, you should now have something similiar as follows:

   Device Boot      Start         End    
/dev/sda1            2048   327682047   
/dev/sda2       327682048   655362047   
/dev/sda3       655362048   718850047   
/dev/sda4       718850048  1427374080   <<= Extended partition now consumes entire disk.  
/dev/sda5       718850111   783875609   
/dev/sda6       783875673  1138285574   

8. There should now be +/- 289088506 free sectors to create additional partitions, use fdisk to create your additional partitions.
9. Once complete, write the changes to disk:

Command (m for help): w
The partition table has been altered!
...
...

10. Update the system of the new partition structure:

# partprobe /dev/sda

Root Cause

  • Note the ending point of the extended partition. It stops at 583G, hence unable to create a new partition within the extended partition.
Disk /dev/sda: 731GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
...
Number  Start   End    Size    Type      File system  Flags
 1      1049kB  168GB  168GB   primary   ext4
 2      168GB   336GB  168GB   primary   ext4
 3      336GB   368GB  32.5GB  primary   ext4
 4      368GB   583GB  215GB   extended          <=====
 5      368GB   401GB  33.3GB  logical   ext4
 6      401GB   583GB  181GB   logical   ext4

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.