I use “remount” in the title and through the following article, but it is not exactly accurate. I use “remount” to mean delete
/usr in root directory, and use another larger partition for
/usr. So, don’t be confused when you see the “remount” word through this article. If you know the exactly accurate word, please notify me.
On my computer, I give 20G for root directory, 32G for home directory, 300M for boot directory and 90G for others.
Note: This screenshot is the partition after my alteration. The only different between before my alteration and after my alteration is the last partition which is
/dev/sdb7 /usr. The last partition is
/dev/sdb7 /dexterous before my alteration and it is empty whereas it occupies 20% space after my alteration.
Here, I should explain the above figure more explicitly. My computer is dual-boot systems. The two systems are Windows 10 and Ubuntu 16.04, respectively. So, devices whose type is
ext4 are for Ubuntu 16.04, and other devices are for Windows 10.
The issue I encountered is root directory (
/dev/sda3 in the above figure) is almost full and I can not use apt-get install instruction to install new software because of no enough available space here.
If you have the same problem, you can follow this article to solve this ignoring problem.
- An empty and large enough partition (Mine is
That all!!! Easy and simple, isn’t it?
Now, follow me to fix this issue.
Archive (Copying the files)
We want to “delete”
/usr folder in
/dev/sda3. and use
/usr. But before deleting
/usr, we have an important thing to do: to make an archive for
/usr folder in
/dev/sda3, because we don’t want to reinstall all the software after remounting
/usr in another place.
Open terminal with shortcut
Ctrl + Alt + T.
cp -a /usr/* /dexterous
dexterous is the name of my another partition which is larger and can be used for
/usr directory. You must replace
dexterous with your partition name.
Note 2: option
-a must be added. Without
-a option, you will regret. Believe me. I did not add this option, and I want to kill myself when I encounter a fatal problem, which is
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
when I want to use
sudo command after remounting. If you do the stupid thing just like me, you can refer my another article to solve this fatal problem.
Here is the content of my fstab file.
# /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sda3 during installation UUID=b21df17c-9ead-429d-9e32-af84a5721b6c / ext4 errors=remount-ro 0 1 # /boot was on /dev/sda5 during installation UUID=06b77b52-4b9c-425c-86c5-2d415769f72c /boot ext4 defaults 0 2 # /dexterous was on /dev/sdb7 during installation UUID=1fced500-e65e-4093-b95d-0dd33c7f248b /dexterous ext4 defaults 0 2 # /home was on /dev/sda6 during installation UUID=d25150fa-f2e5-4f7c-8de6-73051f24b2d4 /home ext4 defaults 0 2 # swap was on /dev/sdb6 during installation UUID=66a110a7-bddd-4344-a55a-d66945392160 none swap sw 0 0
If you don’t know UUID of your new partition. You can see the mapping by doing:
$ ls -l /dev/disk/by-uuid
Because I already know my UUID in my fstab file, the only thing to do is replace
# /dexterous was on /dev/sdb7 during installation UUID=1fced500-e65e-4093-b95d-0dd33c7f248b /dexterous ext4 defaults 0 2
# /usr was on /dev/sdb7 during installation UUID=1fced500-e65e-4093-b95d-0dd33c7f248b /usr ext4 defaults 0 2
reboot command in terminal to reboot your computer.
Delete the old files
After the reboot, the old files in
/usr on the root partition will be hidden by the new partition mounted on
/usr. But we can use some mount bind trickery to get to the old files and then delete them.
$ sudo mount --bind / /mnt
$ sudo rm -rf /mnt/usr
$ sudo umount /mnt
Congratulations!!! Now, you have remount
/usr to another larger partition and free root partition.