storage-how-to-add-an-existing-ext4 partition on second disk-with-data-to-my-vm

oguz

Proxmox Staff Member
Staff member
Nov 19, 2018
2,833
316
88
hi,

inside the VM run fdisk -l to determine the name of the device. (for example it could be /dev/sdb)

check the partition numbers and decide which partition to mount, f.e., /dev/sdb1

afterwards create a directory: mkdir /mount_me_here
then mount the disk: mount /dev/sdb1 /mount_me_here

EDIT: fix the partition name
 
Last edited:

aquananu

New Member
Aug 12, 2020
7
0
1
46
getting error as disk type shown is unknown and the disk size if greater than specified while creating the hdd for VM, i had created size of 280.70 gb whereas it is getting shown as 301 gb

1598693872125.png

error on mount command is as below, datadrive folder is already created in root

sudo mount /dev/sdb /datadrive

mount: /datadrive: wrong fs type, bad option, bad superblock on /dev/sdb, missing codepage or helper program, or other error

1598703183971.png
 

oguz

Proxmox Staff Member
Staff member
Nov 19, 2018
2,833
316
88
what does fdisk -l say about the disk? can you post the output of lsblk -f ?
 

aquananu

New Member
Aug 12, 2020
7
0
1
46
pls see attached outputs files for the vm,

below is the output for the node
root@QUICKSILVERINDIA:~# fdisk -l
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: WDC WD20EZAZ-00G
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xb438ec04

Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2048 507811839 507809792 242.1G 8e Linux LVM
/dev/sdb2 509812736 525438975 15626240 7.5G 82 Linux swap / Solaris
/dev/sdb3 525438976 3907028991 3381590016 1.6T 5 Extended
/dev/sdb4 507811840 509812735 2000896 977M 8e Linux LVM
/dev/sdb5 525441024 3306833919 2781392896 1.3T 83 Linux
/dev/sdb6 3306835968 3907028991 600193024 286.2G 83 Linux

Partition table entries are not in disk order.


Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: WDC WD10EZEX-00W
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 66B94556-F0BC-4625-B73C-411B19169B53

Device Start End Sectors Size Type
/dev/sda1 34 2047 2014 1007K BIOS boot
/dev/sda2 2048 1050623 1048576 512M EFI System
/dev/sda3 1050624 1953525134 1952474511 931G Linux LVM

Partition 1 does not start on physical sector boundary.


Disk /dev/mapper/pve-swap: 7 GiB, 7516192768 bytes, 14680064 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/pve-root: 96 GiB, 103079215104 bytes, 201326592 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/pve-vm--100--disk--1: 32 GiB, 34359738368 bytes, 67108864 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes


Disk /dev/mapper/pve-vm--101--disk--0: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes
Disklabel type: dos
Disk identifier: 0xa9207bda

Device Boot Start End Sectors Size Id Type
/dev/mapper/pve-vm--101--disk--0-part1 * 2048 209713151 209711104 100G 83 Linux


Disk /dev/mapper/pve-vm--102--disk--0: 500 GiB, 536870912000 bytes, 1048576000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes
Disklabel type: dos
Disk identifier: 0x000bbc71

Device Boot Start End Sectors Size Id Type
/dev/mapper/pve-vm--102--disk--0-part1 * 2048 2099199 2097152 1G 83 Linux
/dev/mapper/pve-vm--102--disk--0-part2 2099200 1048575999 1046476800 499G 8e Linux LVM

