[SOLVED] [Storage]how to add an existing disk with data to my VM(NFS)

mum1989

Active Member
Dec 5, 2017
5
0
41
35
france
Hello,
my SRV is on Proxmox 5.1 (J1900 + 4Go Ram)
two 1TO disk RAID1 ( root / and /home with data) (proxmox + VM debian on it) (/dev/sda and /dev/sdc)
one 2To Disk with already data on it (ext4 /dev/sdb)

capture-png.6501

my fstab and my storage.cfg :
Code:
cat /etc/fstab
# /etc/fstab: static file system information.
#
##
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/vg--red-vl--racine /               ext4    errors=remount-ro 0       1
# (...)
/dev/mapper/vg--red-vl--data /home           ext4    defaults        0       2
/dev/mapper/vg--red-vl--swap none            swap    sw              0       0
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0


cat /etc/pve/storage.cfg

dir: local
        path /var/lib/vz
        content rootdir,iso,images,vztmpl
        maxfiles 0

dir: data
        path /home
        content rootdir,images,iso,vztmpl,backup
        maxfiles 0
        shared 1

I thinks I should add
Code:
dev/sdb /media/data             ext4    errors=remount-ro 0       1

and at storage.cfg

Code:
dir: 2todata
        path /media/data
        content
        maxfiles 0
        shared 1

but i'm not sure, and what I can put in "content line in storage.cfg

And my 2to hard drive is not empty, I don't want remove data on it .

Thanks
 

Attachments

  • Capture.PNG
    Capture.PNG
    23.5 KB · Views: 1,263
I thinks I should add
Code:
dev/sdb /media/data ext4 errors=remount-ro 0 1

That looks almost right, you may have the ext4 FS on a partition though, so it should be /dev/sdb1 (or something similar)

After you added this entry you should be able to mount it via:
Code:
mount /media/data
If this works your good to go.

Now, the storage entries are merely tracking things. I.e., where PVE can put disk images of virtual machines, where ISO files or container templates for VM/CT creation may be, which storage may be used for backups, and so on. If you add, or delete, a storage through Datacenter->Storages, the storage and its data itself won't get touched, you only add or remove the tracking information.

So for you it may be the easiest way to add the fstab entry, try if you can mount it and all works just fine and then add a "Directory Storage" through the webUI.

but i'm not sure, and what I can put in "content line in storage.cfg

This is what PVE should be allowed to put on, VM/CT disks, backups, templates. If you do not tick on "backup" when adding a storage then it won't show up in the backup dialog and you do not allow anyone to put backups at this storage, this can make sense in intermediate setups, or if a remote storage only for backups gets added.
For more information you may want to read https://pve.proxmox.com/pve-docs/chapter-pvesm.html#_common_storage_properties
 
  • Like
Reactions: mum1989
Hi,

You have to add the disk to the VM not to the host.

For this you have to edit the <VMID>.conf
and add this line.

virtioX: /dev/sdb or
scsiX: /dev/sdb

this first string is for the storage bus.
The X has to be replayed by a number, but this number has to be unique in your config.

The disk is exclusive for this VM and can't be used (mounted) by any other VM or Host.
 
  • Like
Reactions: mum1989
mmmm
SO I don't need to add sdb1 to fstab on proxmox host ?

And so at /etc/pve/local/qemu-server/100.conf :
scsi0: data:100/vm-100-disk-2.qcow2,size=850G
scsi1: /dev/sdb

I should add /dev/sdb and not /dev/sdb1 it's ok ?

(sdb is on EXT4 fs)
 
Last edited:
As I wrote if you like to use this disk exclusive on this VM.
Yes this is the way.

You have to mount it in the VM as a normal disk.
 
Thanks for answer.
Finally, I will probably add more VM, and I want tCapture.PNG o use my 2To disk to all of them.
So
I added :
Code:
dev/sdb /media/data ext4 errors=remount-ro 0 1
To my fstab proxmox host.
And I added, in storage.cfg
Code:
dir: dd2to
        path /media/data
        content
        maxfiles 0
        shared 1
Now I'am here :
upload_2017-12-18_12-18-11.png



And to add on my VM (<VMID>.conf )
I need to add :
virtioX: /dev/sdb or
scsiX: /dev/sdb

Should I restart my proxmox host after this ?

Thanks, I am a newbie on Proxmox.
 
If you mount this disk on the host you can't use it this way.

See the post from t.lamprecht
 
Mmmm, so to use an existing Hard Disk with data on multiple vm(witch is probably specfic and not usual), I need to use NFS server on proxmox host or somethink like that ? (
(Open-iSCSI)

The doc is good, but it explain only on Proxmox side, not on VM https://pve.proxmox.com/pve-docs/chapter-pvesm.html#_directory_backend
so I don't understand sorry :/

(The easier option is for me to move my current 2To disk to another but I don't have another now)
THanks
 
hi, another newbie here,

i have tried as per the post from t.lamprecht but getting error mount point doesn't exists

1597239116152.png

1597239146044.png

this is the disk shown, sdb has partitions and data in it, cannot format the same, need to access the same kindly help

1597239228947.png

content of /dev folder

1597239266242.png

appreciate your help as i have iso on the drive
 
Last edited:
does the mountpoint (i.e. the directory where you try to mount /dev/sdb1 on) '/media/emaildata' exist?
`stat /media/emaildata`

else create it:
`mkdir -p /media/emaildata`

and try again

if this does not help - please open a new thread (always do so instead of replying to 3 year old threads) - thanks!
 
hi, another newbie here,

i have tried as per the post from t.lamprecht but getting error mount point doesn't exists

View attachment 19146

View attachment 19147

this is the disk shown, sdb has partitions and data in it, cannot format the same, need to access the same kindly help

View attachment 19148

content of /dev folder

View attachment 19149

appreciate your help as i have iso on the drive
SRY to tell but you misstyped the sdb 1 where you wanted to step in that folder... thats why it cannot open .. sbd is not equal sdb :)
 
Hi,

You have to add the disk to the VM not to the host.

For this you have to edit the <VMID>.conf
and add this line.

virtioX: /dev/sdb or
scsiX: /dev/sdb

this first string is for the storage bus.
The X has to be replayed by a number, but this number has to be unique in your config.

The disk is exclusive for this VM and can't be used (mounted) by any other VM or Host.
Cristal clear for me, i got to this post by searching on google how to mount a physical hard disk to proxmox vm, for me it was as simple as add in my vm 104 config teh line

sata1: /dev/sda

then turned off n on my vm and it was gtg :)

altho i do have a question, whats the diference on using scsi, sata, ide or virtio?
 

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!