6

I want to format a USB storage device from the terminal and I have found several formats to do it. It's the first time I'm going to do this and I have doubts. I want to do it well. I have these options and I want to know which one is convenient that is compatible with all operating systems.

# mkfs.vfat -n 'dickEt' -I /dev/sdd1
# mkfs.ntfs -n 'dickEt' -I /dev/sdd1
# mkfs.ext2 -n 'dickEt' -I /dev/sdd1
# mkfs.ext3 -n 'dickEt' -I /dev/sdd1
# mkfs.ext4 -n 'dickEt' -I /dev/sdd1
# mkfs.msdos -n 'dickEt' -I /dev/sdd1
# mkfs.xfs -n 'dickEt' -I /dev/sdd1
# mkfs.bfs -n 'dickEt' -I /dev/sdd1
14
  • 1
    vfat is compatible with most OS (even Microsoft's Windows). I can't remember the difference between it and msdos. Commented Dec 29, 2018 at 18:30
  • I did not know that this format is compatible with all. Thank you @ctrl-alt-delor
    – Sebastian
    Commented Dec 29, 2018 at 18:36
  • A secondary consideration is the maximum file-size you want to store ... different fs' have different limitations.
    – tink
    Commented Dec 29, 2018 at 18:37
  • I believe you duplicated vfat
    – Jeff Schaller
    Commented Dec 29, 2018 at 18:39
  • 1
    Voted to reopen to be able to close as duplicate of this
    – Fabby
    Commented Dec 30, 2018 at 8:06

2 Answers 2

12

The answer to your question¹ is simple:

mkfs.msdos -n 'dickEt' -I /dev/sdd1

Hoever, it comes with the following limitations:

  • Maximum file size is 4GB
  • Maximum partition size is 2TB

OS - File system compatibility (mini) matrix:

                   FAT  NTFS EXT[2..4] BTRFS  XFS HPFS
Amiga               x
MS-DOS, Win95, 98   x
NT, W2K, ... W10    x     x      2
MacOS               x     3      4                  x
Linux               x     x      x       x      x   x

Note 1: You asked for maximum OS compatibility and that's the only answer as it is compatible with most OSes as it's one of the oldest and least capable file systems. (Not ALL OSes! E.G. C64 does not support FAT!)
Note 2: Commercial Tryware if you want write capabilities.
Note 3: Commercial Software if you want write capabilities.
Note 4: Read-only

2
1

Use NTFS.

FAT can be also OK, but for large files (> 4GB) you need at least exFAT. Also FAT can end in having all your files on it marked as executable, when viewed from *nix systems.

NTFS should be readable and writable by all major operating systems. Only at some models of printers and scanners, which generally would support USB sticks as source/target, you can have bad luck with NTFS – these usually than need a msdos partition table (not GPT partition table) with the first primary partition formatted as FAT32.

So if you do not need printer/scanner support, use the whole stick as NTFS, else make a first small primary partition FAT32, and NTFS for the rest. To be on the safe side, use only msdos type partition table, not GPT, as GPT might only be supported by newer systems.

6
  • 7
    I would never recommend NTFS as a "compatible" filesystem. It is not writable by macOS, nor is it even readable by default on most Linux installations. FAT32 is preferred by far. File too big? Just use split
    – Fox
    Commented Dec 29, 2018 at 21:34
  • 1
    Mac isn't in the practical list of "all systems" buried in the comments. And I've not had a problem reading (or writing) NTFS on a Linux-based system for years now. Commented Dec 29, 2018 at 22:18
  • 5
    "NTFS should be readable and writable", but in practise is often not. The only OS fully supporting NTFS out of the box is Windows, the rest sometimes can read it but definitely not write it without extra (possibly commercial) software; due to, among other things, lack of filesystem specification and aggressive patenting attitude from Microsoft. The same applies for exFAT.
    – ElementW
    Commented Dec 29, 2018 at 22:26
  • @Fox "nor is it even readable by default on most Linux installations" all Linux distros I've ever used can read and write NTFS partitions by default for years
    – phuclv
    Commented Dec 30, 2018 at 5:20
  • @ElementW: it depends on how you implement
    – Fabby
    Commented Dec 30, 2018 at 9:44

Not the answer you're looking for? Browse other questions tagged .