Switch a data volume on Linux

October 17th, 2025 – 7:10 pm
Categorized as Computing Notes
Tagged as

How to move /var/www/html/mydata/ to a new disk:

1. fdisk /dev/nvme4n1
     1.i. create a new DOS partition and write it to disk
2. mkfs -t ext4 /dev/nvme4n1p1
3. lsblk -f (and copy the UUID for use in FSTAB)
    3.i. a0e2e1e7-4034-4876-a005-ae5fcca39751
4. mount /dev/nvme4n1p1 /mnt
5. shopt -s dotglob
6. rsync -aulvXpogtr /var/www/html/mydata/* /mnt
7. edit /etc/fstab and replace the UUID for the data storage drive
8. mount -av to test
9. reboot

[_] Expand 7 to show fstab options