banderas20
Active Member
Hi.
I'm trying to create regular files and set them up to be used as disks.
I'm using fdisk utility, and AFAIK, we must first create partitions and then format them.
Here are my steps:
Creation of the file
Create new partition and its partition table
Format the ¿partition?
With the above command, I'm formatting the entire disk. Not the partition. Which should give me an error, but it works. In addition to that, If I run mkfs.ext4 against the partition name, it fails. But if I run fdisk -l file2GB the partition shows there.
If I try to mount the disk (not the partition), it works.
I shouldn't be able to format an entire drive, and I should be able to format the partition. But it works the other way round.
¿How is that so? ¿Am I missing something?
Thanks!
I'm trying to create regular files and set them up to be used as disks.
I'm using fdisk utility, and AFAIK, we must first create partitions and then format them.
Here are my steps:
Creation of the file
Code:
dd if=/dev/random of=file2GB bs=1MB count 2000
Create new partition and its partition table
Code:
fdisk file2GB
n (new partition with the entire size)
p (show partitions)
(the new partition is shown)
w (write changes)
Format the ¿partition?
Code:
mkfs.ext4 file2GB
With the above command, I'm formatting the entire disk. Not the partition. Which should give me an error, but it works. In addition to that, If I run mkfs.ext4 against the partition name, it fails. But if I run fdisk -l file2GB the partition shows there.
If I try to mount the disk (not the partition), it works.
I shouldn't be able to format an entire drive, and I should be able to format the partition. But it works the other way round.
¿How is that so? ¿Am I missing something?
Thanks!