[SOLVED] raw disk use whole disk

teppot

New Member
May 18, 2023
7
0
1
How do I get proxmox to use whole disk as raw disk image? gui doesn't have option to use all and when I tested, I managed to set more than real hdd was and it didn't work. Do I need to go shell and do magic there?
 
Does your link instructions slow down like that?
It depends on your USB connection...
Attaching the USB to the VM works different to than on the host.
Imho. You should ignore the raw file and pass the disk through as described in the article.
 
I did NOT try it, but using a vm with a raw image and changing the path from the image file to the /dev/sdX in /etc/pve/qemu-server/xxx.conf
should work.
 
Yeah, thanks, getting on tracks here, but instructions was little bit unclear. Do I unmount the filesystem (lets say its /dev/sdX1) on host when using on VM? Because it seems that when I create files etc. on VM side, they not show on host until I boot whole system. What I did wrong? What I was reading that you can use same disk same time on both sides? Wrong?
 
Yeah, thanks, getting on tracks here, but instructions was little bit unclear. Do I unmount the filesystem (lets say its /dev/sdX1) on host when using on VM? Because it seems that when I create files etc. on VM side, they not show on host until I boot whole system. What I did wrong? What I was reading that you can use same disk same time on both sides? Wrong?
Filesystems are not designed to be used on multiple computers at the same time, because it is not possible to connect drives to two computer at the same time. This will result in corrupted filesystems and files, as each system caches data and assumes they are the only one writing to it.
Use a network share (NFS or SMB or SPICE webDAV) to share files between host and VM(s). Or look into setting up VirtioFS or 9p (which work via the virtual PCI bus).
 
  • Like
Reactions: Dunuin
Filesystems are not designed to be used on multiple computers at the same time, because it is not possible to connect drives to two computer at the same time. This will result in corrupted filesystems and files, as each system caches data and assumes they are the only one writing to it.
Use a network share (NFS or SMB or SPICE webDAV) to share files between host and VM(s). Or look into setting up VirtioFS or 9p (which work via the virtual PCI bus).
Yes, but this says nothing that you have to unmount that drive on host?

https://pve.proxmox.com/wiki/Passthrough_Physical_Disk_to_Virtual_Machine_(VM)

I see that after reboot files appears on host too. Didn't yet try to unmount/mount back to see if its same result. Just want to make it work right from beginning before starting do serious data transfer. Maybe I go path to unmount it and see what happens.
 
Yes DEFINITLY unmount on host.

Think two people (Systems) recording to the same tape (Filesystem) at the same time, you WILL get a broken Filesystem if you have mounted it on multiple Systems at the same time.

And now you know why it is not offered in the Proxmox Gui ;)

Sorry i should have mentioned that
 
Last edited:
Yes DEFINITLY unmount on host.

Think two people (Systems) recording to the same tape (Filesystem) at the same time, you WILL get a broken Filesystem if you have mounted it on multiple Systems at the same time.

And now you know why it is not offered in the Proxmox Gui ;)

Sorry i should have mentioned that
Yeah, thats why I would go rather raw disk file route than sharing physical disk to VM. Only problem is how I get file size to fill as much as possible, actually whole disk if its possible. This not much difference from sharing physical disk imo.

disk file not mounted automatic on host, but can be mounted via loop device, if ever needed. And file acts same as hard drive on VM side.

You see image, you can only write some number there, I actually created too big and it didn't work at all. I want create around 4T size disk.
 

Attachments

  • Screenshot_64.png
    Screenshot_64.png
    13.6 KB · Views: 41
Why would you want to use a raw disk in the first place? One usecase is to use an existing disk with an installed system inside a vm, another to install a system inside a vm to be later used in a physical machine.

I use ZFS on all my Proxmox Servers, plus ceph on clusters. My second choice would be lvm / lvm-thin or qcow2 images.

@teppot what do you want to achieve?
 
Last edited:
By the way...you can also not mount that raw image disk on host + guest at the same as this would be the same, also corrupting your data. So I also don't see the point. If you want to mount that disk on host + guest just disk passthrough it into a NAS VM or mount it on the host and then use virtfs/bind-mounts.
 
Why would you want to use a raw disk in the first place? One usecase is to use an existing disk with an installed system inside a vm, another to install a system inside a vm to be later used in a physical machine.

I use ZFS on all my Proxmox Servers, plus ceph on clusters. My second choice would be lvm / lvm-thin or qcow2 images.

@teppot what do you want to achieve?
Because usb emulation slows down disk i/o big, that I told before, output was like 20MB/s, pretty slow. I want keep my proxmox side clean as possible, so in case if I some reason need to install all again (no need to try to remember what every service I configured host side). I share SAMBA from VM to other machines. Disks are usb3 port and I dont have physical room or sata connections on host computer so have to use usb port.

Host no need to see these disks at all.

It would be easiest way via raw disk image (file) if I only could get it size of disk, that is the problem. On GUI you can only put value on field and it doesn't tell what is maximum, you can enter what size you want and if its too big, it not work.

I put every minor service on separate vm so if one fail, no need to start figuring everything from scratch.
 
Seems that solution is create raw disk image manually. First create tiny raw disk image via GUI, let say like 2G, then go proxmox console and find that file location (/mnt/pve/YOURDRIVENAME/images) go that directory (cd) and "dd if=/dev/zero of=newrawimage.raw bs=16M status=progress", then "mv newrawimage.raw NAMEOFYOUR_GUI_CREATED_RAW"

I chose to leave 2G free space to drive if there is something what need some free space, that comes automatic, if your GUI created file is 2G.

Also seems that gui created raw file doesn't really take space from hard drive until is used, this is little bit awkward because its maybe possible that you mistakenly use space what is "free" but still isn't. I tought that raw file is raw file and is allocated once its created?

The creation of dd image takes little bit time so taking long coffee break and let see if this work. At least fast test with smaller file worked ok.
 

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!