6 deleted 12 characters in body
source | link

I need to create filesystem with just one partition from nothing (/dev/zero). I tried this sequence of commands:

dd if=/dev/zero of=mountedImage.img bs=512 count=131072
fdisk mountedImage.img
    n
    p 
    2048
    131072

Basically, I need to create 64MB image file filled with zeroes. Then I use fdisk to add a new partition for new filesystem (which should finally be FAT32), starting at sector 2048 and using all remaining sectors.

losetup /dev/loop1 mountedImage.img
mkfs -t vfat /dev/loop1

But here I'm hitting problems. If I set up a loop device and format it using mkfs -t vfat, partition table is overwritten and filesystem (FAT32) is placed to disk. I don't need whole disk formatted with FAT32, I just need my primary partition to be so.

Does anybody know how can I format only one partition of raw disk image, not whole image? Please help.

I need to create filesystem with just one partition from nothing (/dev/zero). I tried this sequence of commands:

dd if=/dev/zero of=mountedImage.img bs=512 count=131072
fdisk mountedImage.img
    n
    p 
    2048
    131072

Basically, I need to create 64MB image file filled with zeroes. Then I use fdisk to add a new partition for new filesystem (which should finally be FAT32), starting at sector 2048 and using all remaining sectors.

losetup /dev/loop1 mountedImage.img
mkfs -t vfat /dev/loop1

But here I'm hitting problems. If I set up a loop device and format it using mkfs -t vfat, partition table is overwritten and filesystem (FAT32) is placed to disk. I don't need whole disk formatted with FAT32, I just need my primary partition to be so.

Does anybody know how can I format only one partition of raw disk image, not whole image? Please help.

I need to create filesystem with just one partition from nothing (/dev/zero). I tried this sequence of commands:

dd if=/dev/zero of=mountedImage.img bs=512 count=131072
fdisk mountedImage.img
    n
    p 
    2048
    131072

Basically, I need to create 64MB image file filled with zeroes. Then I use fdisk to add a new partition for new filesystem (which should finally be FAT32), starting at sector 2048 and using all remaining sectors.

losetup /dev/loop1 mountedImage.img
mkfs -t vfat /dev/loop1

But here I'm hitting problems. If I set up a loop device and format it using mkfs -t vfat, partition table is overwritten and filesystem (FAT32) is placed to disk. I don't need whole disk formatted with FAT32, I just need my primary partition to be so.

Does anybody know how can I format only one partition of raw disk image, not whole image?

5 edited title
| link

Creating How to create a formatted partition image file from nothingscratch?

4 edited tags
| link
    Post Reopened by Gilles, a CVn, jasonwryan, rahmu, Michael Mrozek
3 edited tags
| link
    Post Closed as "off-topic" by Michael Mrozek
2 added 72 characters in body
source | link
1
source | link