HI! I’m trying to make raw lxc container for making bootable Armbian SD card.
I tested dd “zeroing” on SD in host system and it works as expected - SD card was zeroed just as planed.
Then I tried to create privileged lxc container and made some changes in container’s config file:
creating container:
# lxc-create -n ArmbianPriv -t download -- --dist debian --release bookworm --arch amd64
containers conf file looks like this:
# Template used to create this container: /usr/share/lxc/templates/lxc-download
# Parameters passed to the template: --dist debian --release bookworm --arch amd64
# Template script checksum (SHA-1): 78b012f582aaa2d12f0c70cc47e910e9ad9be619
# For additional config options, please look at lxc.container.conf(5)
# Uncomment the following line to support nesting containers:
#lxc.include = /usr/share/lxc/config/nesting.conf
# (Be aware this has security implications)
# Distribution configuration
lxc.include = /usr/share/lxc/config/common.conf
lxc.include = /usr/share/lxc/config/userns.conf
lxc.arch = linux64
# Container specific configuration
lxc.rootfs.path = dir:/var/lib/lxc/armbianDLNA/rootfs
lxc.uts.name = armbianDLNA
# Network configuration
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:27:78:09
#Permissions to write to SD card
lxc.cgroup.devices.allow = b 8:96 rwm #on host SD card is /dev/sdg
lxc.mount.entry = /dev/sdg /dev/sdg none bind,optional,create=file
lxc container is starting and I cat attache to it succesfull, BUT when I make dd to SD card I recieve strange error “no space left on device”:
#from container:
root@ArmbianPriv:/# dd if=/dev/zero of=/dev/sdg
dd: writing to '/dev/sdg': No space left on device
977+0 records in
976+0 records out
499712 bytes (500 kB, 488 KiB) copied, 0.00362073 s, 138 MB/s
I also noticed that fdisk and parted is seeing my /dev/sdg (where SD card is) different:
#from container:
root@ArmbianPriv:/# /usr/sbin/fdisk -l /dev/sdg
Disk /dev/sdg: 488 KiB, 499712 bytes, 976 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
from host parted /dev/sdg print:
Model: Generic STORAGE DEVICE (scsi)
Disk /dev/sdg: 31,9GB
Sector size: 512B/512B
Table: msdos
Flags:
Номер Начало Конец Размер Тип Файловая система Флаги
1 4194kB 1707MB 1703MB primary ext4
What am i doing wrong? Why SD card from container and from host looks different? What I have to do to fix that error?