LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Extending an ext 4 partition (https://www.linuxquestions.org/questions/linux-software-2/extending-an-ext-4-partition-4175473723/)

kdelover 08-17-2013 11:33 AM

Extending an ext 4 partition
 
Hello folks,

I have a 1TB drive,and i have created a 40GB partition for Linux.Unfortunately,i believe i may run out of space soon.I have lot of unallocated space on my drive and i would like to extend this partition.i will have to use parted/gparted since fdisk woudln't work on a GPT drive. This is what i have currently.

Code:

Disk /dev/sda: 1953525168s
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start        End          Size        File system    Name                          Flags
 1      2048s        2047999s    2045952s                    Basic data partition
 2      2050048s    2582527s    532480s    fat32          EFI system partition          boot, hidden
 3      2582528s    4628479s    2045952s                    Basic data partition
 4      4630528s    4892671s    262144s                    Microsoft reserved partition  msftres
 5      4892672s    942528511s  937635840s  ntfs            Basic data partition
 6      942528512s  1020653567s  78125056s  ext4
 7      1020653568s  1024653311s  3999744s    linux-swap(v1)
 8      1024653312s  1024661503s  8192s                                                    bios_grub
 9      1873403904s  1925832703s  52428800s  ntfs            Basic data partition
10      1925832704s  1953523711s  27691008s  ntfs            Basic data partition          hidden, diag


My linux partition is numbered 6.Id like to extend it by using the unallocated 100GB space from either 1 or 3.
In the first place is it doable ?The units are in sectors.

PECONET009 08-17-2013 12:52 PM

This might help you with your issue...
 
Quote:

Originally Posted by kdelover (Post 5010953)
Hello folks,

I have a 1TB drive,and i have created a 40GB partition for Linux.Unfortunately,i believe i may run out of space soon.I have lot of unallocated space on my drive and i would like to extend this partition.i will have to use parted/gparted since fdisk woudln't work on a GPT drive. This is what i have currently.

Code:

Disk /dev/sda: 1953525168s
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start        End          Size        File system    Name                          Flags
 1      2048s        2047999s    2045952s                    Basic data partition
 2      2050048s    2582527s    532480s    fat32          EFI system partition          boot, hidden
 3      2582528s    4628479s    2045952s                    Basic data partition
 4      4630528s    4892671s    262144s                    Microsoft reserved partition  msftres
 5      4892672s    942528511s  937635840s  ntfs            Basic data partition
 6      942528512s  1020653567s  78125056s  ext4
 7      1020653568s  1024653311s  3999744s    linux-swap(v1)
 8      1024653312s  1024661503s  8192s                                                    bios_grub
 9      1873403904s  1925832703s  52428800s  ntfs            Basic data partition
10      1925832704s  1953523711s  27691008s  ntfs            Basic data partition          hidden, diag


My linux partition is numbered 6.Id like to extend it by using the unallocated 100GB space from either 1 or 3.
In the first place is it doable ?The units are in sectors.

More info here:
http://www.linuxforums.org/forum/sus...partition.html

TobiSGD 08-17-2013 01:11 PM

The püroblem is your partition order. Since there are several partition between the partition you want to decrease in size and the partition you want to extend there is no easy way of doing it. You would have to remove the partitions 4 and 5, resize partition 3, move partition 6 into the new free space and extend it, then re-creating partitions 4 and 5 in their new place. All these opertaions should only be done when having a good backup (as you should have anyways), since partitioning operations are dangerous to data integrity. It would be easier if you can get some free space from partition 5 instead of 1 or 3, since you then can just extend partition 6 into the free space. This would be different if you have installed your system usding LVM, which allows extending filesystems over several partitions that don't have to be next to each other.

Ser Olmy 08-17-2013 01:50 PM

Quote:

Originally Posted by kdelover (Post 5010953)
My linux partition is numbered 6.Id like to extend it by using the unallocated 100GB space from either 1 or 3.
In the first place is it doable ?The units are in sectors.

Assuming you're able to shrink partitions 1 or 3 to free up some space (and if they're Windows partitions with free space and not to much fragmentation, the Windows Disk Manager should be able to shrink the partitions), you'll either have to use a Live CD to move data around, like PECONET009 suggested, or migrate your data to another type of disk setup manually.

TobiSGD mentioned LVM being able to use space from a pool of different partitions and/or drives. It would be possible to create an LVM partition in the free space made available by shrinking partitions 1 and/or 3, migrate your data to that partition, and then erase the old partition and recreate it as LVM.

Whichever route you choose, remember there's always a small risk of data loss when partitions are resized or otherwise manipulated. Make sure your backups are recent before starting.

kdelover 08-17-2013 01:55 PM

Hi guys,

Thanks for your replies.This is a new laptop and Lenovo has fairly messed up the partitions and this laptop comes with
Windoze 8 preinstalled.The 2x100GB partitions i have is what Lenovo gave me as an OEM and a Recovery partition,which i have removed after creating the backup on an External drive. I think i may nuke everything off the drive and do a clean install of Windoze and subsequently Linux.


All times are GMT -5. The time now is 05:35 PM.