Resize or Extend a Linux Partition/Volume/Disk (Swap - Ubuntu - Gparted)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey savvy people it's savvy nick here and today i'll be showing you how to resize your linux storage whenever you have some unallocated space i'm using g parted right now to view one of my hard drives and the one i'm viewing is this current ubuntu system that i'm using notice i've cloned it over and in some cases when you clone things over let's say to a bigger disk you're left with some unallocated space at the end because the old disk might have been smaller your partitions were configured against that disk size so for example here i have around 62.7 gigs for root file partition around eight gigs for a swap file and finally all that unallocated space that i want to grow my system into some of you might not have the swap partition this is for older systems that used to use swap partitions i'll show you how to move things around so we can take advantage of using the unallocated space first off you can't make any changes in your system because these disks are mounted so if i wanted to let's say resize and move something i can't do it i can't change these numbers and i cannot resize so what i did is i downloaded and installed a bootable disk creator i'm using bellenna etcher today i downloaded it from the web i'll put a link in the description below so you can also do the same and then next we're going to need a live image i'm using ubuntu so i'm going to create a live image of ubuntu it'll just make things easier for me you can do this across any linux distribution it all works the same we'll use the same tools select whatever live image you want i'm going to download this now save the file i'm using ubuntu 20.04 after i have the image downloaded i'll launch and use the bilena etcher app you could of course use rufus unetboot and whatever can make a bootable disc but you absolutely need one in order to access and resize your storage disk this is because in a live environment your disk won't be mounted and you have free access to it and now i'm going to flash from the file the file is the one i just got done downloading here i have ubuntu 2004 the desktop version and i'm going to use this as a live environment so i'm going to click on here and then select a target well i only have one usb in the system and i already have a live image on it but select a usb cd or dvd where you want to overwrite the contents of so you can make your live disk and then select it once you're done select flash and give yourself administrative privileges so you can flash the contents onto the usb after it's done flashing then what we need to do is actually boot into that live environment how do we do this well restart your system and boot into bios so you can select the proper usb to boot first so as my system's rebooting i'm going to be asked to enter bios through f2 or delete at least for my computer yours might be something different make sure to look it up for your particular motherboard here we go f2 or delete to enter uefi bios and now i'm in my bios you'll notice that i have my usb right here underneath the ubuntu system i have installed on my disk so i'm going to move this usb live environment above ubuntu that way i'm loading into here and not here some of you might not have this view so go into advanced mode or if you see some sort of tabs at the top look for boot order or boot priority and then select your boot option number one to be the usb that you just got done flashing after you're done with that you can save and exit out of your bios and that should boot you into the proper live environment so we can start making edits to our storage space here we go i'm being asked what i want to select i'm just going to select ubuntu from the live environment that way i can load into the live environment all right and this is a great sign i load it into the correct usb so i have try ubuntu or install bootu i don't want to install in bootsu instead i'm going to hit try ubuntu to get to the live environment this might look the same but it is a live environment because right here we can see we can install ubuntu that's not what we want to do and now we want to start up a disk management tool it's called g-parted if you don't have it on your system use your software store on the live environment to grab gparted a lot of live environments come with gparted because it's such a great tool ubuntu does so that's why i like using ubuntu as my live environment to make edits to disks otherwise you can get it through a terminal by using a package manager for example here we'd use sudo apt install gparted press enter and you should be on your way okay once you have gparted on the system launch it and this is what it looks like great the first thing i'll tell you is if you have multiple disks in your system make sure you have the proper disk selected you don't want to be making changes to the wrong disk you'll ruin it so go to the top right corner select the drop down and select the proper disk i know mine's 120 gigs that's what we were looking at on the actual system earlier so now i have the properties selected i can see i have a roof file partition a swap partition and a bunch of unallocated space so now how do i grow this well if i right click and go to resize and move i can move now but i can't extend so why is that the case well swap is in the way some of you might not have swap in the way and you can simply resize into the unallocated space and having a swap partition is kind of useless at this point because you can create a swap file i have a video on this and i'll put a link in the description below if you want to make a swap file instead of a swap partition so either way what we first have to do is go down to our swap partition and make sure to turn swap off after we have swap turned off we can now make an edit to the swap partition we can resize or move it and i can move it towards the end of the disk and that's exactly what i want to do so i'll do that just move the entire contents over to the end you can also specify all this information in megabytes below and then hits resize or remove it says moving the partition might cause your operating system to fail to boot that's okay it's just saying if you did something let's say with the efi system partition you could screw your system up because it wouldn't know how to boot into it anymore moving swap is fine and now look at that we have swap being shown at the end mine is eight gigs you can also completely delete swap if you want just by hitting delete i'm going to revert that because i don't want to delete swap i'll keep it at the end here i'll keep my swap partition but if you do delete your swap partition you can check out that video that i suggested in order to create a swap file and just make things a little easier for you in the future otherwise for those of us with only unallocated and root file space let's extend the root file partition mine's ext4 formatted you can either select it up here in gparted or below right click hit resize and move now we can resize the entire partition in order to fill up the rest of the disk and then we can hit resize and move i love using gparted because it just makes things a little easier notice that there's a little bit of space left here at the end which is a little goofy but that's just because of how the system allocates its byte bounds so it just so happened that it left a little bit of unallocated space at the end this is fine not a big deal you could try getting it perfect but i don't think you'll be able to anyways once that's done you can hit the apply all operations make sure you did not mess with the efi system partition if you did you're doing something wrong you might screw up your current install always back up your data before making any changes to your disks i'm pretty confident in this so i'm going to select the check mark to apply all operations it says do you want to apply the pending operations yep apply it's going to take a few moments as things are moved around and resized after they're done i'll hit close and notice i have sda one two three everything looks good we have just this little bit of unallocated space not a big deal your balance might end up being perfect and you might not have any at all you could also have your linux swap completely gone but we have to do one more thing to the linux swap since it was moved we turned swap off now we need to turn it back on and once it's back on then the system will recognize that swap partition as swap again very good you've moved things around you're ready to boot back into your system at this point let's exit out of gparted and restart the system go back into bios and select your ubuntu system to load instead of the live ubuntu environment or whatever live environment that you are currently in so i'm restarting things now and i'm going to remove that media that way i don't accidentally boot into the wrong thing and i'm booting into my bios once more just to confirm i have the proper boot priority selected so here's my disk here ubuntu great that's the one i wanted so i'm just going to continue on and it automatically picked that one because i removed my usb in the process of starting my computer up all right i got grub in front of me i'm going to select my ubuntu distro things are looking good so far no errors no problems and this is a great sign i can see my user so i'm going to log in now i can see my official system because i have belena etcher here at that background we know we're back into the correct place so i'm going to look at two things i'm going to look at let's just do g parted make sure that things look good you'll have to enter a password in order to use that if you don't have it installed install it i'm going to go down to sda the one that i just messed with and look at this we now are using the full space i have 110 gigs now available instead of around 60 gigs i have my swap partition at the end confirm that you go down here and you have your swap on you can also manage any flags make sure that swap is selected that shouldn't have changed but just in case it did make sure to do those things otherwise you have it all set up congratulations if you made it this far you've successfully resized your root file partition and you moved swap around one other thing i'll do is check the disks app and i can go down to that disk i just made changes to and look at this it says i have my efi system now i have around 120 gigs available for my profile partition and i have my swap which is currently active awesome job this is quite a tricky process for most people hopefully you made it through no problem and i definitely suggest getting rid of that swap partition and making a swap file it'll just make things easier on you in the future anyways if you have any questions comments or suggestions please make sure to post them in the comments section below also make sure to subscribe for future videos and make sure to like the video catch me in a great community on discord and i'll catch you in another video thanks for watching
Info
Channel: SavvyNik
Views: 164,157
Rating: undefined out of 5
Keywords:
Id: Kyz9x71gEPI
Channel Id: undefined
Length: 10min 31sec (631 seconds)
Published: Mon Jan 24 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.