1

I am running Ubuntu 18.4 LTS, and I am trying to format a usb drive to NTFS format. But when I run sudo mkfs.ntfs /dev/mmcblk0, it starts filling the drive with zeroes, and around ten percent, the screen goes black, does nothing, and when I push power till it shuts down, and press power again, I get booted to bios who says that there is no bootable drive. I got this problem as well Bodhi Linux.

2 Answers2

2

What you were doing

But when I run sudo mkfs.ntfs /dev/mmcblk0

The device name /dev/mmcblk0 is typically used for a memory card connected via PCI. A USB drive (pendrive or memory card connected via USB) should be seen as /dev/sdx, where x is a letter (a or b or c ...).

  • If you really had a USB drive, it is possible that the mkfs tool wrote zeros to a regular file with the name /dev/mmcblk0, which is not at all what you wanted. If this happened, you had better delete that file,

    if test -f /dev/mmcblk0; then sudo rm /dev/mmcblk0; fi
    
  • If it is a card in a slot connected via PCI in a laptop you wrote zeros to the card.

  • The worst case would be that the computer connects to the internal drive via PCI such that it is recognized as /dev/mmcblk0. I have not encountered any such computer (except Raspberry Pi), but it is possible. In that case, the internal drive was overwritten with zeros, which is really bad. (Modern high-performance laptops use nvme drives, that also connect via PCI but are seen as /dev/nvme0n1, and such computers should react like computers with standard SATA drives: a regular file is created.)

Methods that should work

Instead of writing to the device itself, it is better to create a partition table and create the NTFS file system in a partition. You can do both those tasks with gparted, if you run a graphical desktop environment.

  • First select 'Device' -- 'Create Partition table',
  • and then create a partition with the NTFS file system.

This is easy and rather safe (in relative terms, editing partitions and creating file systems is always risky).


Otherwise in text mode you can

  • first run fdisk and create a partition table
  • then while still running fdisk create a partition
  • then run

    mkfs.ntfs -v -f -L mmcdata /dev/mmcblk0p1   # for a card via PCI
    
    mkfs.ntfs -v -f -L usbdata /dev/sdx1        # for a USB drive
    

    where x is the device letter for the USB drive. Please check and doublecheck that you are writing to the correct drive, because these commands are risky.

it starts filling the drive with zeroes

  • The option -f makes the tool skip zeroising the drive before formatting (and also skip checking for bad sectors).

  • The option -v 'verbose' makes the tool show what it is doing

  • The option -L put a label to help recognizing the partition

What to do if it still does not work

If it still does not work, we can suspect that the card or USB drive is damaged. You can analyze and, let us hope, solve the problem according to the following link to another question and answer at AskUbuntu:

Can't format my usb drive. I have already tried with mkdosfs and gparted

sudodus
  • 46,324
  • 5
  • 88
  • 152
0

mmcblk0 is almost always internal emmc/sd device, and USB drive/card reader is usually mass storage so it's /dev/sdX. 99% likley that OP formatted his internal boot drive.

Alvin Liang
  • 1,673