---
# System prepended metadata

title: Low Disk Space on "Filesystem root"
tags: [Linux]

---

# Low Disk Space on "Filesystem root"
---
[toc]

---


## Issue description
When booting into the Ubuntu, the system got stuck and not able to get into the login shell.

## Emergency recovery
1. Reboot the computer into grub menu, and select "Advanced options for Ubuntu".
![](https://hackmd.io/_uploads/SJgf4qTD2.png)

2. Enter the recovery mode
![](https://hackmd.io/_uploads/SJQnEq6v3.png)
![](https://hackmd.io/_uploads/SyYOVcTv2.png)

3. Clean up the system for some space.
```
sudo apt autoremove
sudo apt autoclean
sudo apt clean
```
- [關於「apt-get autoremove」](https://samwhelp.github.io/book-ubuntu-basic-skill/book/content/package/apt-get-autoremove.html)
- [clean, autoclean, and autoremove --- combining them is a good step?](https://askubuntu.com/questions/984797/clean-autoclean-and-autoremove-combining-them-is-a-good-step)

> apt/apt-get clean → cleans the packages and install script in /var/cache/apt/archives/
>
> apt/apt-get autoclean → cleans obsolete deb-packages, less than clean
>
> apt/apt-get autoremove → removes orphaned packages which are not longer needed from the system, but not purges them, use the --purge option together with the command for that.


- From the apt-get man page:
> - clean: clean clears out the local repository of retrieved package files. It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. When APT is used as a dselect(1) method, clean is run automatically. Those who do not use dselect will likely want to run apt-get clean from time to time to free up disk space.
>
> - autoclean: Like clean, autoclean clears out the local repository of retrieved package files. The difference is that it only removes package files that can no longer be downloaded, and are largely useless. This allows a cache to be maintained over a long period without it growing out of control. The configuration option APT::Clean-Installed will prevent installed packages from being erased if it is set to off.
>
> - autoremove: is used to remove packages that were automatically installed to satisfy dependencies for some package and that are no longer needed.



---
## Preparation of live USB
> In order to extend the root partition, you need to not be using the root partition. The only way to do that is to boot to a USB pen drive, and from there use Gparted on it.

**1. Prepare a bootable USB stick.** 
Since we cannot operation on the root filesystem when the system is on, therefore we should prepare one USB.
- [[Official Document]  Creating a live USB](https://ubuntu.com/tutorials/create-a-usb-stick-on-windows#2-requirements)
- [如何製作 Ubuntu 的 Live USB 隨身碟](https://www.youtube.com/watch?v=i7Uee78td-s){%youtube i7Uee78td-s %}

**2. Boot from the USB flash. Try Ubuntu.**
If your computer doesn’t automatically boot from USB, try holding F2/F12 when your computer first starts. With most machines, this will allow you to select the USB device from a system-specific boot menu.
![](https://hackmd.io/_uploads/r1BPYXJu2.png)
- [[Offical Document] Try Ubuntu before you install it](https://discourse.ubuntu.com/t/try-ubuntu-before-you-install-it/14014)



**3. Start GParted.**
![](https://hackmd.io/_uploads/HkbSXQJ_2.png)

**4. Move /dev/sdb6 to the left and grow it to 48GB.**
![](https://hackmd.io/_uploads/BkKCQQ1d2.png)

**5. Apply the operation.**
![](https://hackmd.io/_uploads/r10M47k_h.png)

**6. Wait for the operation to be done.**
![](https://hackmd.io/_uploads/HJGuNmk_2.png)

**7. Finish, and reboot the system.**
![](https://hackmd.io/_uploads/S1ETE7J_h.png)

**8. df -lh on terminal**
![](https://hackmd.io/_uploads/HkcDBXJdh.png)



---

### GParted
#### 1. Resize the C drive for another 30GB (see reference 1&2)
![](https://hackmd.io/_uploads/S1gjit6w2.png)

#### 2. Move the unallocated space to the right of the root filesystem partition
2-1. Move the unallocated space adjacent to the (/dev/sdb6) partition.
For now, the swap space is between the root filesystem partition and the unallocated space.

2-2. Right click on the linux-swap partition, and then unmount the swap space(swapoff).
![](https://hackmd.io/_uploads/SkUTnYpwn.png)

2-3. Right click on the swap space, and choose Resize/Move to move the swap space to be before the unallocated space.
![](https://hackmd.io/_uploads/Sk07aFaD3.png)

2-4. Drag the swap space to the left of the space.
![](https://hackmd.io/_uploads/B1ySat6P3.png)
![](https://hackmd.io/_uploads/HkcL6taD3.png)

2-5. Click Resize/Move. We shall see there is a window below indicating that there is 1 operation pending (*Move dev/sdb5 to the left*).

2-6. Click on the green button with check sign. Apply the operations to device.
![](https://hackmd.io/_uploads/BkRs6YTPh.png)

2-7. Finish moving the unallocated space adjacent to the root partition.
![](https://hackmd.io/_uploads/SkmAAK6P3.png)




---
## Reference
1. [[ask Ubuntu] Low disk space on Filesystem root despite having plenty of space in home](https://askubuntu.com/questions/1396769/low-disk-space-on-filesystem-root-despite-having-plenty-of-space-in-home)
2. [Increasing Disk Space on File System Root – Ubuntu 20.04](https://www.nucleiotechnologies.com/increasing-disk-space-on-file-system-root-ubuntu-20-04/)
3. [急需求助,ubuntu16.04 因為root空間不足,現在只剩桌面,該怎嘛辦?](https://www.mobile01.com/topicdetail.php?f=300&t=5412628)
4. [Linux commands - Hardware information](https://opensource.com/article/19/9/linux-commands-hardware-information)
5. [Ubuntu/根目录 100%（清理/根目录）](https://blog.csdn.net/qq_31375855/article/details/108534261)
6. [Ubuntu系统根目录空间不足解决办法](https://blog.csdn.net/weixin_37669024/article/details/121673889)
7. [ubuntu 16.04根目录磁盘空间扩容（亲测！！）](https://blog.csdn.net/weixin_41018348/article/details/82592057)
8. [Low disk space on filesystem root](https://www.linux.org/threads/low-disk-space-on-filesystem-root.28677/)
> In order to extend the root partition, you need to not be using the root partition. The only way to do that is to boot to a USB pen drive, and from there use Gparted on it.
> 
> You need understand what is writing to your / partition first. I run Kubuntu, but I'm pretty sure Ubuntu has a GUI that will show you the logs and what is being written to disk. There are probably error messages being created by some process or hardware. Deleting stuff won't fix that. My /partition has not had more than 12 GB in it since my last install of 18.04 almost 2 years ago.
>
> Until you figure out what the problem is, you can make the following entries in a terminal, each line at a time, to clean things up and these won't break anything unless your install is already broken:
>
>sudo apt autoremove
sudo apt autoclean
sudo apt clean



###### tags: `Linux`




