Tip: recover your USB disks with live images inside

Sometimes we need to use a USB disk to record a linux image, and often we’ll this disc to other purposes, but we can’t because this disk stay in read-only mode, and even the root permissions cannot exclude these installation files from the disk. This occurs for me whenever I write Debian-based images. To fix this, we can use some simple command to ‘revive’ our USB disks :)

Unmounting your USB disk

[bash]sudo umount /dev/sdb1[/bash]

Setting a desired file system for your USB disk (even NTFS for other OS compatibility)

[bash]sudo mkfs -t ntfs /dev/sdb1[/bash]

Flush and clean your USB disk

[bash]sudo hdparm -r0 /dev/sdb[/bash]

Done! :D