Wiki source code of Storage

Version 4.1 by Kevin Wiki on 2025/09/23 07:35

Hide last authors
Kevin Wiki 1.1 1 Adding external high speed VM storage to proxmox. Find the new drive and erase it and then format using parted:
2
3 ```bash
4 # format drive and create partition
5 parted /dev/nvme0n1 mklabel gpt
6 parted /dev/nvme0n1 mkpart primary ext4 0% 100%
7
8 # create a ext4 filesystem
9 mkfs.ext4 /dev/nvme0n1p1
10
Kevin Wiki 3.1 11 # create dir to mount drive to
12 mkdir -p /mnt/vmstorage
13
Kevin Wiki 1.1 14 # add to fstab
15 printf "\n/dev/nvme0n1p1 /mnt/vmstorage ext4 defaults 0 0" >> /etc/fstab
Kevin Wiki 2.1 16
17 # mount drives defined in fstab
18 mount
Kevin Wiki 1.1 19 ```
Kevin Wiki 3.1 20
21 Add the new device in proxmox UI or in `/etc/pve/storage.cfg` to:
22
23 ```cfg
24 dir: nvme
25 path /mnt/vmstorage
26 content backup,rootdir,snippets,iso,vztmpl,images
27 prune-backups keep-all=1
28 shared 0
29 ```
30
Kevin Wiki 3.2 31 ## Moving images from LVM storage
32
Kevin Wiki 3.5 33 The actual disk is mounted as a mapper device. If is was LXC container with id 401, a disk might look like `/dev/mapper/pve-vm--401--disk--0`
Kevin Wiki 3.3 34
Kevin Wiki 3.4 35 ```bash
36 $ fdisk -l
37 ...
38
39 Disk /dev/mapper/pve-vm--121--disk--0: 12 GiB, 12884901888 bytes, 25165824 sectors
40 Units: sectors of 1 * 512 = 512 bytes
41 Sector size (logical/physical): 512 bytes / 512 bytes
42 I/O size (minimum/optimal): 65536 bytes / 65536 bytes
43 Disklabel type: gpt
44 Disk identifier: E6B137D0-95DE-4C44-B5D1-1C74DE40F141
45
46 Device Start End Sectors Size Type
47 /dev/mapper/pve-vm--121--disk--0-part1 227328 25165790 24938463 11.9G Linux filesystem
48 /dev/mapper/pve-vm--121--disk--0-part14 2048 10239 8192 4M BIOS boot
49 /dev/mapper/pve-vm--121--disk--0-part15 10240 227327 217088 106M EFI System
50
51 ```
52
Kevin Wiki 4.1 53 Identify the vm disk path using the command:
Kevin Wiki 3.5 54
Kevin Wiki 4.1 55 ```bash
56 pvesm path STORAGE:vm-VM_ID-disk-0
57
58 or
59
60 pvesm path local-lvm:vm-401-disk-0
61 ```
62
63 Then convert the the storage with:
64
65 ```bash
66 qemu-img convert -O qcow2 $(pvesm path local-lvm:vm-401-disk-0) nvme
67 ```
68
69 note, here we also move the storage from `local-lvm` to `nvme`.
70
Kevin Wiki 3.1 71