Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Partitioning divides a disk into separately addressable regions by writing a partition table. Formatting builds a filesystem inside one of those regions so Linux can store files. A safe Linux workflow is: identify the correct device, back up and unmount it, create a GPT or MBR table and partitions, format the intended partition, verify its metadata, mount it, and add a UUID- or label-based /etc/fstab entry only after a successful test.

The commands below are deliberately explicit because fdisk, parted, and every mkfs.* command can destroy existing data when aimed at the wrong path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Partitioning and formatting are different operations

A partition table is the disk’s map. It records where partitions begin and end and identifies each partition’s type. A filesystem is the data structure placed inside one partition; it tracks directories, files, free space, permissions, and other metadata. Formatting does not create partition boundaries, and partitioning does not create a usable filesystem.

For example, /dev/sdX denotes an entire disk, while /dev/sdX1 denotes its first partition. On an NVMe disk, the equivalent names are usually /dev/nvme0n1 for the disk and /dev/nvme0n1p1 for its first partition. Writing a filesystem to the whole disk when you meant a partition can overwrite the partition table; writing a new table to the wrong disk can make all of its existing volumes inaccessible.

#1 Best Overall
Sale
Lexar D40E 128GB Dual USB 3.2 Gen 1 Type-C Jump Drive, Champagne Silver | USB-C Flash, Metal Housing, Swivel Design, Thumb Drive
  • USB-C 2-in-1 storage OTG: The Lexar JumpDrive Dual Drive D40E features USB Type-A and Type-C connectors in a slim, portable form factor for easy device compatibility
  • Transfer speeds up to 100MB/s: Based on internal testing, performance may vary depending upon the host device, interface, and usage conditions. 1MB=1,000,000 bytes
  • Plug and Play: Widely compatible with USB Type-C smartphones, tablets, laptops, Macs, and traditional Type-A devices, no software installation required. The 360° swivel design allows for easy switching between connectors without the hassle of losing a cap
  • Durable & Compact: The Lexar D40E USB memory stick features a metal enclosure, withstands temperatures from 0° to 50° C (32°F to 122°F), and is lightweight at 26g with dimensions of 70.4 x 16.9 x 11.7mm
  • Security & Warranty: Securely protects files using an advanced security software solution with 256-bit AES encryption. Backed by a Lexar 3-year limited warranty

Prepare safely before writing anything

Back up data and stop using the target

  • Copy any required files to another verified device or backup system. Assume partition-table and filesystem creation are destructive.
  • Close applications using the target and unmount every filesystem on it before changing its table or formatting a partition.
  • Do not repartition the running system’s root or boot partitions from that same installation. Use a maintenance environment or live system when the target contains the operating system.
  • Have the target’s expected capacity, model and connection type written down. Those details are more reliable than a guessed device name.

Use a practice device when learning

A spare USB flash drive is a useful practice target. It can still be erased, so verify its model and capacity in the inspection output immediately before proceeding. Never use a removable drive that contains the only copy of important files.

Identify the correct disk and its current state

Start with a read-only inventory:

lsblk --fs
sudo blkid

lsblk --fs presents the block-device hierarchy along with filesystem type, UUID, labels, free space, usage and mount points. blkid probes filesystem and swap signatures and metadata. For a general overview, the lsblk manual recommends using lsblk --fs; use blkid to confirm a specific device’s signatures.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Trace the tree from the whole disk to its children. A typical inventory might show a disk such as /dev/sdb and a child such as /dev/sdb1. An NVMe device normally uses the p separator before the partition number. Match the path to the expected size and model; do not replace /dev/sdX in an example until that match is certain.

Look at mount points in the same output. A mounted partition is still a real data volume, not an empty placeholder. If you are unsure which process is using it, stop before making changes rather than forcing an unmount.

Choose GPT or MBR (DOS)

Partition-table style Use it when Important considerations
GPT Modern hardware, especially systems using UEFI, and new disks without legacy compatibility requirements. It is the modern default for most new installations and data disks. Confirm that any old firmware or operating system that must access the disk supports GPT.
MBR/DOS Compatibility with older firmware or operating systems is more important than modern layout features. It is a legacy format. Choose it intentionally when a specific older environment requires it, not merely because the disk is small.

The fdisk utility describes GPT as especially suitable for modern UEFI hardware while retaining DOS/MBR support for older systems. Selecting GPT or MBR replaces the existing partition table, so the choice belongs before partition creation and after your backup.

