Removing external storage steps

ieronymous

Active Member
Apr 1, 2019
251
18
38
44
Hi

I had attached an external hdd via usb to the server and after initializing it and creating a zfs, created a directory on top in order to store backups. i need now to remove it and probably manually umount it, in order to attach it to a different server and restore one Vm from there (in case it will be referred, I didn t want to join those nodes together in a cluster and make the procedure easier, for my reasons)

So in order to remove the usb connection from the external case hosting the disk (keeping the power on) do iI only need to remove the external storage from Datacenter tab (so graphically only) or to umount the mounting point as well from cli?

I am asking because before and after removal command
root@HH:~# systemctl list-units "*.mount" gives me on both situations (before and after removal) that the mount is still loaded active and mounted
UNIT LOAD ACTIVE SUB DESCRIPTION
-.mount loaded active mounted Root Mount
mnt-pve-Externalstorage.mount loaded active mounted Mount storage 'Externalstorage' under /mnt/pve

I don t want to corrupt anything, so am I missing any service I need to restart (could I restart the hypothetical needed service while this service would affect all other mounting points based on which storages are running? - probably expressed it weirdly) or something? I am reminding you the server is online in a production environment and not easy to restart as I please.

Thank you
 
Last edited:
First remove or disable it in the Datacenter -> Storage tab of the GUI.

Once this is done manually unmount it with `umount -R </path/to/mountpoint>`. Once that succeeds, feel free to disconnect the HDD.
 
First remove or disable it in the Datacenter -> Storage tab of the GUI.

Once this is done manually unmount it with `umount -R </path/to/mountpoint>`. Once that succeeds, feel free to disconnect the HDD.

Ok it seems I ve already done the above except the option -R . Is it for recursive or something? Do I need re-run the command again in order to add the -R or disconnect the HDD ?
 
Last edited:
Yes, for recursive. It's usually not necessary if you haven't mounted something inside that directory.
And you should get an error if something is mounted inside that directory if you don't specify it. So you can ignore that option.
 
  • Like
Reactions: ieronymous
Yes, for recursive. It's usually not necessary if you haven't mounted something inside that directory.
And you should get an error if something is mounted inside that directory if you don't specify it. So you can ignore that option.
Thank you once again. Happened to come across my previous guides (I couldn t find them yesterday, that is why I posted here at first place). My guide was a little more extensive so I ll paste it here in case someone else would like to double check

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 remove it
(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

4 Find the mounting service
ls -ahlp /etc/systemd/system
We should see the mounting service from the results, here we will see following text as one of the results
mnt-pve-testfolder.mount

5 Unmount the directory
systemctl disable mnt-pve-testfolder.mount
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
 
Last edited:

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!