Talk:Partition and Format a USB Flash Drive with Linux

From Free Knowledge Base- The DUCK Project: information for everyone
Revision as of 14:52, 4 December 2020 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

FAT File Systems

FAT is a family of filesystems, comprising at least, in chronological order:

  • FAT12, a filesystem used on floppies since the late 1980s, in particular by MS-DOS;
  • FAT16, a small modification of FAT12 supporting larger media, introduced to support hard disks;
  • vFAT, which is backward compatible with FAT, but allows files to have longer names which only vFAT-aware applications running on vFAT-aware operating systems can see;
  • FAT32, another modification of FAT16 designed to support larger disk sizes. In practice FAT32 is almost always used with vFAT long file name support, but technically 16/32 and long-file-names-yes/no are independent.

Because those filesystems are very similar, they're usually handled by the same drivers and tools. mkfs.vfat and mkfs.fat are the same tool; an empty FAT16 filesystem and an empty vFAT filesystem look exactly the same, so mkfs doesn't need to distinguish between them. (You can think of FAT16 and vFAT as two different ways of seeing the same filesystem rather than two separate filesystem formats.)

FAT32 4GB Size Limitation

Transferring a 4GB or larger file to a USB flash drive or memory card Why can't I transfer a 4GB or larger file to my USB flash drive or memory card?

This is due to FAT32 limitation. Files larger than 4GB can NOT be stored on a FAT32 volume. Formatting the flash drive as exFAT or NTFS will resolve this issue.

WARNING: Backup your data. Formatting will delete all the data in your device.


SOLUTION 1 - Format in exFAT exFAT file system that allows a single file larger than 4GB to be stored on the device. This file system is also compatible with Mac.

Windows 7 and Mac OS 10.6.6 and higher are compatible with exFAT out of the box. Older operating systems may need a patch installed for exFAT compatibility.

NOTE: exFAT file system is NOT compatible with some host devices such as TV, game systems, older operating systems, car stereos etc.

Formatting a drive in exFAT 1. Double-click on My Computer. 2. Right-click on the flash drive or memory card, then select Format. 3. In the File System list, click exFAT. 4. Click Start. 5. Click OK to start formatting.

Click Here for Instructions to format with Mac


SOLUTION 2 - Format in NTFS

WARNING: - Formatting the device as NTFS will make it unwriteable on a Mac computer. Most Mac computers can read NTFS, but not write. - NTFS is a journaled file system, this creates more read/write activities. Therefore, it MAY decrease life expectancy of your device. - Once the device is formatted as NTFS, you MUST use "Safely Remove Hardware" to remove your device.

STEP 1 - Optimize the flash drive for performance 1. Plug in the device to the PC. 2. Open The Computer Management Console a) Windows 8 b) Windows XP, Windows Vista, Windows 7 3. On the Left side select Device Manager 4. On the right side expand Disk Drives 5. Right-click on the flash drive, then select Properties. 6. Click the Policy tab. 7. Select Optimize for performance, then click OK.

STEP 2 - Format the flash drive 1. Double-click My Computer. 2. Right-click on the flash drive, then select Format. 3. In the File system list, click NTFS. 4. Click Start. 5. Click OK to start formatting.

ext4 on usb flash

ext4

I use the ext4 file system and turn off journaling in USB drives and memory cards. I also set the mount option 'noatime' in /etc/fstab in an installed system. See these links,

Installation/UEFI-and-BIOS

Pendrive lifetime

Lifespan a flash drive running Ubuntu?


# sudo mkfs.ext4 /dev/sdc1
mke2fs 1.42.13 (17-May-2015)
/dev/sdc1 contains a vfat file system
Proceed anyway? (y,n) y
/dev/sdc1 is mounted; will not make a filesystem here!
# umount /dev/sdc1
# sudo mkfs.ext4 /dev/sdc1
mke2fs 1.42.13 (17-May-2015)
/dev/sdc1 contains a vfat file system
Proceed anyway? (y,n) y
Creating filesystem with 31358720 4k blocks and 7839744 inodes

wipe your flash drive

Have you tried fdisk? In a terminal, run

sudo fdisk /dev/sdx

where /dev/sdx should be replaced with the device file for your flash drive. Once you get fdisk open, type p to list the partition table, and if the mysterious partition is listed, you can use d # to delete it. (# is the number of the partition, so e.g. d 1, d 2) w writes the partition table back to the disk and q quits. (hit m for help)

If even fdisk fails, I guess you could just try zeroing out the first sector, which I think contains the partition table.

sudo dd if=/dev/zero of=/dev/sdx bs=512 count=1

where, again, /dev/sdx should be replaced with the actual device for your flash drive, will do that for you. You can increase the count= number to write zeros to more of the disk, or omit it entirely to overwrite the entire disk. Needless to say, if you do this, you irretrievably lose any files that may have been stored on the disk.