LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Partitioning (https://www.linuxquestions.org/questions/linux-newbie-8/partitioning-4175606624/)

pconstantatos 05-25-2017 12:39 AM

Partitioning
 
1 Attachment(s)
Attachment 25103Could someone please advise on how to extend partition sdb1 and shrink sdb3 as seen in the attached screenshot?

syg00 05-25-2017 12:58 AM

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.

aragorn2101 05-25-2017 01:14 AM

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.

pconstantatos 05-25-2017 01:34 AM

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?

syg00 05-25-2017 02:05 AM

Quote:

Originally Posted by aragorn2101 (Post 5714901)
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.

aragorn2101 05-25-2017 03:25 AM

Quote:

Originally Posted by syg00 (Post 5714910)
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 (Post 5714904)
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.

remma12 05-25-2017 03:42 AM

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

Teufel 05-25-2017 04:12 AM

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.

hydrurga 05-25-2017 04:13 AM

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.

tofino_surfer 05-25-2017 08:51 PM

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.

pconstantatos 05-25-2017 09:31 PM

1 Attachment(s)
Thank you all. It has been resolved. However, when I boot-up I get the following message as seen in the attached screenshots

RadicalDreamer 05-25-2017 09:38 PM

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

pconstantatos 06-17-2017 12:45 AM

A big thanks to everybody!


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