abre2@PSTNABRE2A:~$ truncate -s 1G test.img abre2@PSTNABRE2A:~$ sudo losetup -Pf --show test.img /dev/loop0 abre2@PSTNABRE2A:~$ sudo fdisk /dev/loop0 Welcome to fdisk (util-linux 2.38.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table. Created a new DOS (MBR) disklabel with disk identifier 0x6b188ba3. Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): Using default response p. Partition number (1-4, default 1): First sector (2048-2097151, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-2097151, default 2097151): Created a new partition 1 of type 'Linux' and of size 1023 MiB. Command (m for help): t 1 Selected partition 1 Hex code or alias (type L to list all): 7 Changed type of partition 'Linux' to 'HPFS/NTFS/exFAT'. Command (m for help): p Disk /dev/loop0: 1 GiB, 1073741824 bytes, 2097152 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 Disklabel type: dos Disk identifier: 0x6b188ba3 Device Boot Start End Sectors Size Id Type /dev/loop0p1 2048 2097151 2095104 1023M 7 HPFS/NTFS/exFAT Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. abre2@PSTNABRE2A:~$ sudo mkfs.ext4 /dev/loop0p1 mke2fs 1.46.6-rc1 (12-Sep-2022) Discarding device blocks: done Creating filesystem with 261888 4k blocks and 65536 inodes Filesystem UUID: bea271ef-1c5f-4318-b672-dabdf857e7e7 Superblock backups stored on blocks: 32768, 98304, 163840, 229376 Allocating group tables: done Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done abre2@PSTNABRE2A:~$ sudo fdisk -l /dev/loop0 Disk /dev/loop0: 1 GiB, 1073741824 bytes, 2097152 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 Disklabel type: dos Disk identifier: 0x6b188ba3 Device Boot Start End Sectors Size Id Type /dev/loop0p1 2048 2097151 2095104 1023M 7 HPFS/NTFS/exFAT abre2@PSTNABRE2A:~$