Jan 20, 2026 by Thibault Debatty | 114 views
https://cylab.be/blog/468/move-home-directory-or-any-other-to-a-dedicated-partition
Sometimes your disk will get full. That’s the sad reality of life. So one solution can be to move a directory, like /home for example, to dedicated partition on another drive. Good news is, you can do this on a running system, without a single reboot…
For this example, I will assume that:
/home/dev/nvme0n1p1⚠ Don’t forget to modify these to match your directory and partition!
Also, I assume that you already created the new the new partition using something like GParted.
If not done yet (with GParted for example), create the filesystem, and don’t forget to indicate the correct partition path:
sudo mkfs.ext4 /dev/nvme0n1p1
sudo mkdir /mnt/temp
sudo mount -t ext4 /dev/nvme0n1p1 /mnt/temp
and
sudo rsync -av /home/ /mnt/temp/
The -a (archive) option is important as it will preserve file properties (owner, group, creation time etc.)
lsblk -f -e7
You can now add the new partition to /etc/fstab, using the UUID of the partition:
UUID=1c765... /home ext4 errors=remount-ro 0 2
As we modified /etc/fstab, we must relad systemd to take modifications into account:
sudo systemctl daemon-reload
And now we can mount the new partition:
sudo mount /home
And test!
Now here is the trick: the files are still present on the original partition (and thus consuming space), but ‘hidden’ under the freshly mounted partition.
The remove them, we can ‘bind mount’ the root directory in /mnt/bind for example, so we can access and delete the files from the original partition:
sudo mkdir /mnt/bind
sudo mount --bind / /mnt/bind
And delete the files:
sudo rm -Rf /mnt/bind/home/*
⚠ You should really start by deleting a single file from the old partition, and check the file is still present on the new partition… to make sure you didn’t mess up with one of the commands!
Moving a directory to a dedicated partition on another drive can be a lifesaver when dealing with a full disk. This process can be accomplished on a running system without the need for a reboot, making it a convenient solution for system administrators and users alike. But remember to carefully follow each step, including modifying the directory and partition paths to match your specific setup, and taking necessary precautions to avoid data loss.
This blog post is licensed under
CC BY-SA 4.0
Linux Offensive Security eBPF
News Jobs Linux Forensics
Virtualization Linux
When using VMware on Linux distributions, particularly on Manjaro, users may encounter a frustrating issue where their virtual machines (VMs) fail to establish an internet connection, resulting in the error message “could not connect Ethernet0 to a virtual network.” This problem can be particularly puzzling, especially for those new to Linux or VMware. In this post, we’ll delve into the causes of this issue and provide a step-by-step guide on how...