iximiuz / docker-to-linux

Make bootable Linux disk image (ab)using Docker
https://iximiuz.com/en/posts/from-docker-container-to-bootable-linux-disk-image/
669 stars 93 forks source link

disk size issue #6

Closed fmieres closed 4 years ago

fmieres commented 4 years ago

Hi!,
I've been having trouble with these steps using a bigger disk size. Just changing count to 2 in sudo dd if=/dev/zero of=linux.img bs=${IMG_SIZE} count=2 break the image at boot time.

My custom debian image is a little bigger, like 2.5gb , but i've checked using the same debian:stretch used in this examples and when i try to create a bigger disk size, it breaks. (it works flawlessly with sudo dd if=/dev/zero of=linux.img bs=${IMG_SIZE} count=1

I've would like to know more details about the sizes in the bootable part of the disk so i can change virtual disk size at will.

fmieres commented 4 years ago

ive solved my own problem, gonna write it here for anyone that havent worked much with sfdisk and have the same problem.

sudo dd if=/dev/zero of=linux.img bs=${IMG_SIZE} count=XX where XX is the amount of GB the disk (or image file) has.

the second one is inside the commands given to sfdisk , size parameter. linux.img1 : start=2048, size=size, type=83, bootable where size is as follows :

Since i dont know how partitions works at all, ive multiplied final size by amount of gb so ive got something like : ( XX * 2 * 1024 * 1024 ) - 2048

so for 4 gb image image file partition, it should be linux.img1 : start=2048, size=8386560, type=83, bootable

Im sure this may not be the appropiate solution, but it works!