root@QUICKSILVERINDIA:~# lsblk -f
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
sda
├─sda1
├─sda2 vfat E4C0-DF86
└─sda3 LVM2_member n2Qrw1-oKpl-HsLx-TERs-XQZ7-Nikx-cBUKVz
├─pve-swap swap 2ec06342-d4d9-4193-b6c6-8bcff2eb20b6 [SWAP]
├─pve-root ext4 43038125-eda6-4a8d-a861-60d87b87f70d 83.4G 6% /
├─pve-data_tmeta
│ └─pve-data-tpool
│ ├─pve-data
│ ├─pve-vm--100--disk--1
│ ├─pve-vm--101--disk--0
│ └─pve-vm--102--disk--0
└─pve-data_tdata
└─pve-data-tpool
├─pve-data
├─pve-vm--100--disk--1
├─pve-vm--101--disk--0
└─pve-vm--102--disk--0
sdb
├─sdb1 ext4 c924868d-a677-4d83-a8aa-f585445c790c 205.8G 8% /media/emaildata
├─sdb2 swap swap c579f3e0-8df8-413c-af2a-8738ca30aa55
├─sdb3
├─sdb4 ext4 5a70c0cb-4420-4142-bcf0-e72c984ec79e 877.8M 0% /media/sdb4a
├─sdb5 ext4 emaildata ce2cd49e-6b9e-495a-9e42-33a99b17ab50 1.1T 8% /media/sdb5a
└─sdb6 ext4 backup space e51f86ef-fc67-468d-bba6-b1eae0be705e 131.4G 48% /media/sdb6a
 

Attachments

  • fdisk-l.txt
    3.9 KB · Views: 3
  • LSBLK.TXT
    1.7 KB · Views: 2
Last edited:

oguz

Proxmox Staff Member
Staff member
Nov 19, 2018
2,833
316
88
hi,

so looking at the output i realize:

Code:
sdb                                                                                                        
├─sdb1                       ext4                     c924868d-a677-4d83-a8aa-f585445c790c    205.8G     8% /media/emaildata
├─sdb2                       swap        swap         c579f3e0-8df8-413c-af2a-8738ca30aa55                 
├─sdb3                                                                                                     
├─sdb4                       ext4                     5a70c0cb-4420-4142-bcf0-e72c984ec79e    877.8M     0% /media/sdb4a
├─sdb5                       ext4        emaildata    ce2cd49e-6b9e-495a-9e42-33a99b17ab50      1.1T     8% /media/sdb5a
└─sdb6                       ext4        backup space e51f86ef-fc67-468d-bba6-b1eae0be705e    131.4G    48% /media/sdb6a

the disk /dev/sdb you're trying to mount is already mounted in /media/ directory (probably your desktop environment mounted the partitions automatically)

for your reference next time when you're mounting a disk, you need to give the name of the partition and not the whole disk. (i made a mistake while telling you the command, sorry!)
so on your screenshot you're doing mount /dev/sdb /datadrive but it should be mount /dev/sdbX /datadrive where X is the number of the partition you want to mount (can be found in the outputs of the commands you've sent)

at the moment though you just need to browse to the /media directory to access your data, since it's already mounted :)
 

aquananu

New Member
Aug 12, 2020
7
0
1
46
HI, Oguz

Thanks for your reply.

Please note that the HDD partitions are mounted in the Node not in the VM, the media directory is visible only in terminal of the node. the output of the node is pasted as text in the above reply whereas the output of command in the VM is attached as txt files

Kindly advise how to share them in the VM, for eg sdb5 needs to be available to VM101 and sdb6 needs to be avialable to VM102

Additional question
Also advise if there is a possibility to boot a VM from sdb1 as its is a fully configured and working installation of Ubuntu
 

oguz

Proxmox Staff Member
Staff member
Nov 19, 2018
2,833
316
88
oh i see, sorry!

Kindly advise how to share them in the VM, for eg sdb5 needs to be available to VM101 and sdb6 needs to be avialable to VM102

you can pass the partitions inside the VM:
qm set VMID --scsi[N] /dev/sdb5 will pass the partition inside the VM as a disk. (replace [N] with the next available slot number)

be aware when you do this you will not be able to perform migrations to this VM since it has a physical dependency
 

aquananu

New Member
Aug 12, 2020
7
0
1
46
dear Oguz

qm set VMID --scsi[N] /dev/sdb5 this to be executed in terminal of the VM or the node
 

oguz

Proxmox Staff Member
Staff member
Nov 19, 2018
2,833
316
88
it should be executed on the node, to set the option for the VM
 

aquananu

New Member
Aug 12, 2020
7
0
1
46
Thanks finally i was able to pass partitions to the vm.

kindly advise if the vm can be booted from the hdd sdb1 partition, i trid but it says not a bootable disk, whereas the hdd has been pulled out from a working system booting from this hdd
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE 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 your own in 60 seconds.

Buy now!