Wednesday, July 10, 2024

How to lock a USB flash drive and make it read-only to protect it from viruses without a program

Explaining how to make a USB flash drive read-only and lock it without a program to protect it from cracking or viruses that delete files or hide them, and how to solve the problem of a write-protected flash drive.
Since USB flash drives (also called USB drives) hit the market a couple of decades ago, they have become a part of everyday computing life.
Some of these USB drives have a built-in write-protect switch. When we turn on this write-protect switch, the drive becomes read-only and we cannot add files to it or delete files on it.
But if you do not have this built-in key, do not worry. Using the CMD tool built into Windows, you can make the USB flash drive read-only
What are the benefits of making a USB flash drive read-only?

Perhaps many of us have run into a problem. When we connect our flash drive to another computer that has viruses, we are surprised by the disappearance of our files from it, or they appear in the form of shortcuts. You cannot open the files on your flash drive.
Or perhaps in some cases you want to transfer files from one computer to another, or you want to print files on a flash drive on a computer that has viruses, and when you insert the flash drive, everything on it is deleted due to viruses.
Here comes the importance of making your flash drive protected from modification or viruses entering it by making it read-only
Therefore, in this article, we will let you know how to make a protected USB flash drive and make it read-only, as well as how to make it read-and-write again.

1- How to make the flash drive read-only to protect it from modification and viruses

Here's how it's done:

1- Connect the USB flash drive you want to make read-only.
2- Click Start, type cmd and choose Run as administrator for the command prompt. This will open a command prompt window.
3- In the command prompt window, type diskpart, then list disk and it will show the available disks. Note the number of your disk or flash drive.
4- If your flash disk number is 1, type select disk 1.
5- In order to check the status of the flash drive whether it is read-only or read-write, type attributes disk and press Enter. If it shows Read-Only: No, it is not read-only but can also be modified.
6- If the disk is not read-only, you can type attributes disk set readonly to make it read-only. You can repeat step 5 to check the read-only status. This time it should show Read-Only: Yes.

2- How to disable a write-protected message on a flash drive without software

Well, in the first step we explained about how to make any flash drive read-only. Any USB is protected against any type of write operation. For example, you cannot copy files on it, you cannot delete files from it and you cannot modify files on it. One advantage of having a read-only drive is that no one can modify the contents on it without taking a few extra steps using special software.
But if you want to make it read-write again so that you can read and write data on it, you can follow a number of easy steps.
Note: This method may be useful to you, if your USB flash drive is infected with a virus that prevents files from being added to it or prevents them from being formatted.
Another note: If you followed the first steps and are still on the CMD command prompt page, you can directly move to step 5.

Here's how it's done:

1- Click Start in the taskbar and type cmd Choose Run as administrator for the command prompt.
2- In the Command Prompt window, enter the command diskpart, then list disk and it will show the available disks. Note the disk number of your flash drive.
3- If the drive number is 1, type select disk 1.
4- In order to check a disk, type attributes disk and press Enter. If it says Read-Only: Yes, it is read-only
5- To remove the read-only status from the flash drive, you can type the following command attributes disk clear readonly to make it read and write. We can repeat step 5 to check the read-only status. This time it should show Read-Only:No

Show Comments