Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

askthedev.com Logo askthedev.com Logo
Sign InSign Up

askthedev.com

Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Ubuntu
  • Python
  • JavaScript
  • Linux
  • Git
  • Windows
  • HTML
  • SQL
  • AWS
  • Docker
  • Kubernetes
Home/ Questions/Q 16387
Next
In Process

askthedev.com Latest Questions

Asked: September 27, 20242024-09-27T10:18:17+05:30 2024-09-27T10:18:17+05:30In: Ubuntu

What steps can I follow to fully erase and reformat a USB drive using fdisk in Ubuntu?

anonymous user

I’ve been trying to clear out this USB drive I have since it’s been acting really weird lately. I suspect it has some corrupted files or remnants from previous attempts to use it for something else. Anyway, I heard that using `fdisk` in Ubuntu is a pretty solid way to completely erase and reformat a drive, but I’m not exactly sure where to start. This is kind of new territory for me, and I don’t want to mess anything up, especially since I’ve read horror stories about people accidentally wiping out their system drives!

Can someone guide me through the whole process? Like, what are the specific steps I need to follow to safely erase and reformat the USB drive without any hiccups? I’ve got a terminal open and I’m ready to dive in, but I need to know how to identify the USB drive correctly so I don’t accidentally select the wrong one.

Also, once I do pinpoint it, how do I ensure that it’s completely wiped? Do I need to do something special before or after using `fdisk`, like unmounting the drive or using other tools in conjunction? I’ve seen some people mention partitioning, and honestly, that part kind of confuses me—do I need to create a new partition after erasing it, or is there a simpler way to handle that?

Oh, and what file system should I format it to afterward? I plan to use this USB for both Windows and Linux systems, so I’m really looking for something that’ll work well across both platforms. Any tips or insights would be super appreciated! I just don’t want to end up with a drive that’s even more problematic than before. Thanks in advance for any help you can offer!

  • 0
  • 0
  • 2 2 Answers
  • 0 Followers
  • 0
