4

I'm installing Arch Linux by guide and misinterpreted some stuff about installing the bootloader. Therefore I went back and cleared my /dev/sdb partitions. Before that I made sdb1 as linux filesystem (8300) and sdb2 as swap partition (8200).

To delete partitions I used gdisk and the d command to remove the partitions. Running lsblk showed be that sdb is only a disk without partitions now.

Then I created new partitions with gdisk again. After I created them I want to mount a filesystem ext4 to sdb1 by executing mkfs.ext4 -L arch /dev/sdb1

Following warning appears /dev/sdb1 contains a ext4 file system labelled 'arch'. And telling me the date and time when I did so.

How can I actually clear the partitions without having such things still left? It seems that I did not really format the partitions

2
  • If you are happy to use the command line, dd will do the job for you. Commented Oct 3, 2017 at 9:02
  • I am happy with that. I kinda found out that overwriting the old fs does no harm Commented Oct 3, 2017 at 9:06

1 Answer 1

11

The command you want is wipefs -a. When deleting partitions that you have no intent of recovering data from, run this on each partition prior to deleting it. In this particular case however, you can probably just pass -f to the mkfs command you're trying to run on that partition, and it will ignore what's there and create a new filesystem (don't get in the habit of doing this though, mkfs has this check intentionally so that you don't accidentally nuke a filesystem you actually need).

What's happened here is that you created the new partition at the same starting point the old partition was at. Deleting a partition from the partition table doesn't delete any data in the region of the storage device that the partition delimited, it just means the OS stops treating that region as in use. As a result, at least the first superblock from the old filesystem is still there and being seen by the tools, which assume there's a filesystem there as a safety precaution.

EDIT: As of (07-Jan-2020) using the mkfs command will prompt you if another fs exists on the partition.

jake@finn:~-$ sudo mkfs.ext4 /dev/ethereum/docker mke2fs 1.45.5 (07-Jan-2020) /dev/ethereum/docker contains a bfs file system Proceed anyway? (y,N) y Discarding device blocks: done 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.