By Scott
So first off that was one of the best tutorials I have followed, it worked the first time. But I was setting up a data raid1 array and wanted to move my entire /home directory to the new array /mnt.md0/home and removed the old home. I have been unable to find a proper way to mv /home /mnt/md0/home and to delete the /home directory and update the fstab to work. /dev/md0 /mnt/md0 /home ext4 defaults,nofail,discard 0 0
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
Glad the tutorial worked well for you! Before making any changes, make sure you have a backup in case anything goes wrong:
https://docs.digitalocean.com/support/how-do-i-manually-back-up-my-droplet/
Once you have your backup, to move /home
to your RAID 1 array you should be able to:
Mount the RAID array (if not already mounted):
sudo mount /dev/md0 /mnt/md0
Copy /home
data to the new array while preserving permissions:
sudo rsync -aX /home/ /mnt/md0/home/
Update fstab
to mount /home
from RAID on boot:
sudo cp /etc/fstab /etc/fstab.bak
echo "/dev/md0 /home ext4 defaults,nofail,discard 0 0" | sudo tee -a /etc/fstab
Check if /home
is on a separate mount:
df -h /home
/home
is on a separate partition (e.g., /dev/sdX
or another disk), you’ll need to unmount it first before updating fstab
./home
is just part of /
, they don’t need to unmount it, and they can proceed with remounting it from the RAID array.Before unmounting, make sure that there are no active processes running on /home
:
sudo lsof /home
Once you’ve confirmed that there are no active processes, unmount /home
and remount it:
sudo umount /home
sudo mount -a
Verify everything is working:
df -h /home
Reboot and confirm that /home
is properly mounted.
If anything goes wrong, you can revert by restoring from your backup and updating fstab
again.
Let me know how it goes.
- Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.