Share
  • Facebook

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Continue with Google
    or use

    Forgot Password?

    Need An Account, Sign Up Here
    Continue with Google

    2 Answers

    • Voted
    • Oldest
    • Recent
    1. anonymous user
      2024-09-27T10:18:18+05:30Added an answer on September 27, 2024 at 10:18 am



      USB Drive Formatting Guide

      How to Safely Erase and Reformat Your USB Drive in Ubuntu

      So you want to clear out that USB drive and make sure it’s ready to roll, huh? No worries, I got your back! Here’s a step-by-step guide to help you do this without causing any chaos on your system.

      Step 1: Plug It In

      First off, make sure that your USB drive is plugged into your computer. You’ll need it connected to work with fdisk.

      Step 2: Identify Your USB Drive

      Open your terminal and type:

      lsblk

      This command lists all block devices. Look for your USB drive – it’s usually something like /dev/sdb or /dev/sdc (depending on how many drives you have). Be super careful here; make sure you’re picking the right one!

      Step 3: Unmount the Drive

      Before you run fdisk, you’ll need to unmount the drive. If your USB drive is /dev/sdb1, you’d do:

      sudo umount /dev/sdb1

      Replace sdb1 with whatever your USB drive is called. If it’s already unmounted, you might get a message saying so, and that’s fine.

      Step 4: Start fdisk

      Now, time to start fdisk. Run:

      sudo fdisk /dev/sdb

      Remember, replace sdb with your actual device name (not the partition number).

      Step 5: Delete Existing Partitions

      In the fdisk prompt:

      • Type p to print the current partitions. Make sure this is your USB drive!
      • If you’re ready to delete partitions, type d and hit enter. You may need to input the partition number (usually just 1 if there’s one partition).

      Repeat the d command if there are multiple partitions.

      Step 6: Create a New Partition

      Now you’ll want to create a new partition:

      • Type n to create a new partition.
      • Follow the prompts to create a primary partition. You can just hit enter to accept the defaults.

      Step 7: Write Changes

      Once your new partition is set up, type w to write the changes and exit. This is the crucial step, so double-check you’re doing it on the right drive!

      Step 8: Format the Drive

      To format it for both Windows and Linux, you might want to use the exFAT file system. Run the following command:

      sudo mkfs.exfat /dev/sdb1

      Again, make sure you use the right drive! If you’re still not sure, use lsblk again to confirm.

      Final Notes

      You’re all set! Safely eject the USB drive after it’s done formatting by running:

      sudo eject /dev/sdb

      Now your USB drive should be fresh and ready to go! Just take it easy, and don’t rush through each step. Happy formatting!


        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. anonymous user
      2024-09-27T10:18:19+05:30Added an answer on September 27, 2024 at 10:18 am


      To safely erase and reformat your USB drive using `fdisk` in Ubuntu, you’ll start by identifying the correct drive. Open the terminal and run the command lsblk to list all attached storage devices. Look for your USB drive by checking for its size—typically, it will be labeled something like /dev/sdb, where sdb could vary depending on how many drives are connected. Once you’ve identified it, ensure the USB drive is unmounted by running umount /dev/sdX (replace X with the appropriate letter for your device). This step is crucial because `fdisk` can only modify unmounted partitions.

      Next, launch fdisk with the command sudo fdisk /dev/sdX. Inside `fdisk`, you can delete any existing partitions by typing d. Follow any prompts to confirm your choices. After that, you can create a new partition by typing n, following the prompts to specify the partition size and type, which is usually a standard primary partition. Once you’ve set up the new partition, type w to write the changes and exit. Afterward, format the new partition using sudo mkfs.vfat -I /dev/sdX1 for FAT32, which is compatible with both Windows and Linux systems. This should leave you with a freshly formatted USB drive ready for use.


        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Related Questions

    • I'm having trouble installing the NVIDIA Quadro M2000M driver on Ubuntu 24.04.1 LTS with the current kernel. Can anyone provide guidance or solutions to this issue?
    • What steps can I take to troubleshoot high usage of GNOME Shell in Ubuntu 24.04?
    • I recently performed a fresh installation of Ubuntu 24.04, and I've noticed that my RAM usage steadily increases over time until my system becomes unresponsive. Has anyone experienced this issue ...
    • How can I resolve the "unknown filesystem" error that leads me to the GRUB rescue prompt on my Ubuntu system?
    • I'm experiencing an issue with Ubuntu 24.04 where Nautilus fails to display the progress indicator when I'm copying large files or folders. Has anyone else encountered this problem, and what ...

    Sidebar

    Related Questions

    • I'm having trouble installing the NVIDIA Quadro M2000M driver on Ubuntu 24.04.1 LTS with the current kernel. Can anyone provide guidance or solutions to this ...

    • What steps can I take to troubleshoot high usage of GNOME Shell in Ubuntu 24.04?

    • I recently performed a fresh installation of Ubuntu 24.04, and I've noticed that my RAM usage steadily increases over time until my system becomes unresponsive. ...

    • How can I resolve the "unknown filesystem" error that leads me to the GRUB rescue prompt on my Ubuntu system?

    • I'm experiencing an issue with Ubuntu 24.04 where Nautilus fails to display the progress indicator when I'm copying large files or folders. Has anyone else ...

    • How can I configure a server running Ubuntu to bind specific IP addresses to two different network interfaces? I'm looking for guidance on how to ...

    • Is it possible to configure automatic login on Ubuntu MATE 24.04?

    • After upgrading from Ubuntu Studio 22.04 to 24.04.1, I lost all audio functionality. What steps can I take to diagnose and resolve this issue?

    • I am experiencing issues booting Ubuntu 22.04 LTS from a live USB. Despite following the usual procedures, the system fails to start. What steps can ...

    • I'm encountering a problem with my Expandrive key while trying to update my Ubuntu system. Has anyone else faced similar issues, and if so, what ...

    Recent Answers

    1. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    2. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    3. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    4. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    5. anonymous user on How can I update the server about my hotbar changes in a FabricMC mod?
    • Home
    • Learn Something
    • Ask a Question
    • Answer Unanswered Questions
    • Privacy Policy
    • Terms & Conditions

    © askthedev ❤️ All Rights Reserved

    Explore

    • Ubuntu
    • Python
    • JavaScript
    • Linux
    • Git
    • Windows
    • HTML
    • SQL
    • AWS
    • Docker
    • Kubernetes

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.