Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Increase Linux partition with unused Windows partition space on Dualboot system


  • Please log in to reply
23 replies to this topic

#1 falseNegative

falseNegative

  • Members
  • 10 posts
  • OFFLINE
  •  
  • Local time:02:51 PM

Posted 16 May 2018 - 03:02 PM

I have a dualboot system with fedora 27 and windows 10. I am running out of space on my linux volume group (i.e. partition) and I don't have unallocated space. I've read that I might need Gparted and that maybe resize2fs can be used to increase a linux partition (reference 1, reference 2) but all those cases were dealing with extending the root partition where unallocated space already exists.

 

Output of df -h

df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 3.9G     0  3.9G   0% /dev
tmpfs                    3.9G  192M  3.7G   5% /dev/shm
tmpfs                    3.9G  2.0M  3.9G   1% /run
tmpfs                    3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/fedora-root   43G   32G  8.1G  80% /
tmpfs                    3.9G   14M  3.9G   1% /tmp
/dev/sda5                976M  196M  713M  22% /boot
tmpfs                    789M   16K  789M   1% /run/user/42
tmpfs                    789M   11M  778M   2% /run/user/1000
tmpfs                    789M     0  789M   0% /run/user/0

and ouput of fdisk -l:

fdisk -l
Disk /dev/sda: 238.5 GiB, 256060514304 bytes, 500118192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xb72b0508

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048   1026047   1024000   500M  7 HPFS/NTFS/exFAT
/dev/sda2         1026048 395909025 394882978 188.3G  7 HPFS/NTFS/exFAT
/dev/sda3       498311168 500113407   1802240   880M 27 Hidden NTFS WinRE
/dev/sda4       395909120 498311167 102402048  48.8G  5 Extended
/dev/sda5       395911168 398008319   2097152     1G 83 Linux
/dev/sda6       398010368 498311167 100300800  47.8G 8e Linux LVM

Partition table entries are not in disk order.


Disk /dev/mapper/fedora-root: 43 GiB, 46103789568 bytes, 90046464 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/fedora-swap: 4.9 GiB, 5247074304 bytes, 10248192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

My partitions are:

 

qWnSX.jpg

 

Windows 10 has 80 GB of free space. I want to take 70 GB from Windows and give it to fedora. How do I do this without losing either or both of my operating systems and any data? Can I shrink windows first to create unlocated space or should I create a partition of 70 GB inside the windows partition? If so can I do this inside windows else if I have to use a software like Gparted can I download it to my external hard drive which contains other files or is an empty memory stick necessary?

 

If it helps my linux partition was created in windows before installing fedora using rufus and I have roughly 5 GB of swap. If possible I would also like to increase the size of the swap to match my RAM size because I find my system tends to use up all of my swap partition.

 

I'm not sure if here is the right place to post this but I would appreciate any details. Thanks in advance.



BC AdBot (Login to Remove)

 


#2 MadmanRB

MadmanRB

    Spoon!!!!


  • Members
  • 3,222 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:No time for that when there is evil afoot!
  • Local time:09:51 AM

Posted 16 May 2018 - 03:13 PM

Hrm is this a desktop or laptop?

 

Is this a SSD?


You know you want me baby!

Proud Linux user and dual booter.

Proud Vivaldi user.

 

xu847p-6.png


#3 pcpunk

pcpunk

  • Members
  • 6,108 posts
  • ONLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:09:51 AM

Posted 16 May 2018 - 09:29 PM

I can't help you with the actual Partitioning but do have a few pieces of advice.

 

1. Backup everything important, including all your settings.

 

2. If it were me, I would create Free Space from within Windows, but not take 70GB, take a little less so Windows will function for a long time.

 

3. Then I would use a Linux based partition editor to move the Linux part around, gparted is what I always use.  Partitioning is always tricky for me as I don't do it that much.  Mostly when moving stuff around like you are doing here, it's just tricky for me to do.  I pretty much just wing it every time.

 

If all this data and operating systems are really important to you, maybe you could just free up some space on your Linux Drive.  


sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 


#4 Gary R

Gary R

    MRU Admin


  • Malware Response Team
  • 879 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:02:51 PM

Posted 17 May 2018 - 05:01 AM

I'm like pcpunk and I don't re-partition too often either, and I've never attempted to do what you want to do, so I can't really help.

All I can do, is say that I've found the following gparted tutorial very useful ... https://www.dedoimedo.com/computers/gparted.html

Its been around a while, but it's still pretty relevant.

