9

When I format a drive to NTFS under Windows and plug it into the Ubuntu machine it is perfectly usable, but when I format it under Ubuntu using Disks (delete all partitions and create one single partition with NTFS) it does not show up when plugged into Windows machine.

Please note that in both cases USB drive contains only one, primary partition formatted to NTFS, for example:

/dev/sdb - the actual device
/dev/sdb1 - the only, primary partition

I've checked both this behaviour both with solid state USB pen-drive as well as external USB magnetic HDD.

How to (re)format USB HDD or a stick to NTFS under Ubuntu so it is usable under Windows?

10

gparted (GNU Partition Editor) is a good graphical tool for formating drives to a variety of different filesystem types. You can install it with sudo apt-get install gparted.

Just as when you are using Disks, be very careful that you are making changes to the correct device. You can format your device to NTFS using the following steps:

  1. Select the correct device from the dropdown selector on the top right.
  2. Delete any partitions that already exist on the device.
  3. Create a new partition using all of the available space and set the type to ntfs
  4. Click the "Apply" button and wait for the operations to complete

If Windows still doesn't recognize the device, the partition table may be in a different type than the MS-DOS type (Ubuntu uses gpt partition type by default I think). Click "View >> Device Information" from the menu to see what the partition table type is. In this case, use the "Device >> Create Partition Table" menu option to change the partition table type to MS-DOS. You may have to follow the above steps again to create your NTFS partition.

  • Good solution, but it is gparted 100% reliable? – Peter Krauss Aug 26 at 10:42
4

With mkntfs

Install mkntfs which is provided by package ntfs-3g:

sudo apt-get install ntfs-3g

Find the partition of your USB drive with df -h. Let's assume it's at /dev/sdb1.

Unmount the drive with umount /dev/sdb, otherwise you'll get the error

/dev/sdb1 is mounted.
Refusing to make a filesystem here!

Then format the partition:

sudo mkntfs --fast --label myUsbDrive /dev/sdb1

If that succeeded, you'll see a message like this:

Cluster size has been automatically set to 4096 bytes.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
2

Indeed Ubuntu Disks utility creates partition with the wrong id:

$ sudo fdisk /dev/sdc

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdc: 57,9 GiB, 62109253632 bytes, 121307136 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xcee48da0

Device     Boot Start       End   Sectors  Size Id Type
/dev/sdc1        2048 121307135 121305088 57,9G 83 Linux

Command (m for help): q

When you create the partiton with GParted the partition gets created with the right id and it is perfectly visible under Windows:

$ sudo fdisk /dev/sdc

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdc: 57,9 GiB, 62109253632 bytes, 121307136 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0bce1084

Device     Boot Start       End   Sectors  Size Id Type
/dev/sdc1        2048 121307135 121305088 57,9G  7 HPFS/NTFS/exFAT

Command (m for help): q 

$ 

It is always possibile to change the partition type with fdisk, but the conclusion is that it is better just to always use GParted.

Perhaps we shall file a bug ticket with Disks developers?

  • 3
    If you want to and have the energy to do it, yes, it is a good idea to bring this problem with Disks to the developers (and a bug ticket is the way to do it). – sudodus Jul 10 '17 at 0:17
1
  • I have succeeded with this task using gparted, as suggested already.

  • It is also possible to let mkusb create a persistent live drive (with standard Ubuntu or a community flavour: Kubuntu, Lubuntu ... Xubuntu). In this process, partition #1 will be created as an NTFS partition for sharing data with Windows.

    $ sudo lsblk -o model,name,size,fstype,label,mountpoint /dev/sdd
    MODEL            NAME    SIZE FSTYPE  LABEL                     MOUNTPOINT
    DT Workspace     sdd    29,1G                                   
                     ├─sdd1   14G ntfs    usbdata                   
                     ├─sdd2    1M                                   
                     ├─sdd3  244M vfat    usbboot                   
                     ├─sdd4  893M iso9660 Lubuntu 16.04.1 LTS amd64 
                     └─sdd5   14G ext4    casper-rw                 
    
    $ sudo parted /dev/sdd print        Model: Kingston DT Workspace (scsi)
    Disk /dev/sdd: 31,2GB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    Disk Flags: 
    
    Number  Start   End     Size    File system  Name     Flags
     2      1049kB  2097kB  1049kB               primary  bios_grub
     3      2097kB  258MB   256MB   fat32        primary  boot, esp
     4      258MB   1194MB  936MB                primary
     5      1194MB  16,2GB  15,0GB  ext2         primary
     1      16,2GB  31,2GB  15,0GB  ntfs         primary  msftdata
    
    • Partition #1 is located at the end of the drive, but the number in the partition table decides, if Windows can see it.
    • If you use the GUID partition table, GPT, it helps to have the flag msftdata according to the listed output of parted.
    • The first time Windows sees the USB pendrive, it might want to repair it. Answer yes, let it try to repair it. Windows will respond something like 'no error found', but it does something, probably writes somewhere, that it has seen the partition and marked it 'good', because next time it will not want to repair it.

    • You find more details at the following links,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.