An easy way to repair a flash drive, or any drive really, is to use the fsck tool. This tool is great for removing bad file blocks, as most (if not all) corruption and unreadability comes from problems like this. To remove the corrupted file blocks from the USB flash drive, open a terminal window and enter the following commands.

Users must figure out what the drive designation is on the system before things can move forward. Do this by entering the lsblk command. This will list all of the attached disks on your system.

lsblk

Note: the lsblk command lists all disks, not just USB drives. Pay close attention to the output, as it is easy to mistake a hard drive for a flash drive.

To remove the bad file block, run the fsck command on either a specific partition (e.g. /dev/sdc1), or the entire disk (e.g. /dev/sdc). Once completed, the USB drive will have a healthy partition again and be fully operational on Linux.

sudo fsck -n -f        //不属于本文

sudo fsck /dev/sdc1

Note: this tutorial assumes that the flash drive is /dev/sdc (or /dev/sdc1). Users may have different labels for their flash drive on their system.

Zeroing the USB drive

Sometimes a USB drive can be totally unreadable to the point where it is no longer worth saving. When this happens the best route is often to just zero out the data and start over. The best tool for the job in this situation is dd, and it works quite well.

Start by taking the drive label that was found earlier with the lsblk command, and apply the same logic (remember that /dev/sdc1 is a partition, and /dev/sdc is an entire device).

sudo dd if=/dev/zero of=/dev/sdc

Making a new file system

Zeroing a USB drive (or any device for that matter) renders the data on it totally useless. This means that you’ll need to create a new data partition. Choose a file system, and then run the command!

Fat32

sudo mkfs.msdos -f 32 /dev/sdc1

Ext4

sudo mkfs.ext4 -f /dev/sdc1
 

NTFS

sudo mkfs.ntfs -f /dev/sdc1

Conclusion

USB flash drives are useful devices. They make it easy for people to easily transfer data from one computer to the other, regardless of the operating system it’s running. That’s why it’s so important to know what to do when the drive is no longer accessible. Luckily, Linux ships with some really useful tools that make saving a flash drive quite easy.

Image credit: CES Thumb-Drive Style Press Kits

https://www.fosslinux.com/1532/create-a-boot-repair-live-usb-disk-drive-in-ubuntu-linux-mint-and-elementary-os.htm

Removing bad blocks from the USB drive with fsck的更多相关文章

  1. [OrangePi] Booting from USB drive

    You can also boot from USB drive partition. The file named cmdline.txt must exist on BOOT (fat) part ...

  2. Does anyone successfully use USB drive in Windows7 guest?

    Hi, Does anyone successfully use USB drive in Windows7 guest? If I pass a USB drive to Windows7 gues ...

  3. How to Mount a USB Drive in Ubuntu

    Read more : http://www.ehow.com/how_6762235_mount-usb-drive-ubuntu.html Most USB drives will automou ...

  4. Is Usb Drive () ? DeviceIoControl, IOCTL_STORAGE_QUERY_PROPERTY

    http://banderlogi.blogspot.com/2011/06/enum-drive-letters-attached-for-usb.html typedef enum _STORAG ...

  5. How to match between physical usb device and its drive letter?

    struct tagDrives { WCHAR letter; WCHAR volume[ BUFFER_SIZE ]; } g_drives[ ]; // WCHAR GetUSBDrive( ) ...

  6. Install Slax on USB device (Slax U 盘安装)

    Slax is a modern, portable, small and fast Linux operating system with a modular approach and outsta ...

  7. LPC18xx LPC43xx LPC4370 Bootrom USB DFU FPB - Flash Patch and Breakpoint Unit

    What is the difference between a Bootrom vs bootloader on ARM systems Bootrom Bootrom (or Boot ROM) ...

  8. 用UNetbootin来安装USB LINUX,好像比ULTRA ISO省事

    UNetbootin can create a bootable Live USB drive, or it can make a "frugal install" on your ...

  9. fuel iso光盘刻录机usb Driver 烧录

    ISO image to a DVD or burn the IMG file to a USB drive For a bare-metal installation ipmitool, HP iL ...

随机推荐

  1. JPA的锁机制

    JPA 各种实体锁模式的区别 字数2084 阅读304 评论0 喜欢4 为了能够同步访问实体,JPA提供了2种锁机制.这两种机制都可以避免两个事务中的其中一个,在不知情的情况下覆盖另一个事务的数据. ...

  2. POJ-2081 Terrible Sets(暴力,单调栈)

    Terrible Sets Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 4113 Accepted: 2122 Descrip ...

  3. HDFS体系结构(NameNode、DataNode详解)

    hadoop项目地址:http://hadoop.apache.org/ NameNode.DataNode详解 (一)分布式文件系统概述 数据量越来越多,在一个操作系统管辖的范围存不下了,那么就分配 ...

  4. Python数据分析必备Anaconda安装、快捷键、包安装

    Python数据分析必备: 1.Anaconda操作 Anaconda是一个用于科学计算的Python发行版,支持 Linux, Mac, Windows系统,提供了包管理与环境管理的功能,可以很方便 ...

  5. Blocks POJ - 1390 多维dp

    题意:有一排box,各有不同的颜色.你可以通过点击某个box使得与其相邻的同色box全部消掉,然后你可以得到的分数为消去长度的平方,问怎样得到最高分? 题解:考虑用一维dp,/*dp[i]为1~i个b ...

  6. python面向对象高级:__slots__

    __slots__ 一个在有着数以千计的对象的类的时候节省内存的方法. 在Python中,每个类都有实例属性.默认情况下Python用一个字典来保存一个对象的实例属性.这非常有用,因为它允许我们在运行 ...

  7. 深入理解朴素贝叶斯(Naive Bayes)

    https://blog.csdn.net/li8zi8fa/article/details/76176597 朴素贝叶斯是经典的机器学习算法之一,也是为数不多的基于概率论的分类算法.朴素贝叶斯原理简 ...

  8. 如何删除word中多余的空格和空行

    去除word中多余的空格及空行 一.去掉表格和格式 为了版面的整齐,网页文档都是以表格的形式存在的,只是一般情况下表格的颜色被设为无色或表格宽度被设为0,所以我们在网页上看不到表格.另外,网 页文档中 ...

  9. CentOS7 firewall防火墙配置笔记

    开启端口 # firewall-cmd --zone=public --add-port=/tcp --permanent 命令含义:         --zone #作用域         --ad ...

  10. [py][mx]xadmin注册切换主题功能和网站名称修改

    注册主题 这里将基础的设置放到users模块 users/adminx.py from xadmin import views class BaseSetting(object): enable_th ...