LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-25-2017, 12:39 AM   #1
pconstantatos
LQ Newbie
 
Registered: Dec 2016
Posts: 29

Rep: Reputation: Disabled
Partitioning


Click image for larger version

Name:	Screenshot from 2017-05-25 08-29-31.png
Views:	40
Size:	85.2 KB
ID:	25103Could someone please advise on how to extend partition sdb1 and shrink sdb3 as seen in the attached screenshot?
 
Old 05-25-2017, 12:58 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,140

Rep: Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935
Well, you're in gparted. Use it.
That swap will cause grief due to it being a logical partition. Simply shrink sdb3 (right-click or use the menu). Expand the extended , move the swap to the right, shrink the extended, expand sdb1.

Personally I'd simply delete the swap and sdb2 and reallocate swap later as a primary in some of the free space. Will mess with your fstab though.

Edit: - I like to "apply" each change separately. Then you know things are proceeding as planned.

Last edited by syg00; 05-25-2017 at 01:00 AM.
 
Old 05-25-2017, 01:14 AM   #3
aragorn2101
Member
 
Registered: Dec 2012
Location: Mauritius
Distribution: Slackware
Posts: 552

Rep: Reputation: 270Reputation: 270Reputation: 270
Hi,

What you are asking is, I think, probably impossible to achieve without loss of data. We can see you have more than 50% usage on sdb1 and more than 100 GiB on sdb3, plus an extended partition in the middle.

I would like to point out that on MBR disks you can have only 4 primary partitions OR 3 primaries and 1 extended (which in turn may contain something like 15 logical volumes: which can be used as separate partitions). What you should have done is make all your primary partitions at the beginning of the disk and then place your extended at the end, and it is a good idea to have more space in the extended than in the primary partitions because in the extended you can have many logical partitions.

To be honest, I do not recommend shrinking or moving the sdb1 in your situation. From what I see you have an MBR disk with 2 primary partitions and one extended. So you can have one more primary partition on the disk. So, I suggest you shrink sdb3 and make another primary partition in the free space you'll get there. Unless, you have another disk (internal or external) where you can backup the data of sdb3, then you could delete sdb3 and sdb2, and re-plan your disk properly.
 
Old 05-25-2017, 01:34 AM   #4
pconstantatos
LQ Newbie
 
Registered: Dec 2016
Posts: 29

Original Poster
Rep: Reputation: Disabled
Thank you. sdb3 is already backed up. However if I delete sdb2 won't sdb5 (linux swap) also be deleted? Won't this have adverse effects on the operation of my system?
 
Old 05-25-2017, 02:05 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,140

Rep: Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935
Quote:
Originally Posted by aragorn2101 View Post
What you are asking is, I think, probably impossible to achieve without loss of data.
Would you care to expand on this opinion ?.
gparted is a very mature product and very reliable. Especially for Linux filesystems that support online resize like ext4. I use it extensively, although in some situations (like this one) it can be fiddly as I outlined above. This is not a fault of gparted but the structure of the partitions themselves - as you also alluded to.
 
Old 05-25-2017, 03:25 AM   #6
aragorn2101
Member
 
Registered: Dec 2012
Location: Mauritius
Distribution: Slackware
Posts: 552

Rep: Reputation: 270Reputation: 270Reputation: 270
Quote:
Originally Posted by syg00 View Post
Would you care to expand on this opinion ?.
gparted is a very mature product and very reliable. Especially for Linux filesystems that support online resize like ext4. I use it extensively, although in some situations (like this one) it can be fiddly as I outlined above. This is not a fault of gparted but the structure of the partitions themselves - as you also alluded to.
Yes, I remark that the extended partition is in the middle there, and sdb3 has data on it. I'm saying it is a big risk because I once tried something like this and it didn't work very well. I understand it is no fault of gparted. Fiddling with partitions is simply a risky business.

Quote:
Originally Posted by pconstantatos View Post
Thank you. sdb3 is already backed up. However if I delete sdb2 won't sdb5 (linux swap) also be deleted? Won't this have adverse effects on the operation of my system?
Since you have sdb3 backed up, then, maybe you can experiment a little bit and if everything goes fine, we will have proof that gparted can do the job very well. As syg00 suggested, apply each step separately so that you know everything is done properly:

