VM access to physical block device

billmc

New Member
Mar 15, 2009
4
0
1
Hello,

I'm new to both Proxmox and OpenVZ. I was hoping someone could help me with a problem I'm having. I have created a container running Ubuntu 8.04. I want this particular container to have full rw access to a physical hard drive on the system, my intention is to set this up as a local mirror for Ubuntu/Debian. Following the directions from the OpenVZ user's guide, which I down loaded from the openvz site, I've issued the following command:


:~# vzctl set 101 --devices b:8:all:rw --save
Setting devices
Saved parameters for CT 101

I checked to see if I had access to the device using fdisk ( the users manual actually creates another partition, but I have one single partition already dedicated to the mirror.) This is what happens. The /dev directory does not seem to have any disks, can someone tell me where I've gone wrong?

root@mirror:~# fdisk /dev/sdb

Unable to open /dev/sdb
root@mirror:~# ls /dev
agpgart log midi2 ptyp4 ram11 rmidi1 tty1 ttyp7
audio loop0 midi3 ptyp5 ram12 rmidi2 tty2 ttyp8
audio1 loop1 mixer ptyp6 ram13 rmidi3 tty3 ttyp9
audio2 loop2 mixer1 ptyp7 ram14 sequencer tty4 ttypa
audio3 loop3 mixer2 ptyp8 ram15 shm tty5 ttypb
audioctl loop4 mixer3 ptyp9 ram16 simfs tty6 ttypc
console loop5 mpu401data ptypa ram2 smpte0 tty7 ttypd
core loop6 mpu401stat ptypb ram3 smpte1 tty8 ttype
dsp loop7 null ptypc ram4 smpte2 tty9 ttypf
dsp1 mem port ptypd ram5 smpte3 ttyp0 urandom
dsp2 midi0 ptmx ptype ram6 sndstat ttyp1 xconsole
dsp3 midi00 pts ptypf ram7 stderr ttyp2 zero
fd midi01 ptyp0 ram ram8 stdin ttyp3
full midi02 ptyp1 ram0 ram9 stdout ttyp4
initctl midi03 ptyp2 ram1 random tty ttyp5
kmem midi1 ptyp3 ram10 rmidi0 tty0 ttyp6
root@mirror:~#


Thanks,
Bill
 
Hi!
I've tried but I cannot access to the disk.

TestMC:/dev# ls -l | grep sdb brw-rw---- 1 root disk 8, 16 Sep 9 14:53 sdb brw-rw---- 1 root disk 8, 17 Sep 9 14:53 sdb1

TestMC:/dev# mount -t ext3 sdb1 /media/tmpdsk/ mount: block device /dev/sdb1 is write-protected, mounting read-only mount: cannot mount block device /dev/sdb1 read-only

Why?
 
Yes, there's a EXT3 partition.
I've tried some dirty hack, like mount /proc, copy /dev of root machine in /var/vz/VMID/private/dev and /var/vz/VMID/root/dev, yes I know it can be a silly thing..but nothing.

I cannot access to device also with a basic cat or cfdisk...Something about permission on device??

Thanks
 
Update:
I've resolve that stupid problem...It's a wrong parameter..
vzctl set 101 --devices b:XXX:all:rw --save

The XXX number was wrong..Now that works perfectly....
 

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!