user1950349 user1950349 - 9 months ago 63
Linux Question

How to change mountpoint name?

I am working in ubuntu, this is what df -h shows:

Filesystem Size Used Avail Use% Mounted on
/dev/vda 30G 1.7G 27G 6% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 15G 12K 15G 1% /dev
tmpfs 3.0G 372K 3.0G 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 15G 0 15G 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/vdb 197G 60M 187G 1% /mnt

Now I want to change the name of
directory instead. I want all the content to stay where it is, the only thing that has to change is the name of the drive mountpoint.

Here is what I have in

LABEL=c3image-rootfs / ext4 errors=remount-ro 0 1
/dev/vdb /mnt auto defaults,nobootwait,comment=cloudconfig 0 2

Could you please explain the commands necessary and the files to edit?


It goes without saying that you should be careful, and understand what each command does before running it - you might also need to make sure that nothing is using the files while you do this.

Make the new mountpoint

mkdir /data

unmount the current mountpoint

umount /mnt

edit /etc/fstab and change /mnt to /data

/dev/vdb        /data    auto    defaults,nobootwait,comment=cloudconfig 0       2

mount the new location

mount /data

remove the old mountpoint

rmdir /mnt