Go to the host console (though web interface or ssh). Do
You will get the list of hard disk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 461.8G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 4G 0 part [SWAP]
Partitioning the new hard disk
This helps to identify existing hard disks in the system. Shutdown the machine and install the new har d disk and reboot.
lsblk again and you will see a new entry, something like sdb. (you may also identify the new disk via web interface looking under (your_proxmox_node) > Disks. The new disk will show up as /dev/sdb).
Now in the console use fdisk to create partition in the new disk.
venkat@dellpve:~$ sudo fdisk /dev/sdb
[sudo] password for venkat:
Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help):
Use ‘n‘ to create a new partition. Create a single partition. Accept defaults for the first and last sectors (to use the entire new hard disk), write changes to the partition table with ‘w‘ and quit. Now the new disk is ready and we can create LVM volume in it.
venkat@dellpve:~$ pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.
Create a Volume Group.
venkat@dellpve:~$ vgcreate newdrive /dev/sdb1
Volume group "newdrive" successfully created
Now, under the GUI, go to (your_proxmox_node) > Storage > LVM
Give a new name for the storage, select the appropriate volume group from the menu and Add. The new drive is added successfully and an LVM is created for use under nodes.
Using new storage in Virtual Machines
Under the GUI, choose the VM in which you want to use the new storage. Choose Hardware and choose Hard Disk under the dropdown menu Add. In the pop up window, choose the new disk under dropdown menu Storage. Enter the size of the storage in GB. Add. You will now see additional Hard Disk space allocated to the VM.
This storage is in LVM and so is still raw. You need to properly format it under the VM and mount it.
Formatting and mounting the new storage in the VM
SSH to the VM. Check the availability of the new storage in the VM using lsblk. The output will show the new storage as /sdb in the VM. But the size will be limited to that allocated as above. (lsblk in the node will show the entire hard disk size).
Create the partition table”
sudo parted /dev/sdb mklabel gpt
Make it a primary partition, using the entire space:
sudo parted -a opt /dev/sdb mkpart primary ext4 0% 100%
This will create a new partition sdb1, ready to be formatted as ext4
Format it as ext4 file system:
sudo mkfs.ext4 -L stream /dev/sdb1
I have labelled the partition as <stream> in the above example. Next, I make a directory for video in it, mount it in fstab by editing /etc/fstab and mount all.
sudo mkdir -p /mnt/video
sudo vi /etc/fstab
Add a new line in fstab,
LABEL=stream /mnt/video ext4 defaults 0 2
Mount all file systems.
sudo mount -a
That’s it. /mnt/video is mounted. You may verify everything as:
venkat@watchdog:~$ lsblk -fs
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
loop0 squashfs 0 100% /snap/core
sda2 ext4 fa4a3f7d-83ee-4f4c-836d-c0a29ff9c2c7 111.6G 6% /
sdb1 ext4 stream 0caf7eae-15ff-4a19-9c53-aa975bf4965b 950.2G 1% /mnt/video
sr0 iso9660 Ubuntu-Server 19.10 amd64 2019-10-17-13-34-04-00
The new hard disk space is ready for use. You can create new directory under it and use.