Skip to main content
without mount to title
Link

Running How to run mkfs on file image partitions without mounting?

Source Link
Paul Knopf
  • 1.4k
  • 3
  • 16
  • 26

Running mkfs on file image partitions

I am creating an empty file...

dd if=/dev/zero of=${SDCARD} bs=1 count=0 seek=$(expr 1024 \* ${SDCARD_SIZE})

...then turning it into an drive image...

parted -s ${SDCARD} mklabel msdos

...and creating partitions on it

parted -s ${SDCARD} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED})
parted -s ${SDCARD} unit KiB mkpart primary $(expr  ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED}) $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED} \+ $ROOTFS_SIZE)

How do I use mkfs.ext and mkfs.vfat without mounting this image?