- try resizing sdb3 so that it takes a suitable size at the end of the disk.
- increase sdb2 so that you have more space in the extended area.
- then move the swap partition to the end of the extended partition so that you have plenty of space on the left.
- eventually, you can move the left boundary of the extended so that you have some unallocated space on the right of sdb1.
- then resize your sdb1 as you wish.

Let's see if it works then.
 
Old 05-25-2017, 03:42 AM   #7
remma12
Member
 
Registered: May 2017
Distribution: Arch
Posts: 65

Rep: Reputation: 28
The best advice was given in the first reply by syg00
Delete the swap, switch to swap file instead. There is very little benefit of a swap partition over a swap file these days
If you have SDB3 backed up then the quickest option is to delete that partion then extend sdb1 into the space created. Then create a new partition
You will have to update FSTAB afterwards
 
Old 05-25-2017, 04:12 AM   #8
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 616

Rep: Reputation: 142Reputation: 142
It can be done without backing up your data.
1. Deactivate swap and delete sdb2 (extended) partition.
2. Shrink sdb3 to get free space enough for future DATA partition (at the end of sdb3).
3. Create new partition at freed space.
4. Move your files from sdb3 partition to newly created partition.
5. Delete sdb3. Now you have free space between sdb1 and new partition.
6. Create swap partition at the end of free space.
7. Append the rest of free space to sdb1.
Thats all.
 
Old 05-25-2017, 04:13 AM   #9
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 19.1 MATE
Posts: 8,016
Blog Entries: 5

Rep: Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861
Given the situation, you have to ask yourself why you actually want to increase the size of sdb1. 48GB is, in my experience, *huge* for a root filesystem (i.e. the Linux filesystem and user configuration files, less actual user data).

My advice would be to find out what's using all that space in sdb1 (is it one or more virtual machines for example?) and either transfer them to your Data partition, or split up your Data partition into two, using the new partition for the user data that was previously in sdb1 and mounting that in your fstab.
 
Old 05-25-2017, 08:51 PM   #10
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 358

Rep: Reputation: 102Reputation: 102
After reading all of the posts the best two were the last two by Teufel and hydruga.

The Teufel post gives the best instructions on how to actually makes the changes given that sdb3 is mostly empty with only 110 GiB used and 747 GiB free.

The comments by hydruga also make sense as 48GiB is a huge root filesystem and instead of simply enlarging the partition you could look to move some stuff into the data partition or create a new partition by shrinking sdb3.

No one has mentioned that all of these issues would go away if LVM was used.
 
1 members found this post helpful.
Old 05-25-2017, 09:31 PM   #11
pconstantatos
LQ Newbie
 
Registered: Dec 2016
Posts: 29

Original Poster
Rep: Reputation: Disabled
Thank you all. It has been resolved. However, when I boot-up I get the following message as seen in the attached screenshots
Attached Files
File Type: pdf start screen 1.pdf (433.1 KB, 20 views)
 
Old 05-25-2017, 09:38 PM   #12
RadicalDreamer
Member
 
Registered: Jul 2016
Location: USA
Distribution: Slackware64-Current
Posts: 988

Rep: Reputation: 478Reputation: 478Reputation: 478Reputation: 478Reputation: 478
Who owns it?

pconstantatos your username?
This would make user pconstantatos and group users the owners of everything in that directory:
chown pconstantatos:users -R /home/pconstantotos

Last edited by RadicalDreamer; 05-25-2017 at 09:41 PM.
 
Old 06-17-2017, 12:45 AM   #13
pconstantatos
LQ Newbie
 
Registered: Dec 2016
Posts: 29

Original Poster
Rep: Reputation: Disabled
A big thanks to everybody!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
partitioning? silvershady22 Linux - Newbie 2 06-17-2006 11:34 AM
partitioning my hd sfzombie13 Linux - Laptop and Netbook 4 07-10-2005 06:20 PM
partitioning help weijie90 Ubuntu 2 04-22-2005 02:25 AM
partitioning Thunderchild Mandriva 6 04-02-2005 05:51 AM
partitioning milesstandish Linux - Newbie 2 05-23-2003 02:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration