[SOLVED] Reinstalling OS and Mounting Datastores EXT4

cshill

Member
May 8, 2024
82
11
8
Hi Everyone,

I was able to successfully reinstall the Proxmox OS with the following method below.

1. Backup storage.cfg, write down the datastore and to which disks they should go, backed up qemu-server folder with the VM configs, and backed up the lxc folder.
2. Reinstall the OS on the same drive as before with the same hostname and IP.
3. Run updates then reboot
4. Reinsert the backup files into the same folders as before.
5. make the directories under /mnt/pve
6. run echo "/dev/sdb1 /mnt/pve/Datastore1 ext4 defaults 0 2" >> /etc/fstab -- You may have a different /dev pathway and different Datastore name.
7. I run a reboot here.
8. Everything is show up correctly, however, When you go to the web ui and select the server hostname, go under disks, go to directory, I do not see the directories populating here.
 
/dev/sdb1
This will bite you. Mount via UUID or other reliable ways. Also mount -av is enough. No reboot needed.
To add the directory go to Datacenter > Storage > Add > Directory. The path you looked at is for PVE managed mounts.
 
Hi @cshill , are you able to provide some logs?

Review System Logs:
  • Check the system logs for any errors related to storage or mounting:
dmesg | grep -i error
tail -f /var/log/syslog
No errors for mounting.

I tried the UUID method thinking maybe it will show up under the hostname>disk>directory but to no avail.

Mount -AV is fine as long as you have them added to fstab then mount -av.


To add the directory go to Datacenter > Storage > Add > Directory. The path you looked at is for PVE managed mounts.

Directory has been added via the backed up storage.conf that I added. Removing there and re-adding does not change the hostname>disk>directory missing.
 
Maybe you overlooked this part
The path you looked at is for PVE managed mounts.
If you want it back you need to mount it via a systemd mount file in /etc/systemd/system matching ^mnt-pve-(.+)\.mount$.
I don't really see why this is so important though.
 
Last edited:
Here's my instructions on how to properly remount the disks after OS reinstallation for EXT4 Directories.

Code:
It's fine to mount disks by /dev/sdb or by UUID but Proxmox will not see this under the node>Disks>directory as it utilizes a mount rule within systemd

    1. Create the mount location
        a. sudo mkdir -p /mnt/pve/<datastore>
            i. The command above is for EXT4 Directories
        b. Grab the UUID of the disks
            i. blkid
                1) Should look like, /dev/sdc1: UUID="12ec005b-e1cd-4fd3-8603-164b922f21ec"
        c. Create the systemd mount location
            i.  sudo nano /etc/systemd/system/mnt-pve-<datastore>.mount
                1) Replace <datastore> with the datastore name.
            ii. Paste the following information into the mount location
                [Install]
                WantedBy=multi-user.target
                
                [Mount]
                Options=defaults
                Type=ext4
                What=/dev/disk/by-uuid/5f794c28-9fa4-4af8-bd78-dc8b3548da82
                Where=/mnt/pve/Datastore1
                
                [Unit]
                Description=Mount storage 'Datastore1' under /mnt/pve
            iii. Please replace the UUID of the above command, the Datastore name in both the WHERE section as well as under the Unit Description.
            iv. Repeat this until you have all the Datastore rules created.
    2. Run the following command
        a. sudo systemctl daemon-reexec
        sudo systemctl enable --now mnt-<name of system rule>.mount
        b. Example: sudo systemctl enable --now mnt-pve-Datastore1.mount
    3. Add Proxmox Storage configurations via PVESM command.
        a. pvesm add dir <datastore_name> --path /mnt/pve/<datastore_name> --content images,backup,iso --mkdir 0
            i. Example: pvesm add Datastore1 --path /mnt/pve/Datastore1 --content images,backup,iso --mkdir 0
    4. Confirm the mount works by running the command below
        a. pvesm status
            i. Should see it as active.
Go to the Proxmox node in the web gui, select disks, select directory. You should see it properly mounted there.