How to format a hard drive correctly?

Hi friends.

How do I format a secondary internal hard drive or external USB drive correctly? Is it better to use for example KDE Partition Manager (with GUI) or Terminal?

For example, if I want to format one of my secondary internal drives /dev/sdb in ext4 format, could I use KDE Partition Manager, or use Terminal with this command?:

sudo mkfs.ext4 /dev/sdb

Just that command, and I could start using the hard drive?

And, if I want to encrypt it, do I have to add something to this command, or is that done after the formatting is finished?

Also, what partition table does this command use, MBR or GPT? Because I assume it will create one of the 2, right?

Thanks in advance.

You first need to cerate a partition table, then the partition(s) and then the filesystem(s).

There are a couple of graphical tools to do that. e.g gparted or gnome-disks

You can use either but KDE Partition Manager or gparted will do a lot of the work for you and make it a lot easier.

That will put a filesystem directly on the disk device. It will work but it probably isn’t what you want.

Neither. That command won’t use a partition table, it puts the filesystem directly on the device. You will not have any partitions. That is pretty common with a thumb drive but not recommended for a hard drive.

The opposite, you need to put the luks in place first, then put the filesystem on top of that.

Again, all this is much easier if you use a GUI tool. They will take care of encryption and other things with a simple checkbox or option as opposed to having to fig in and understand how luks works.

1 Like

you could start with reading

https://wiki.archlinux.org/title/File_systems

and

https://wiki.archlinux.org/title/Partitioning

Note that using btrfs you don’t need partitions because it handles disk space in volumes and subvolumes. Encryption can be specifically applied to subvolumes only.

For encryption, I’d recommend using Veracrypt.