[lxc-users] Its possible to add a xen virtual device to an lxc container?

Márcio Castro marciomouracastro at gmail.com
Fri Jan 25 16:21:29 UTC 2019


Hi Fajar,

Thank you very much for your response, and sorry - I think i know very
little about the linux operating system, and I never added a disk in an
environment with Linux Container.

I made several attempts, including a partition of one of my disks, but I
did not succeed.

So I decided to simplify my problem, trying this time with a virtual disk.

A - Quick guess, /dev/xvda did not exist before you ran dd?
No.

B - Do you know the difference between a file and block device? If my guess
is correct, you have just created a regular file /dev/xvda. That is not a
xen virtual device.
No, I do not know exactly the difference.

Can you help me with a litle explanation or direct me to some website with
more information about it?


What i do:

https://www.oreilly.com/library/view/linux-device-drivers/0596000081/ch01s03.html

"Like char devices, block devices are accessed by filesystem nodes in the
/dev directory. A block device is something that can host a filesystem,
such as a disk."

I understand that what aI need is a block device. I want to create a
virtual disk in the host, and in the container, i need to see this as a
disk. I need to format the virtual disk in the container. And to implement
RAC, i need a shared virtual disk, because this will me acessed by n
containers.


mmoura at mmoura-W350STQ-W370ST:~/DiscosVirtuais$ pwd
/home/mmoura/DiscosVirtuais

dd if=/dev/zero of=1GB_HDD.img bs=1M count=1024
fdisk 1GB_HDD.img
mkfs.ext4 1GB_HDD.img
sudo losetup -Pf --show 1GB_HDD.img

mmoura at mmoura-W350STQ-W370ST:~/DiscosVirtuais$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop24   7:24   0     1G  0 loop

sudo mount -t ext4 /dev/loop24 /mnt

mmoura at mmoura-W350STQ-W370ST:~/DiscosVirtuais$ df -h
Sist. Arq.      Tam. Usado Disp. Uso% Montado em
/dev/loop24     976M  2,6M  907M   1% /mnt

lxc start ol7testedisc

mmoura at mmoura-W350STQ-W370ST:~/DiscosVirtuais$ lxc config device add
ol7testedisc loop24 unix-block path=/dev/loop24
Dispositivo loop24 adicionado a ol7testedisc


-- In the container:

[root at ol7testedisc ~]#lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdb      8:16   0 698.7G  0 disk
`-sdb1   8:17   0 698.7G  0 part /dev/loop24
loop24   7:24   0     1G  0 loop

[root at ol7testedisc ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       687G  109G  544G  17% /
none            492K     0  492K   0% /dev
udev            7.8G     0  7.8G   0% /dev/tty
tmpfs           100K     0  100K   0% /dev/lxd
tmpfs           100K     0  100K   0% /dev/.lxd-mounts
tmpfs           7.8G     0  7.8G   0% /dev/shm
tmpfs           7.8G  8.1M  7.8G   1% /run
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
tmpfs           1.6G     0  1.6G   0% /run/user/54321

[root at ol7testedisc ~]# mount -t ext4 /dev/loop24 /mnt
mount: /dev/loop24 is already mounted or /mnt busy


And im loss...






-- 
Atenciosamente,

Márcio de Figueiredo Moura e Castro


Oracle Real Application Clusters 11g Certified Implementation Specialist
Oracle 11g DBA OCP
Oracle Exadata 11g Certified Implementation Specialist
Oracle Linux Certified Implementation Specialist
OPN Certified Specialist
Oracle 10g DBA OCA
Oracle PL/SQL Developer OCA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20190125/61aa7580/attachment.html>


More information about the lxc-users mailing list