Mastering Partition Resizing in Linux: Command Line Edition!

Mar 28, 2024 2:56 PM

ychaouche

Views

688

Likes

11

Dislikes

10

Amidst the digital labyrinth,
there she stands,
a modern-day explorer,
gazing intently at the illuminated screen before her...

Lines of text dance in a mesmerizing rhythm,
yet her brow furrows with uncertainty,
a testament to the daunting task that lies ahead.

The challenge looms large,
like a mountain to be conquered in the vast landscape of technology.

But fear not,
for within these lines lies the key to unlocking a realm of possibilities.

With determination in her heart and a firm resolve,
she sets forth on a journey of partition resizing,
ready to navigate the complexities of the digital frontier.

Alrighty, let's dive into resizing partitions on Linux using some command line magic.

Now, before we get started,
remember to take a deep breath and stay calm.
We'll walk through this together,
step by step.

First up, we'll need to check out what's going on with our partitions.

To do this, type in print free when you're in the parted command prompt. This command will give us a rundown of all our partitions and any free space hanging around.

Now, here's where it gets a tad tricky.
If you've got a logical partition nested inside an extended partition,
like our friend sda6 chilling inside sda2,
we can't just go resizing sda6 willy-nilly.
Nope, we gotta resize the big boss first,
which in this case is sda2.

Take a look at sda2.
It's ending way earlier than it should,
hogging up a bunch of space that could be put to good use.
We're talking about that sweet, sweet 777 gigabytes sitting there, doing nothing!

So, let's fix that.
We need to resize sda2 to gobble up all that available space,
making it a juicy 1100Gb.

Stay with me now.
Remember, you've got this!
We're going to resize sda2 like a pro.

I understand that diving into partition resizing can feel a bit daunting at first, but I'm here to assure you that you're in good hands.

Now, let's talk about this resizepart command.
It's a nifty tool that works its magic even if the partition is currently in use.
So, no need to fret about interrupting your system's operations.
We've got your back!

You see,
by default,
resizepart gives you the actual size that's being used.
But we're talking about expanding that partition to its full potential,
all 1100GB of it!

Take a moment to notice the difference after you issue the command.
Partition number 2 has transformed before your eyes,
now stretching out to embrace all that extra space.
It's like watching a caterpillar turn into a butterfly!

Having successfully resized the extended partition sda2, it now presents the opportunity for the subsequent resizing of the logical partition sda6.

So, let's make this happen together. Trust me, you'll thank yourself for unlocking that additional storage capacity. You deserve it!

Alright, buckle up!
We're taking sda6 on a wild ride to the land of 1TB!
That's right,
we're giving it some serious elbow room,
making it the belle of the ball in the partition world.

Picture this:
sda6 strutting its stuff,
flexing its newfound gigabytes like a heavyweight champion.
We're talking storage space for years!

And guess what?
Our buddy partprobe is standing by,
ready to gossip to the OS about all the juicy changes we've made to the partition table.
It's like giving the operating system a front-row seat to the hottest gossip in town!

Oh, great, just what we needed – more fun with filesystems!
So, despite all our efforts,
the filesystem is still clinging to its measly 246G, huh?
Typical.

Now, here's the next brilliant idea:
let's play this little game called "resize2fs /dev/sda6"
and see if it can finally get its act together.
Supposedly, it's going to align the filesystem with the partition.
Yeah, because that's exactly what we needed,
another round of tweaking just to get things to sync up.

Well, let's get it over with.
Maybe this time it'll actually do what it's supposed to do without throwing another wrench in the works.
But hey,
I won't hold my breath.
It's just one more hassle in the never-ending saga of tech headaches.

Witness the transformation: sda6, now a robust 959Gb.
No need for theatrics like rebooting.

As we conclude our adventure through the land of disk partitions,
remember that you now possess the power to resize partitions without rebooting the system.

Armed with this newfound knowledge,
you can keep your systems running smoothly and efficiently,
saving the day like a true IT superhero.

Keep exploring and mastering the command line,
and may your technical journey be filled with victory and excitement!

Happy resizing!

This work was done using the following chatgpt prompts: https://chat.openai.com/share/71b8cd36-13d5-4c32-a779-fe8fcbdda80f

Comments appreciated!

filesystems

disk_partitions

parted

resize2fs

linux

Awww, i miss dos! Wish we had more assembly reversing here. Like tuts4you and crackmes dot com dot de

1 year ago | Likes 2 Dislikes 0

Please do not trust any GenAI for the incredibly technical tasks, especially anything that can completely wipe a drive unless it's a blank/free drive to start with. I've played with GenAI a bit, and it's super confident about many things that are categorically wrong, and you won't know unless you already know the answer or attempt it and it fails.

@OP may have validated the instructions(tl:dr), but I'm putting this out as a cautionary tale. You WILL wipe a drive unless you are really careful

1 year ago | Likes 4 Dislikes 1

The AI was only used to turn my boring tutorial into a compelling story.

1 year ago | Likes 2 Dislikes 1

Understood, just expressing caution for any readers who might jump in. GenAI is helpful in doses, but i can see many relying on it far too much. When i get completely wrong answers to a question and there's no "well maybe this will work", then i know it's just throwing shit against the wall to see what sticks. When you are talking diskpart, that ups the discomfort level considerably.

1 year ago | Likes 4 Dislikes 0