My goal is to create a regular file and within it make a partition and file systems (literally a virtual hard drive) and finally mount it, so I did:

```
sudo dd if=/dev/zero of=imagem-zero.img count=20480000

```

To create the file with aprox 20Gb. Then I've partitioned with `cfdisk`, after that the status of the file was:

```
$ gdisk -l imagem-zero.img

GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk imagem-zero.img: 40960000 sectors, 19.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 544A9633-7FA3-4BE8-BEE7-612C151A4504
Partition table holds up to 128 entries
First usable sector is 2048, last usable sector is 40959966
Partitions will be aligned on 2048-sector boundaries
Total free space is 0 sectors (0 bytes)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048        16779263   8.0 GiB     8304  
   2        16779264        40959966   11.5 GiB    8302  

```

Now, I want to make the file system `ext4` in both these two partitions but I'm failing with the error message in the title of the question:

```
$ sudo mkfs.ext4 imagem-zero.img offset=$((2048*512))
mke2fs 1.43.4 (31-Jan-2017)
mkfs.ext4: invalid blocks 'offset=1048576' on device 'imagem-zero.img'

$ sudo mkfs.ext4 imagem-zero.img offset=$((2048))
mke2fs 1.43.4 (31-Jan-2017)
mkfs.ext4: invalid blocks 'offset=2048' on device 'imagem-zero.img'

```

My question is, how to find the correct offset to make the file system on both of the partitions?