Friday, 12 April 2013

Move huge directory on the root partition to a huge non-root parition


Assumption: /mnt is a huge disk partition separate from the / partition  (aka root partition)
  1. mkdir -p /mnt/home/myfatdirectory
  2. kill all processes that have open files to /home/myfatdirectory
    1. lsof /home/myfatdirectory
    2. make sure you get ZERO results, ie no processes have open files to this directory
  3. mv /home/myfatdirectory /home/myfatdirectory_old 
  4. mkdir -p /home/myfatdirectory
  5. mount --bind /mnt/home/myfatdirectory /home/myfatdirectory
  6. add to bottom of /etc/fstab, so the mount is picked up on reboot
    1. /mnt/home/myfatdirectory /home/myfatdirectory none bind 0 0
NOTES:
  1. fix perms as necessary by interleaving your own steps into the above
  2. for the paranoid: you might want to make sure fstab entries work fine on reboot


No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Interview questions: 2020-12

Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer  Networking Layer 1 vs Layer 4 haproxy u...