Also there's the official gparted manual ... https://gparted.org/display-doc.php%3Fname%3Dhelp-manual ... which covers a whole lot more.

Good luck, hope you're able to do what you want.

#5 pcpunk

pcpunk

  • Members
  • 6,108 posts
  • ONLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:09:51 AM

Posted 17 May 2018 - 07:00 AM

O...Make sure to turn off Fast Boot in Windows.

 

Do understand that you are attempting to move a bunch of files all at the same time so it is going to be a long procedure.


Edited by pcpunk, 17 May 2018 - 07:08 AM.

sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 


#6 falseNegative

falseNegative
  • Topic Starter

  • Members
  • 10 posts
  • OFFLINE
  •  
  • Local time:02:51 PM

Posted 17 May 2018 - 07:49 AM

Hrm is this a desktop or laptop?

 

Is this a SSD?

It's a laptop with an SSD.



#7 JohnC_21

JohnC_21

  • Members
  • 24,444 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:09:51 AM

Posted 17 May 2018 - 08:18 AM

I may be wrong on this but according to your first image you are using LVM (Logical Volume Manager). Something I tend to avoid. Gparted will not manage a LVM volume. For that you would need to use something like the following. You could use GParted to manage the Windows partitions.

 

https://www.howtogeek.com/127246/linux-sysadmin-how-to-manage-lvms-with-a-gui/



#8 falseNegative

falseNegative
  • Topic Starter

  • Members
  • 10 posts
  • OFFLINE
  •  
  • Local time:02:51 PM

Posted 17 May 2018 - 08:36 AM

The LVM was automatically created when I installed fedora. How are you able to avoid it? Gparted stands for Gnome Partitioner which is a linux desktop environment. It seems odd then that Gparted cannot manage LVM which is specific to Linux.



#9 JohnC_21

JohnC_21

  • Members
  • 24,444 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:09:51 AM

Posted 17 May 2018 - 08:55 AM

Sorry, I thought Gparted could not manage LVM but according to this thread it can but the better option is to use system-config-lvm.

 

https://askubuntu.com/questions/196125/how-can-i-resize-an-lvm-partition-i-e-physical-volume

 

There was a BC thread here also. 



#10 falseNegative

falseNegative
  • Topic Starter

  • Members
  • 10 posts
  • OFFLINE
  •  
  • Local time:02:51 PM

Posted 17 May 2018 - 01:41 PM

Thanks JohnC_21, I wasn't aware that GParted had issues with LVM. Do you have any tips on how I can resize the partitions for windows. Someone already mentioned that I have the maximum number of partitions so what are my options?


Edited by falseNegative, 17 May 2018 - 02:02 PM.


#11 JohnC_21

JohnC_21

  • Members
  • 24,444 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:09:51 AM

Posted 17 May 2018 - 02:03 PM

Windows only allows 4 primary partitions so the linux partition would be extended. I don't have much experience with LVM. If you are running Windows 10 was this an upgrade from a previous OS? The reason I ask is because if the computer had UEFI firmware you could create a GPT partition table which allows a multitude of primary partitions. But, you would need to reinstall Windows 10. There are partition managers (paid) that can convert a MBR system disk to GPT but I would be hesitant to use it because on a MBR disk your System Reserved Partition is formatted as NTFS. A GPT disk would have a EFI partition formatted FAT32.  Linux would also need to be reinstalled because of the change form MBR to GPT but this all depends on if the computer has UEFI firmware.

 

Windows can get confused on a dual boot system. Your linux Swap partition is 1GB and yet Windows declares it a Primary partition. I have seen dual boot systems where Windows will show more than 4 primary partitions. If the computer has a Legacy BIOS I would resize the C: partition. This would give unallocatted space after C:. You could do that with Gparted. After the C: partition is reduced use the LVM partition manager to move the 1GB swap partition into the unallocatted space then resize the 48GB linux partition. It may be required to first move the 48GB partition to the left to be adjacent to the Swap partition the resize the 48GB partition to the right. 

 

Any partition movement has the chance to go south. That is why you should always backup your data before doing any partition modifications.



#12 falseNegative

falseNegative
  • Topic Starter

  • Members
  • 10 posts
  • OFFLINE
  •  
  • Local time:02:51 PM

Posted 18 May 2018 - 04:23 AM

