properly remove an external storage

ieronymous

Active Member
Apr 1, 2019
251
18
38
44
Hi

Even though there are relevant questions on that matter and after reading a lot of them I ve made my personal guide, I came across this need yesterday and trying to follow back my guide, noticed that there are some gaps that needec to be completed.

So my initial guide with an example goes

Unmount directory in Proxmox VE (PVE)
1 Login to PVE terminal directly or via SSH or via web gui -> Shell

2 Make sure the directory we want to unmount is not being used

3 Find the name of the directory, here we use “testfolder” as example
Locate the storage you want to remove from Data->storage and first edit it and unselect enable and remove it afterwards.
(else do it from cli with the command systemctl disable mnt-pve-testfolder.mount you ll notice below)
From there you will also be able to see the directory it is mounted on by the path option

4 Find the mounting service (I didn t use this ls -ahlp /etc/systemd/system)
systemctl list-units "*.mount"
We should see the mounting service from the results, here we will see following text as one of the results
mnt-pve-testfolder.mount . This service after removal shouldn t exist.
You can remove it with
systemctl disable mnt-pve-testfolder.mount
or it will be removed automatically after rebooting the server.

5 Unmount the directory
umount -R /mnt/pve/testfolder (for recursive in case you have mounted something inside that directory)

6 Check “/proc/mounts” file, delete/remove related lines, e.g. lines contain “testfolder”
nano /proc/mounts
When done, use Ctrl + X, Y, Enter key to Save and Exit nano

7 Remove the mount service for that folder
rm /etc/systemd/system/mnt-pve/testfolder.mount

To force remove/delete the file we can use following command (Usually it should not be the case)
rm -f /etc/systemd/system/mnt-pve/testfolder.mount

In step 5 I get a /mnt/pve/testfolder not mounted, but if i navigate to the path /mnt/pve/ I can see the directory testfolder
Shouldn't proxmox delete it by itself? (Depends if it has been created from gui or cli?)
Should I manually delete it with rm -r /mnt/pve/testfolder ?


In step 7 there is no mnt-pve inside the /etc/systemd/system/ so I can t find the /mnt-pve/testfolder.mount
why is that?

Thank you.





/mnt/pve
 
Last edited:
  • Like
Reactions: panchuz
Your guide helped me a lot!!!!!!
Many many Thanks!

pd: just tu add a bit of value here...
on my PVE 7.4-3 the path to the mount service was
/etc/systemd/system/mnt-pve-testfolder.mount
(instead of mentioned /etc/systemd/system/mnt-pve/testfolder.mount)
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!