|
|
|
|
|
by peterwwillis
2963 days ago
|
|
Yes, you can use losetup. ~# dd if=/dev/zero of=image.img bs=1M count=100
~# LODEVICE=$(losetup --find --show image.img)
~# fdisk $LODEVICE
~# losetup -d $LODEVICE
^ The above creates a 100MB disk image, binds it to a loopback device, runs fdisk, and then detaches it. I'm not sure how formatting the partition would work but presumably those tools have an offset option too?edit: this page explains using offsets for mke2fs and doesn't require losetup: https://superuser.com/questions/737072/userspace-manipulatio... also, losetup can now scan the device for partition tables and make partition-specific loopbacks! https://stackoverflow.com/a/15200862 |
|