Rank #2
SANDISK 128GB Ultra Flair, USB-A Flash Drive, Up to 150MB/s Read Speeds | USB Flash Drive, Up to 15x Faster than standard 2.0, Password Protection, Durable, Sleek Metal Casing, USB 3.0, Silver/Black
  • High-speed USB 3.0 performance of up to 150MB/s(1) [(1) Write to drive up to 15x faster than standard USB 2.0 drives (4MB/s); varies by drive capacity. Up to 150MB/s read speed. USB 3.0 port required. Based on internal testing; performance may be lower depending on host device, usage conditions, and other factors; 1MB=1,000,000 bytes]
  • Transfer a full-length movie in less than 30 seconds(2) [(2) Based on 1.2GB MPEG-4 video transfer with USB 3.0 host device. Results may vary based on host device, file attributes and other factors]
  • Transfer to drive up to 15 times faster than standard USB 2.0 drives(1)
  • Sleek, durable metal casing
  • Easy-to-use password protection for your private files(3) [(3)Password protection uses 128-bit AES encryption and is supported by Windows 7, Windows 8, Windows 10, and Mac OS X v10.9 plus; Software download required for Mac, visit the SanDisk SecureAccess support page]

Create the partition table and partitions

Interactive creation with fdisk

Run fdisk against the whole disk, not an existing partition:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo fdisk /dev/sdX

Inside the dialog-driven program, use its help command to see the commands available in your installed version. Select a GPT or DOS label as appropriate, create one or more partitions, review the proposed table, and write it only after checking every start, end and size value. If the disk contains data you need, exit without writing and reassess rather than experimenting on it.

After writing, leave the program and inspect the result with lsblk --fs. If the kernel has not yet exposed the new layout, allow udev and the kernel to reread the table, then run the inspection again. Do not guess a new device name or begin formatting until the intended partition is visible.

Creating a partition with GNU Parted

GNU Parted’s mkpart command creates a partition but does not create a filesystem on it. A conceptual session is:

sudo parted /dev/sdX
(parted) print
(parted) mklabel gpt
(parted) mkpart primary ext4 4MiB 100%
(parted) quit

The filesystem type in mkpart is a type hint for the partition entry; it is not a formatting operation. You still run the appropriate mkfs.* command afterward. Parted accepts start and end offsets and type hints for filesystems including ext4, XFS, Btrfs, FAT, NTFS and Linux swap.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
2 Pack 64GB USB Flash Drive USB 2.0 Thumb Drives Jump Drive Fold Storage Memory Stick Swivel Design - Black
  • What You Get - 2 pack 64GB genuine USB 2.0 flash drives, 12-month warranty and lifetime friendly customer service
  • Great for All Ages and Purposes – the thumb drives are suitable for storing digital data for school, business or daily usage. Apply to data storage of music, photos, movies and other files
  • Easy to Use - Plug and play USB memory stick, no need to install any software. Support Windows 7 / 8 / 10 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, compatible with USB 2.0 and 1.1 ports
  • Convenient Design - 360°metal swivel cap with matt surface and ring designed zip drive can protect USB connector, avoid to leave your fingerprint and easily attach to your key chain to avoid from losing and for easy carrying
  • Brand Yourself - Brand the flash drive with your company's name and provide company's overview, policies, etc. to the newly joined employees or your customers

Keep starts aligned

fdisk follows the device’s reported I/O limits by default, which aligns partitions appropriately for modern 4 KiB-sector media in ordinary cases. The GNU Parted flash-drive example starts a partition at 4 MiB, an alignment choice that avoids common erase-block and sector-boundary problems on low-end flash. Keep the default alignment unless you have a specific device layout that requires another value.

Format the intended partition

Use a filesystem-specific builder on the partition path, never on the whole disk path unless you intentionally want a filesystem without a partition table:

sudo mkfs.ext4 -L DATA /dev/sdX1
sudo mkfs.xfs -L DATA /dev/sdX1
sudo mkfs.btrfs -L DATA /dev/sdX1
sudo mkfs.vfat -F 32 -n DATA /dev/sdX1

Replace /dev/sdX1 with the verified partition. Labels are optional but make later identification easier. The generic mkfs command is a frontend; the filesystem-specific mkfs.ext4, mkfs.xfs, mkfs.btrfs and mkfs.vfat utilities perform the actual build. Formatting normally creates a new UUID and makes previous filesystem metadata unusable, which is why the backup and path checks come first.

Choose a filesystem by requirement

