I'm trying to create disk device in a file with:
dd if=/dev/zero of=file.img bs=516096 count=1000
sudo losetup /dev/loop0 file.img
(echo n; echo p; echo 1; echo ""; echo ""; echo w;) | sudo fdisk -u -C1000 -S63 -H16 file.img
sudo mke2fs -b1024 /dev/loop0 503968
Thank i mount it with:
sudo mkdir /mnt/fcd
sudo mount -t ext2 /dev/loop0 /mnt/fcd
and writing self-written bootloader:
sudo dd if=loader.bin of=file.img bs=512 count=1 conv=notrunc
and umount it with:
sudo umount /dev/loop0
sudo losetup -d /dev/loop0
I have two questions:
1.I'm getting following output in fdisk:
Using default response p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-1007999, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1007999, default 1007999):
Why is first sector starts from 2048 and not from 0? Is 0-2048 for MBR in ext2 or for something else?
2.After my disk created, i execute:
fdisk -l file.img
And it's output is:
Disk file.img: 516 MB, 516096000 bytes
255 heads, 63 sectors/track, 62 cylinders, total 1008000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
Why there is no one partition?
Thank you.