Is there any way to generate a compressed image file on Linux that dotNet Disk Imager can write to a drive? If not compressed, is there a way to generate an uncompressed image file on Linux?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Never mind - I figured it out. The compressed image is created using normal DEFLATE, so I can take an uncompressed image and "zip" it into a compressed image for dotNetImager. I can create a multi-partition image and zip it up using the bash script below. This same approach could be extended to more partitions, if needed.
# run as "sudo"
OUTPUT=$HOME
TARGET=zipped.img
# Delete old image, if it exists
rm -rf $OUTPUT/test.img
# Generate a 4M * 1024 file - 4GB
dd if=/dev/zero of=$OUTPUT/test.img bs=1024 count=0 seek=4M
# Mount the image as a loop device, and create two partitions (DOS and EXT4)
losetup /dev/loop0 $OUTPUT/test.img
parted /dev/loop0 --script rm 1
parted /dev/loop0 --script rm 2
parted /dev/loop0 --script mklabel msdos
parted /dev/loop0 --script mkpart primary fat32 0% 128MiB
parted /dev/loop0 --script mkpart primary ext3 128MiB 100%
sleep 10
mkfs.msdos /dev/loop0p1
mkfs.ext4 /dev/loop0p2
# Fill the first partition
mkdir -p /mnt/sdcard
mount /dev/loop0p1 /mnt/sdcard/
cd /mnt/sdcard
# Copy files to the partition
cd ..
umount /mnt/sdcard
# Fill the second partition
mount /dev/loop0p2 /mnt/sdcard
cd /mnt/sdcard
# Copy files to the partition
cd ..
umount /mnt/sdcard
# Remove the loop device
losetup -d /dev/loop0
# Remove the previous target (if it exists)
rm -rf $OUTPUT/$TARGET.img
# Zip up the image into a compressed image
zip $OUTPUT/$TARGET.img $OUTPUT/test.img
# Remove the intermediate image
rm -rf $OUTPUT/test.img
Last edit: Henry Coakley 2016-11-23
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there any way to generate a compressed image file on Linux that dotNet Disk Imager can write to a drive? If not compressed, is there a way to generate an uncompressed image file on Linux?
Hello, I'm not a Linux expert, but AFAIK there is dd command described here. You may want to try it out.
Is that how dotNet Imager creates a compressed image - gzip?
I'm not sure what you're asking, what do you mean by "Is that how dotNet Imager creates a compressed image - gzip?" ?
Never mind - I figured it out. The compressed image is created using normal DEFLATE, so I can take an uncompressed image and "zip" it into a compressed image for dotNetImager. I can create a multi-partition image and zip it up using the bash script below. This same approach could be extended to more partitions, if needed.
Last edit: Henry Coakley 2016-11-23