1.2.0 • Published 8 years ago
mount-img v1.2.0
mount-img
Easily mount a .img file on Linux
npm install -g mount-imgUsage
Use it just as you would mount but instead of passing a /dev device
pass a disk image file.
mount-img my-image.img mntIf you want to mount a specific partition from the image you can use the -p parameter.
# mount partition 5
mount-mig my-image.img mnt -p 5Per default it just mounts the first one.
Creating image files
To create raw image files you can use fallocate
# make a ~1gb image
fallocate my-image.img -l 1000000000Then using fdisk you can make a partition table
# to simply make a single partition, follow this
fdisk my-image.img
n<enter>
<enter>
<enter>
<enter>
w<enter>You can also make more than one partition or make one bootable etc.
Then format the partition using ext4
# note the Start sector
fdisk -l my-image.img
# change 2048 to the Start sector (usually 2048)
mkfs.ext4 -F -E offset=$((2048 * 512)) my-image.imgYou can now mount this image using mount-img
mount-img my-image.img mntHappy mounting!
License
MIT