2

I am using a dual boot windows 7 64-bit with Ubuntu 16.04 64-bit. I am new to Ubuntu as well as Linux.

I am getting a warning as I log in on Ubuntu about low space in home. Here is my disk space when checking through gparted.

1

Now what I want to do is reallocate some space from / to /home, since as you can see I have 59.66 GB space free in /. I want to know how to do this - the articles I read suggest it can be risky, and since I'm new I need detailed help.

I am also confused about the warning as in gparted I see that I have 1.75GB unused space in home but the warning says your home has just some 600+MB remaining. Why is that?

Zanna
  • 70,465
  • If the answers to that question don't help, then please let us know by [edit]ing this question to explain. – Eliah Kagan Jul 23 '17 at 15:51
  • In order to give you the best answer, I need to know if you're willing to resize or delete either sda2 or sda4. Please advise. Start new comments to me with @heynnema or I may miss them. – heynnema Jul 23 '17 at 19:55
  • @heynnema I don't want to change or edit anything with my windows as there is already enough space for ubuntu allocation so please suggest things only for ubuntu .thank you ! – user716691 Aug 20 '17 at 11:03

2 Answers2

6

BACKUP IMPORTANT DATA BEFORE PROCEEDING

Even though the chances of losing data is slim but still

BACKUP IMPORTANT DATA BEFORE PROCEEDING


  1. Boot to a live environment using Ubuntu CD/DVD/USB.
  2. Open Gparted.
  3. Delete linux-swap (we will create it later).
  4. Resize /dev/sda5 to your desired size. See this answer for more information.
  5. Resize /dev/sda7 using the newly created unallocated space.
  6. Leave 4096 MB at the end for swap.
  7. Create new swap with the left out 4096 MB.
  8. Finally, apply all changes.
  9. Mount your / partition:

    sudo mkdir -p /media/dev && sudo mount /dev/sda5 /media/dev
    
  10. Edit /etc/fstab and change the UUID of the swap partition in the file:

    sudo gedit /etc/fstab
    
    • You can get the UUID of your swap partition from the command:

      sudo blkid
      
  11. Close everything and unmount mounted partition:

    sudo umount -R /media
    
  12. Reboot.

Raphael
  • 8,035
  • Basically wrong. – heynnema Jul 23 '17 at 19:53
  • @heynnema - How? Please clarify so that I can improve my answer. – Raphael Jul 24 '17 at 01:02
  • Fair question. 1. sda5 is / and as such 30-60G is already a good size. Reducing it will end up with /boot is full messages after a few system updates that include new kernels. 2. If you're going to delete/recreate swap, you'll have to use gparted and in terminal... mkswap and edit /etc/fstab with the new UUID. 3. The only clean way to increase sda7 is to reduce sda2 or sda4, then resize sda3 then sda7. – heynnema Jul 24 '17 at 02:21
0

Yes, your root partition is much larger than needed.

You should never modify a mounted partition

Thus, you need a LiveCD or other boot medium in order to continue.

Boot from the live medium. and install gparted if not already there.

Use gparted to shrink the size of / partition to 15GB. This leaves room for growth.

Then, move the swap partition to the end of the / partition.

You should now have a block of unallocated space next to the /home partition.
Grow the /home partition to fill this space.

Reboot the system.

ravery
  • 6,874
  • Instead of deleting and receating, try moving the swap to the left, so it does not change it's UUID. Otherwise, the system won't boot as it does not find the swap partition. Or, before starting the procedure as stated, comment the line regarding swap in your /etc/fstab, and after reboot with modified partitions, look for the UUID of the swap partition and modify /etc/fstab to reflect the new UUID. – ridgy Jul 23 '17 at 11:59
  • @ridgy good point, thanks for the reminder about /etc/fstab. moving swap is the better option. – ravery Jul 23 '17 at 12:00
  • Basically wrong too. – heynnema Jul 23 '17 at 19:54
  • @ravery the biggest problem with your plan is reducing / to 15G. I guarantee that after 1 or 2 system updates that include new kernels, the user will receive "/boot is out of space" errors. When creating a separate root, 30-60G is recommended. Also, the only clean way to increase /home is to first reduce either sda2 or sda4, then resize sda3 then sda7. – heynnema Jul 24 '17 at 02:42
  • @heynnema - he is currently using 8GB. 15 GB is double that. After having a successful kernel update,old kernels should be removed as they are unused..... I currently have 3 kernels with headers and only use 12GB. PS- everything is within the extended partition sda3 does not need to be changed. – ravery Jul 24 '17 at 03:27
  • @ravery Unfortunately old kernel deletion is still a manual process, although in 17.10 it may be automated. My root is currently around 55G, with quite a few old kernels (I've been lazy lately). A 15G root would have been way too small for me, and for most users too. I see it too many times here on AU where inexperienced new users partition their disks into / and /var and /tmp and /home, etc and they always make the partitions too small, eventually locking up the system with a full partition. – heynnema Jul 24 '17 at 04:27
  • @ravery ps: in your system, your root is around 12G... but you can't count how much will be used in /tmp and /var... so even 1 more system update with a new kernel could put you at risk for a full partition if yours was 15G total. – heynnema Jul 24 '17 at 04:32
  • @heynnema - if /var and /usr are on their own partitions only about 6-10GB is needed for root. removing old kernels is never automaded. (it always asks), removing the kernel that is in use usually causes a crash and boot errors. The new kernels has to be installed then boot to the new and remove the old. cleaning apt cache is also important. I have a fully installed mate desktop with all software and extras and my root is only 6GB. with kubuntu it maxed at 12 GB.most of the questions about root running out of space are people that tried to install with about 30GB allocated to ubuntu – ravery Jul 24 '17 at 04:41
  • @heynnema -- the system with 12GB root has a 20GB partition, I have never run into root space error. – ravery Jul 24 '17 at 04:46
  • @ravery as I mentioned, old kernel removal may be automated in 17.10... at least that's what I hear in the wind :-) Nice chatting with you. Take care. – heynnema Jul 24 '17 at 04:46