How to extend Linux partition [solved]

So I have had Linux Debian installed on my laptop for a year now and I originally gave it 38gb and left windows with 256gb. Well I have decided to pull the plug on windows and format that partition and now I want to add all that space to Debian. What is the best way to do that? I had this system tri booted with Kali windows 10 and Debian. I want to take that all down to Debian now and hopefully not have to reinstall Debian.

So, i reckon the windows partition was the first one installed on that drive? If so it's to the right, if you open up gparted on a live usb. I don't know of any way you can add it to the Debian partition if it is not directly "following" that partition. A thing left over from the good old days of HDD's (Even though SSD's don't care in the real world, software does still. Anyway, I don't know if it's an SSD or HDD you have there). So what you can do is to just add the partition as a folder. Typically it will be mounted at /mnt but you can really mount it anywhere you want. Or you can move your whole Debian install to the left, or closer to the beginning of the drive, as it were. This is obviously dangerous, so be sure to have a backup, like an image 1:1 of your whole drive, then it's easy to get back to where you were if things go sour.

Edit:This was rather sparsely written. I haven't actually tried moving a linux install closer to the beginning of the drive, only a windows 7 partition, which worked fine after it got to repair its boot options, which it did automatically when i tried to boot from it.

Maybe the best way to do it is to boot into a live usb, dd the original_debian to the former windows partition, boot into the original_debian and update grub, boot into the new_debian and wipe original_debian and expand the partition to use that space and the remaining 200+ GB. Maybe the expanding will have to be done in a live usb too.

Hmm, but maybe grub is on the original_debian. I'm just rapping off ideas here. It's late, I should go to bed.

i would recommend booting into a live distro that has gparted on it and tell us how the partitions are setup so we know what we are working with.

I did something risky and it worked out kinda. I booted into Debian opened Gparted and unmounted the partition Debian was installed on while running Debian, then i erased windows and moved/re-sized Debian to the left and remounted it all while doing this in Debian. It all worked and it boots just fine but now the new space just comes up as a detachable drive and it wasn't added to the main install like i hoped. When i install stuff it still only shows 38gb with 17gb free. But now it only shows the one large partition of 272gb when i am in Gparted. So now that i have all the space in one place how do i add it to my Home folder where everything installs. I am a total noob with linux and have been spit balling and looking up how to do stuff.

Imma run fdisk -l so I can show everyone how my partition is set up. I decided to keep Kali so it will show two partitions. dev/sd3 / which is Debian and dev/sd4 / which is Kali

Disk /dev/sda: 298.1 GiB, 320072933376 bytes, 625142448 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: 0x00000001

Device Boot Start End Sectors Size Id Type
/dev/sda3 2048 572182527 572180480 272.9G 83 Linux
/dev/sda4 572182528 625139711 52957184 25.3G 83 Linux

I have no clue how to add that 272gb to my home folder..

I made a dumb. sd3 is kali and sd4 is Debian. No wonder nothing made any sense.

So I understand, you have the following partition layout:

Debian:

/dev/sda4        /

Kali:

/dev/sda3        /

If that's the case, take any livecd that has an installer. (personally, I'd use the ubuntu livecd, because I know it works)

boot up the livecd and start gparted.

make sure you've unmounted the partitions.

from there, you can reorganize the partitions how you like. Resize the /dev/sda3 partition to give you space to add to /dev/sda4. (or you can just outright delete /dev/sda3)

once done, expand /dev/sda4 to take up the remaining space. the space needs to be next to /dev/sda3, either directly before or directly after.

click the checkbox in gparted to start applying the changes, go get a coffee or watch a movie, because it's going to take a good 45 minutes at the least.

I used a Debian live cd and it all worked beautifully. Now to figure out how to remove /dev/sda3 from the boot grub because its not there anymore.

you should be able to run

Always boot from a Live environment when doing these things.

Do you still need help with /home ?

Boot into LiveUSB, Download/install Gparted in the Live usb if t doesn't have it.
If you have the partition space for /home ready, you'll need the UUID id the partition and edit /etc/fstab with a text editor to show where the home partition will be mounted

watch this video, it hase the same principles if you are confused..

around 34:00 they start about where you need to...

I got it all figured out but thanks for the video link i learned a few things from it.

That worked. Thanks!

I now finally have Debian the way i want it. Thanks everyone

4 Likes

That's what Linux is all about !

mods mark this as SOLVED

1 Like