Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save binsarjr/99dedcf7a758a723f4b2d0c523e9e19a to your computer and use it in GitHub Desktop.
Save binsarjr/99dedcf7a758a723f4b2d0c523e9e19a to your computer and use it in GitHub Desktop.

Currently, the best filesystem to share content between Windows and Linux is exFAT, specially on USB pendrives and SD cards. exFAT is, roughly speaking, a revision of FAT32 without the 4GB max file size limitation.

If not installed, you will have to install exFAT support.

$ sudo apt install exfat-utils

From here, you have two options. Use a graphical tool like gparted or the command line (which is more fun). Find below steps for the latter.

  1. Plug-in the USB pendrive/SD card.
  2. Identify the device. It should be one of /dev/sd?. In a terminal, run the below command which will show connected devices and partition mount points. In this example, /dev/sdb is the device, with two partitions, the first of which is mounted.
$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdb           8:16   1    15G  0 disk 
├─sdb1        8:17   1   256M  0 part /media/myuser/mydevice
└─sdb2        8:18   1  14,7G  0 part 
nvme0n1     259:0    0 931,5G  0 disk 
├─nvme0n1p1 259:1    0   512M  0 part /boot/efi
├─nvme0n1p2 259:2    0    64G  0 part /
├─nvme0n1p3 259:3    0   256G  0 part /home
├─nvme0n1p4 259:4    0    38G  0 part [SWAP]
├─nvme0n1p5 259:5    0   448G  0 part /data
├─nvme0n1p6 259:6    0    16M  0 part 
└─nvme0n1p7 259:7    0   125G  0 part 
  1. Unmount mounted partitions.
$ umount /dev/sdb1
  1. Create a new partition table and partition of type HPFS/NTFS/exFAT.
$ sudo fdisk /dev/sdb # Pay attention! No final digit is used.

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


Command (m for help):
  • Create a new (dos) partition table: press o and enter.
  • Create a new partition: press n, enter and accept default options.
  • Change the partition type to HPFS/NTFS/exFAT: press t, enter, 7, enter.
  • Quit saving changes: press w and enter.
  • You can quit without saving changes: press q and enter.
  1. Format the partition.
$ sudo mkfs.exfat -n "my label" /dev/sdb1 # Pay attention! Final digit is used.
mkexfatfs 1.3.0
Creating... done.
Flushing... done.
File system created successfully.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment