OpenVZ Forum


Home » General » Support » openvz7 Add virtual disk to container
openvz7 Add virtual disk to container [message #53164] Thu, 08 February 2018 22:14 Go to next message
gral is currently offline  gral
Messages: 34
Registered: May 2006
Member

Hello, im trying to add a extra virtual disk to a container but once i've created it i cant format / mount it

I created it as follow;

prlctl set 1d635d9d-1e4d-4799-ba40-c11683abxxxxx --device-add hdd --iface scsi --subtype virtio-scsi

Seems to be attached;

prlctl list -i 1d635d9d-1e4d-4799-ba40-c11683axxxxx | grep hdd
hdd0 (+) scsi:0 image='/vz/private/1d635d9d-1e4d-4799-ba40-c11683axxxxx/root .hdd' type='expanded' 10240Mb mnt=/ subtype=virtio-scsi
hdd1 (+) scsi:1 image='/vz/private/1d635d9d-1e4d-4799-ba40-c11683axxxxx/hard disk3.hdd' type='expanded' 65536Mb subtype=virtio-scsi


But once i enter to the container to mount the hdd, i cant initialize it , i receive ;

root@CT2# mkfs.ext4 /dev/ploop53294
mke2fs 1.42.9 (28-Dec-2013)
/dev/ploop53294: Operation not permitted while setting up superblock

Is there something that i dont do it ?

Thanks!

# uname -a
Linux vpsh2.xxxxxxxxx.net 3.10.0-693.1.1.vz7.37.30 #1 SMP Wed Nov 15 20:42:09 MSK 2017 x86_64 x86_64 x86_64 GNU/Linux




Argentina
--Vz--
Re: openvz7 Add virtual disk to container [message #53166 is a reply to message #53164] Fri, 09 February 2018 09:43 Go to previous messageGo to next message
vaverin is currently offline  vaverin
Messages: 708
Registered: September 2005
Senior Member
Dear gral,

just try to mount /dev/ploop53294p1 inside contaienr
The command creates 2nd ploop device and partition with ext4 filesystem.

CT-c4cd2eb2 /# mount /dev/ploop21531p1 /media/
/dev/ploop21531p1 on /media type ext4 (rw,relatime,data=ordered,balloon_ino=12)

CT-c4cd2eb2 /# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/ploop32162p1 9.8G 660M 8.6G 7% /
...
/dev/ploop21531p1 63G 53M 60G 1% /media

You still have no direct access to device inside container,
its filesystem is created from host.

Thank you,
Vasily Averin
Re: openvz7 Add virtual disk to container [message #53167 is a reply to message #53164] Fri, 09 February 2018 16:57 Go to previous messageGo to next message
gral is currently offline  gral
Messages: 34
Registered: May 2006
Member

Hello Vasily, thanks for you reply , inside the container i received the following;

[root@CT2~]# mount /dev/ploop53294 /media
mount: unknown filesystem type '(null)'

but as you said , i could give a filesystem from the host , and then mount it once inside the container .

Thanks!!



Argentina
--Vz--
Re: openvz7 Add virtual disk to container [message #53169 is a reply to message #53167] Mon, 12 February 2018 07:29 Go to previous messageGo to next message
vaverin is currently offline  vaverin
Messages: 708
Registered: September 2005
Senior Member
Dear gral,
you need to mount not whole disk but its partition

please try to use
mount /dev/ploop53294p1 /media
Re: openvz7 Add virtual disk to container [message #53180 is a reply to message #53164] Fri, 16 February 2018 22:58 Go to previous message
gral is currently offline  gral
Messages: 34
Registered: May 2006
Member

Hi, i have new problems with the virtual disk .

After a reboot the CT doesnt start again; i receive:

# vzctl start 1d635d9d-1e4d-4799-ba40-c11683axxxxx
Starting Container ...
Mount image: /vz/private/1d635d9d-1e4d-4799-ba40-c11683axxxxx/root.hdd
Mount image: /vz/private/1d635d9d-1e4d-4799-ba40-c11683axxxxx/harddisk3.h dd
Failed to mount image: Error in ploop_mount_image (ploop.c:2401): Image /vz/private/1d635d9d-1e4d-4799-ba40-c11683axxxxx/harddisk3.h dd/root.hds already used by device /dev/ploop53294 [21]
Unmount image: /vz/private/1d635d9d-1e4d-4799-ba40-c11683axxxx/root.hdd


If i remove the line refer to the (extra) DISK on the ve.conf the container start well.

But i cant even remove the virtual disk , trying to remove it i receive;

# prlctl set 1d635d9d-1e4d-4799-ba40-c11683axxxxx --device-del hdd1
Remove the hdd1 device.
Unable to commit CT configuration: PRL_ERR_VZCTL_OPERATION_FAILED (Details: Unable to find first partition for /dev/ploop53294
)
Failed to configure the virtual machine.


I could remove it manually , but i wouldn't like to have this problem in a production environment , what im doing wrong ?


tried:

# ploop check --force /vz/private/1d635d9d-1e4d-4799-ba40-c11683xxxxx/harddisk3.hd d/root.hds
Reopen rw /vz/private/1d635d9d-1e4d-4799-ba40-c11683axxxxx/harddisk3.h dd/root.hds
Error in ploop_check (check.c:580): Dirty flag is set


Thanks again


Argentina
--Vz--
Previous Topic: The certificate for https://download.openvz.org/ is broken/expired
Next Topic: download.openvz.org is down
Goto Forum:
  


Current Time: Tue Mar 19 11:52:22 GMT 2024

Total time taken to generate the page: 0.02517 seconds