Filesystem Good fit Constraints to account for
ext4 A general-purpose Linux filesystem for many single-device data partitions. It is primarily a Linux choice; use another format when routine access from non-Linux systems is required.
XFS Linux workloads whose operational characteristics and administration practices fit XFS. Check that all recovery and maintenance environments you rely on include XFS tools.
Btrfs Single-device filesystems or designs that need Btrfs features and administration tools. For a multi-device Btrfs filesystem, the kernel must discover all participating devices before mounting; device discovery or mount device= options may be required.
VFAT/FAT32 Removable media that must work with a broad range of computers and devices. It has fewer Linux filesystem features than ext4, XFS or Btrfs. The FAT32 format also has file-size and other format-specific limits.
NTFS Volumes that need regular interoperability with Windows. Confirm that the Linux environment’s NTFS driver and tools support the operations you need.

There is no universal fastest or best filesystem. Select on compatibility, feature needs, single- versus multi-device operation and the recovery tools available to you rather than on an unsupported benchmark claim.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Verify the new filesystem before mounting

Check both the disk tree and the exact partition:

lsblk --fs /dev/sdX
sudo blkid /dev/sdX1

Confirm all of the following:

  • The partition is the expected size and child of the intended disk.
  • FSTYPE is the filesystem you meant to create.
  • The UUID is new and belongs to that partition.
  • The label is correct, if you assigned one.
  • No unexpected old partition is mounted at the path you plan to use.

If a table or filesystem does not appear immediately, let the kernel and udev reread the device and rerun lsblk --fs. Rebooting or unplugging a removable device may be appropriate in a maintenance window, but never respond by formatting a similarly named device.

Rank #4
Sale
SIMMAX 32GB Memory Stick USB 2.0 Flash Drives Swivel Thumb Drive Pen Drive (32GB Purple)
  • GOOD VALUE PACKAGE - 1 Pack 32GB Memory Stick USB 2.0 Flash Drives with great cost performance and high quality.
  • BIG CAPACITY - The available capacity: 29.10GB-29.8GB, You can save the data of movies, music, photos, designs, programs, manuals, handouts in a high speed.Good performance in digital data storing, transferring and sharing with families, friends, workmates, clients and machines.
  • EASY TO USE & PLUG AND WORK - Support windows 7 / 8 / 10 / Vista / XP / 2000 / ME / NT Linux and Mac OS, Compatible with USB2.0 and below.
  • TWISTTURN DESIGN & EASY CARRY - The metal clip rotates 360° round the ABS plastic body which with rubber oil skin feeling finish. The capless design can avoid lossing of cap, and providing efficient protection to the USB port.
  • WARRANTY & SUPPORT - SIMMAX logo is laser printed on the USB connector surface, our products are of good quality and we promise that any problem about the product within one year since you buy.

Mount it for immediate use

Create a mount point and use the UUID reported by blkid:

sudo mkdir -p /mnt/data
sudo mount /dev/disk/by-uuid/REPLACE_WITH_UUID /mnt/data
findmnt /mnt/data

The findmnt result should show the expected source, filesystem type and mount target. Linux device names such as /dev/sdb1 can change when disks are added or detected in a different order. UUID and label paths are more stable identifiers for a persistent configuration.

You can mount by label instead:

sudo mount /dev/disk/by-label/DATA /mnt/data

Labels must be unique enough for your machine. If two filesystems share a label, a label-based mount can select the wrong one; use the UUID when there is any ambiguity.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Make the mount persistent with /etc/fstab

Once a manual mount succeeds, obtain the exact UUID and add one line to /etc/fstab. The fields are device identifier, mount point, filesystem type, options, dump setting and filesystem-check order:

sudo blkid /dev/sdX1
sudoedit /etc/fstab
UUID=REPLACE_WITH_UUID /mnt/data ext4 defaults 0 2

Change ext4 to the filesystem you actually created. The directory must already exist, and the UUID must match exactly. /etc/fstab also accepts PARTUUID, LABEL and PARTLABEL identifiers. Use options appropriate to your filesystem and security policy; do not copy an option intended for a different format.

