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. PHP中有丰富的运算符集,它们中大部分直接来自于C语言

    PHP中有丰富的运算符集,它们中大部分直接来自于C语言.按照不同功能区分,运算符可以分为:算术运算符.字符串运算符.赋值运算符.位运算符.条件运算符,以及逻辑运算符等.当各种运算符在同一个表达式中时, ...

  2. 这个代码给所有带有name属性的链接加了一个背景色

    jQuery起点教程之使用选择器和事件jQuery提供两种方式来选择html的elements: 第一种是用CSS和Xpath选择器联合起来形成一个字符串来传送到jQuery的构造器(如:$(&quo ...

  3. Redis之使用python脚本监控队列长度

    编辑python脚本redis_conn.py #!/usr/bin/env python #ending:utf-8 import redis def redis_conn(): pool = re ...

  4. PAT-GPLT L2-027 - 名人堂与代金券 - [简单模拟]

    题目链接:https://www.patest.cn/contests/gplt/L2-027 对于在中国大学MOOC(http://www.icourse163.org/)学习“数据结构”课程的学生 ...

  5. HDU 4734 - F(x) - [数位DP][memset优化]

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4734 Time Limit: 1000/500 MS (Java/Others) Memory Lim ...

  6. 11.20 HTML及CSS

    <div>用于分组HTML元素的块级元素HTML表单,用于收集不同类型的用户输入<input type='radio'>:定义了表单的单选框按钮<input type=' ...

  7. 最长回文 HDU - 3068 manacher 模板题

    题意:找串的最长回文字串(连续) 题解:manacher版题 一些理解:首位加上任意两个字符是为了判断边界. 本算法主要是为了 1.省去奇偶分类讨论. 2.防止形如aaaaaaa的串使得暴力算法蜕化为 ...

  8. python数据结构之树(概述)

    树 在计算机科学中,树是分层结构的抽象模型 .本篇学习笔记记录树的内容如下: 树的基本功能:定义.术语.ADT 树的遍历方法:前序.中序.后序 树的定义 第一种:树由一组节点和一组连接节点的边组成.树 ...

  9. Linux的/etc/services文件的作用?

    4)端口分配 Linux系统的端口号的范围为0–65535,不同范围有不同的意义. 0 不使用 1--1023 系统保留,只能由root用户使用 1024---4999 由客户端程序自由分配 5000 ...

  10. Jmeter(十六)_beanshell实现字符串加密

    Jmeter内置的没有MD5加密方法,所以需要写一些java代码实现加密功能,以下是具体操作: 1:用eclipse建个工程(包名.类名.方法名自己起) package com.wjika.test; ...