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. Linux下搭建Hadoop集群(Centos7.0)

    Hadoop集群安装 概述 集群 cluster,将很多任务进程分布到多台计算机上:通过联合使用多台计算机的存储.计算能力完成更庞大的任务.为了实现无限量的存储和计算能力,在生产环境中必须使用集群来满 ...

  2. HDU - 5651 xiaoxin juju needs help 逆元模板

    http://acm.hdu.edu.cn/showproblem.php?pid=5651 题意:生成回文串.输出所有回文串的可能数. 题解:mod除法会损失高位,用逆元来代替除法,模板如下 ac代 ...

  3. debug $mysqli->character_set_name();

    <?php $mysqli = new mysqli('localhost', 'root', '', 'w'); if(mysqli_connect_errno()){ printf('Con ...

  4. webpack初入门

    首先利用npm install webpack -g,这里我试过用cnpm安装不成功,不知道是什么回事, webpack 用来压缩打包网站的一些插件和依赖包而存在的, webpack  文件名  打包 ...

  5. Shuffle'm Up---poj3087

    题目链接 题意:有两个字符串s1,s2:经过交叉问是否得到字符串s,不能输出-1,能就输出交叉的次数 每次重组的串都是s2开始,重新组合时,前面一半是s1,后一半s2: #include<std ...

  6. web 开发常见问题--GET POST 区别

    首先,get和post是什么? --两种 HTTP 请求方法:GET 和 POST HTTP Request Methods GET.POST 专业名称是 HTTP Request Methods.但 ...

  7. python就业班-淘宝-目录.txt

    卷 TOSHIBA EXT 的文件夹 PATH 列表卷序列号为 AE86-8E8DF:.│ python就业班-淘宝-目录.txt│ ├─01 网络编程│ ├─01-基本概念│ │ 01-网络通信概述 ...

  8. 定时任务,AlarmManager使用

    CoderLt   定时任务,AlarmManager使用 项目需要:实现一个定时提醒的功能 查阅资料知道,需要使用AlarmManager AlarmManager介绍: AlarmManager是 ...

  9. better-scroll一个好用的页面滑动工具

    1.npm install better-scroll   2.引入:import BetterScrol from 'better-scroll' 3. 在需要设置页面滚动的地方添加 ref=&qu ...

  10. 1.如何修改oracle的密码

    在下图中的目录下面找到 PWDorcl.ora 文件,orcl是数据库的实例名  备份,将PWDorcl.ora 文件名称改为 PWDorcl_back.ora 以管理员身份打开cmd,执行 orap ...