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
  • 70,465
  • 1
    How many drives you have in your system? If one drive.. That is sda. And you have Ubuntu installed in it. The out put says the answer. You can make partitions into ntfs which are not mounted. For example sda3 sda4 etc. – PRATAP Oct 09 '18 at 05:17
  • 4
    @karel et al, I don't think that that duplicate is correct. There's no indication that the OP is installing onto NTFS or that it is the root partition. it may be a duplicate, but not of https://askubuntu.com/questions/55441/install-ubuntu-on-a-ntfs-partition – tudor -Reinstate Monica- Oct 10 '18 at 22:48
  • What is your goal? If you want to install Windows on /dev/sda, just proceed to boot the Windows installer. – Melebius Oct 11 '18 at 09:04
  • 2
    This sounds like an X-Y Problem. What’s the situation and what are you actually trying to achieve? – David Foerster Oct 11 '18 at 11:54
  • try this this might help...... https://unix.stackexchange.com/questions/252625/how-can-i-use-fdisk-to-create-a-ntfs-partition-on-dev-sdx – trusty loki Oct 11 '18 at 15:36

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
  • 70,465
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