Best Value
IMEASON Swivel Design 16GB USB Flash Drive with Keychain, USB 2.0 Portable Thumb Drive Memory Stick, FAT32 Format Flashdrive for Data Storage, Photos, Music, Files (Black, 16 GB)
  • 【16GB Flash Drive】USB flash drives with 16GB capacity, meet your needs of daily use on work, school, home and travelling for photos, music, videos, files storage and transfer. IMEASON thumb drives can be used to store different files, easy to data backup.
  • 【Metal Swivel Cap Design】USB thumb drive is metal swivel cover provides extra protection for the usb thumbdrive connector, no usb drive cap to lose; keychain design makes it easier to carry without worrying lose it.
  • 【Wide Compatibility】USB drive supports Windows 7/8/10/11 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, also Supports USB 2.0 and 1.1 ports. USB Stick support TV, desktop, notebook computer, car, audio and other device. The USB Memory Stick is your great data storage and transfer companion with traveling and working.
  • 【Easy to use】usb memory stick is plug and play without any software installation. Just simply plug the Flashdrive into the port of your USB-compatible devices such as computer, laptop to start data storage or transmission.
  • 【What You Get】16 GB USB Flash Drive Thumb Drive, The default format of the usb storage flash drive is FAT32.

Test the edited file without rebooting:

sudo umount /mnt/data
sudo mount -a
findmnt /mnt/data

If mount -a reports an error, correct the line before restarting. A typo in /etc/fstab can delay or interrupt boot, so retain a root shell or maintenance console while testing a new entry.

Special case: multi-device Btrfs

A Btrfs filesystem can span multiple devices. A mount that names only one member may fail because the kernel has not discovered the other members. Follow the Btrfs tooling’s device-discovery procedure before mounting, or supply the required device= options in the mount command. A single-device Btrfs volume does not need that multi-device discovery step.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common failure modes and recovery

The wrong disk was selected

Stop immediately if the size, model or mount tree does not match your plan. Do not run another command to “fix” it. If a destructive command has already run, unmount the device, preserve it unchanged and use a qualified recovery workflow; further writes can overwrite recoverable metadata.

The partition is busy

Unmount it and close processes that hold files open. If it is a system partition, move the operation to a live or maintenance environment. Formatting a mounted filesystem can produce corruption even when the command appears to succeed.

mkfs says the device is in use

Verify that you supplied the partition path and that no mount, swap area, RAID member or container is using it. Recheck lsblk --fs and related device mappings before deciding whether a signature should be removed.

The new partition does not show up

Exit the partitioning tool, allow the kernel and udev to reread the table, and run lsblk --fs again. Check the tool’s final table output. Do not infer a path by incrementing a number if the system has not reported it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The fstab mount fails

  • Compare the UUID in /etc/fstab with sudo blkid; one character out of place is enough to fail.
  • Check that the mount directory exists and is not already occupied by another mount.
  • Confirm the filesystem type and options match the formatted partition.
  • Run sudo mount -a and read the exact error before rebooting.

What wipefs -a does—and does not do

wipefs -a removes detectable filesystem, RAID or partition-table signatures so tools such as libblkid no longer recognize them. It does not erase the underlying filesystem data and is not secure sanitization. Use it only when you intentionally want to remove signatures from a verified target and have handled any data-retention requirements separately.

A complete, cautious example

The following sequence illustrates a new, disposable USB drive. Replace every placeholder only after matching the device in your own lsblk --fs output:

  1. Inspect devices: lsblk --fs and sudo blkid.
  2. Identify the whole USB disk, for example /dev/sdX, by its model and capacity. Confirm that its child partition is not mounted.
  3. Unmount any child filesystem and copy off anything you need.
  4. Create a GPT table and one aligned partition with sudo fdisk /dev/sdX, or use Parted’s mklabel gpt and mkpart.
  5. Verify the new child path, such as /dev/sdX1, with lsblk --fs.
  6. For Linux-only use, format it, for example: sudo mkfs.ext4 -L DATA /dev/sdX1. For broad removable-media compatibility, choose the appropriate FAT format instead.
  7. Run lsblk --fs /dev/sdX and sudo blkid /dev/sdX1; record the UUID.
  8. Mount it with sudo mkdir -p /mnt/data and sudo mount /dev/disk/by-uuid/REPLACE_WITH_UUID /mnt/data.
  9. Verify the source and target with findmnt /mnt/data, create a test file, and remove it.
  10. If the mount is intended to survive reboots, add the tested UUID entry to /etc/fstab, unmount it, run sudo mount -a, and verify again.

Checklist before you finish

  • Correct whole disk identified by path, capacity and model.
  • Backups completed and affected filesystems unmounted.
  • GPT or MBR selected for the actual firmware and compatibility requirement.
  • Partition boundaries aligned and reviewed before writing.
  • Filesystem created on the intended partition, not accidentally on the disk.
  • FSTYPE, UUID, label and size verified after formatting.
  • Manual mount tested with findmnt.
  • Any /etc/fstab entry tested with sudo mount -a before rebooting.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.