2

I need help to change the file system from ext4 to NTFS. I am using this command:

sudo mkfs.ntfs /dev/sda

But I get this output:

/dev/sda is entire device, not just one partition
Refusing to make file system here!

I don't have any data on /dev/sda. What should I do?

Zanna
  • 72,312

2 Answers2

10

While it is technically possible (using the force flag) to create a filesystem that occupies a whole device, other than on some USB keys this is a very unusual (and discouraged) thing to do.

What is expected by mkfs is that you create a partition table first.

On the command line you can use:

  • parted - for an all-in-one partition and formatting system
  • fdisk - for old MBR-type partition tables (limited to 2TB per partition)
  • gdisk - for newer, larger GPT partition tables

If you prefer to use a GUI there's:

  • gnome-disks (recommended)
  • gparted (as long as you're not making special filesystems like exfat)

All of these programs will prompt you to create an empty partition table first, which you then add partitions to. If the application doesn't format the partition for you, then you can use mkfs.

When you have a partition table with partitions in it, the partition will have a number. e.g. mkfs /dev/sda2

Zanna
  • 72,312
1

To format a drive or partition:

Note: I have taken sda2 as an example, your partition name can be different.

  1. Make sure to check the correct partition name using:

    lsblk

  2. Then unmount that partition:

    sudo umount /dev/sda2

  3. Lastly format the partition using:

sudo mkfs -t ntfs /dev/sda2