making one disk image from two

Polytropon freebsd at edvax.de
Thu Jan 7 14:12:17 UTC 2021


On Thu, 7 Jan 2021 14:03:07 +0000, tech-lists wrote:
> If one were to make say a 16GB image, format it to msdos, then make a 
> 64GB image, format it to freebsd, then concatenate[1] the images to make 
> one image, would it be seen as one image with two partitions?
> 
> thanks,
> 
> [1] # cat freebsd.img >> msdos.img

Hmmm... it doesn't look like this is possible in that simple way.
A partition table would be needed to reflect that the disk image
contains two partitions. Depending on if this should be MBR or GPT,
the approach is quite different. However, you could create a disk
image of a fixed size via mdconfig pseudo-device (virtual nodes),
i. e., create a "null file" with dd first, then use mdconfig to
make it impersonate a disk device file, and then use it as such:
partition it, initialize the two created partitions (one FreeBSD,
probably UFS, the other one FAT / msdosfs), then unload the two
previous images' contents into the newly created and mounted ones
(or dd them, if the size information is exact), so those will be
reflected in the original intention of having one disk image
containing two partitions and the appropriate partition table.


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list