Thanks JohnC_21 for giving me an idea of where to start. The 1GB parition is actually the boot partition (i.e. GRUB), It is the 4.9 GB that is the swap partition and you can see this in the second image showing the output of fdisk -l. Windows is showing the total size of my Linux partition which is 47.83 GB however this is split into Logical volumes for fedora root and fedora swap.

 

Yes this was an upgrade from a previous windows version, either windows 7 or windows 8, not sure which one. I am running legacy BIOS.

 

I want to check my understanding of your instructions are correct. Please modify the following as needed:

  1. Resize C: Drive by shrinking it in GParted. I think this leaves unallocated space at the end of the C:Drive. For example, shrinking the C:Drive by 70 GB would leave 70 GB at its right edge?
  2. Use the LVM partition manager named system-config-lvm to move the 1GB boot partition into the unallocated space to its left.
  3. Resize the 48 GB by increasing it and if required first move the 48 GB partition to the left to be right next to the boot partition.
  4. Resize the 48 GB partition to the right.

I have some questions about the above steps:

  • In response to step 2, I didn't know you could move a partition into unallocated space. I thought you could only extend it into the unallocated space, i.e. add the unallocated space to the partition?
  • In response to step 2, now I have confirmed that the 1GB partition is the boot partition and not swap, does this change what I have to do?
  • In response to step 3 and 4, Since the unallocated space is to the left of the 48GB partion and the boot partition is before the 48 GB partition, how would I be able to resize the 48GB partition to the right when the unallocated space is to its left and there is a boot partition between the unallocated space and the 48 GB partition?
  • Lastly, I don't mind increasing the size of the swap Logical Volume but I think the 1GB boot partition may need to remain unchanged to avoid messing up GRUB. Is this necessary?

I have created a system image of windows 10 which created a full backup but since my laptop does not have a CD drive I was not able to create a recovery disk. Is it still possible to restore this system image without a recovery disk? And if I need to re-install windows do I need to have my original windows installation disk or is the system image all I need to boot up my laptop and start installing windows?

Thanks for the helpful info.


Edited by falseNegative, 18 May 2018 - 04:30 AM.


#13 Al1000

Al1000

  • Global Moderator
  • 7,979 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:02:51 PM

Posted 18 May 2018 - 04:43 AM

Strictly speaking, it's the dos partition table that only allows four primary partitions or three primary and one extended partition, like you have. sda1, sda2 and sda3 are the primary partitions, and sda4 is the extended partition. sda5 and sda6 are logical partitions, that are contained "within" sda4.

#14 falseNegative

falseNegative
  • Topic Starter

  • Members
  • 10 posts
  • OFFLINE
  •  
  • Local time:02:51 PM

Posted 18 May 2018 - 06:27 AM

Windows only allows 4 primary partitions so the linux partition would be extended. I don't have much experience with LVM. If you are running Windows 10 was this an upgrade from a previous OS? The reason I ask is because if the computer had UEFI firmware you could create a GPT partition table which allows a multitude of primary partitions. But, you would need to reinstall Windows 10. There are partition managers (paid) that can convert a MBR system disk to GPT but I would be hesitant to use it because on a MBR disk your System Reserved Partition is formatted as NTFS. A GPT disk would have a EFI partition formatted FAT32.  Linux would also need to be reinstalled because of the change form MBR to GPT but this all depends on if the computer has UEFI firmware.

 

Windows can get confused on a dual boot system. Your linux Swap partition is 1GB and yet Windows declares it a Primary partition. I have seen dual boot systems where Windows will show more than 4 primary partitions. If the computer has a Legacy BIOS I would resize the C: partition. This would give unallocatted space after C:. You could do that with Gparted. After the C: partition is reduced use the LVM partition manager to move the 1GB swap partition into the unallocatted space then resize the 48GB linux partition. It may be required to first move the 48GB partition to the left to be adjacent to the Swap partition the resize the 48GB partition to the right. 

 

Any partition movement has the chance to go south. That is why you should always backup your data before doing any partition modifications.

JohnC_21 do you have experience resizing  a root partition in Linux? I want to know how safe it is to extend my root partition without breaking my system? Also in order to extend a partition doesn't it have be right next to unallocated space?



#15 pcpunk

pcpunk

  • Members
  • 6,108 posts
  • ONLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:09:51 AM

Posted 18 May 2018 - 06:51 AM

When you have time, can we see the partitions with 

sudo parted -l   

Not critical, just easier to read for me with ADD.  Too me, it points out Primary Partitions more accurately.


Edited by pcpunk, 18 May 2018 - 06:53 AM.

sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users