Rename a filesystem, or change a mount point

I was just asked today to provide a quick overview of the steps necessary to rename a filesystem. And here is what I came up with. Please use this information at your own risk, and always ensure you have a backup just in case something does not go well.

Say you have /backup and you want it to be /sapbackup

First gather the right information.

What is the current logical volume name (you may want to rename the logical volume for consistency)?
What is the Volume Group name?
What is the current mount point?
What is the destination mount point?

Steps are:

1. Create new mount point (mkdir /sapbackup)
2. Umount existing filesystem (umount /backup)
3. lvrename to change logical volume name (lvrename /dev/vgname/backuplv /dev/vgname/sapbackuplv)
4. Update /etc/fstab to point to the new location.
5. mount new filesystem (mount /sapbackup)
6. Remove old mount point and ensure no data exists in this directory before doing so

Stop worrying about your server issues

Click here for additional detail or request a proposal so you can start focusing on growing your business, rather than supporting your servers.