Created
April 25, 2019 19:29
-
-
Save kumbasar/49906cb704ce9213c972a3e008c74c0c to your computer and use it in GitHub Desktop.
How To Create a NTFS Image File in Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
image="test.img" | |
label="test" | |
mntdir=`mktemp -d` | |
sudo dd status=progress if=/dev/zero of=$image bs=6M count=1000 && sync | |
echo 'type=7' | sudo sfdisk $image | |
LOOPMOUNT=`sudo losetup --partscan --show --find ${image}` | |
echo $LOOPMOUNT | |
sudo mkfs.ntfs -Q -v -F -L ${label} ${LOOPMOUNT}p1 | |
sudo mount ${LOOPMOUNT}p1 ${mntdir} | |
# Now you can put some files to ${mntdir} | |
sudo umount ${mntdir} | |
sudo losetup -d ${LOOPMOUNT} |
Author
kumbasar
commented
Apr 25, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment