How to modify (add files or directories) to the qemu-img created raw disk file?
1
vote
1
answer
1101
views
How to add files or directories to the
-img
created raw disk file. For example. I use qemu-img create -f raw disk.raw 1G
to generate a .raw
file. I want to copy some /bin
, /usr
directories to the .raw
file.
I have tried the following commands. With the reference to here
qemu-img create -f raw disk.raw 1G
mkdir /image
losetup /dev/loop0 disk.raw
fdisk /dev/loop0
> n
> p
> ENTER
> ENTER
> ENTER
> a
> w
kpartx -a /dev/loop0
mount /dev/mapper/loop0p1 /image
However, the last commands output the following error messages: : /image: wrong fs type, bad option, bad superblock on /dev/mapper/loop0p1, missing codepage or helper program, or other error.
Asked by Zhaoyang
(43 rep)
Nov 21, 2023, 09:31 AM
Last activity: Nov 21, 2023, 10:42 AM
Last activity: Nov 21, 2023, 10:42 AM