Swap file failed. Usb bricked

c.petras

Occasional Visitor
Hello everyone. Today I was santize my network and i have to rebuild the settings and scripts. After I waited 2 hours for making an swap file of 5 GB I have disconnected and rebooted the router but my USB was locked to read-only and now I can't use it anymore. Does anyone know a way to make It operable again?
And also the swap file size must be 2GB or is ok with 5 or 10 GB for the scripts to work propelly.
Thanks!
 

Joe McManus

New Around Here
On a Windows machine , right click on the Start button and select Disk Management.
Select the USB drive. <<<<<< be sure you've selected the USB drive.
Select each partition and delete them one at a time.
Create a new partition.
Done.
 

c.petras

Occasional Visitor
Screenshot 2022-04-20 230134.png

Not working.. I get this error
 

bennor

Very Senior Member
Try a different (larger) what I assume is a USB flash drive. Or see if Windows can scan and repair the existing flash drive. Or do a chkdsk <usb drive letter>: /f /r / x from the windows command line.
 

c.petras

Occasional Visitor
What scripts? Even the ones with swap fire requirement rarely use it.



Imagine how usable this swap file on USB stick is, if it takes 2h only to create it.
I use ony Diversion and Skynet
I'l try now to use another USB and create an 2 GB Swap but i want to know if there is a way to rescue the first USB somehow
 

bbunge

Part of the Furniture
I have had issues from time to time with swap files on thumb drives. Now I create a Linux swap partition, usually 1 GB, and an EXT4 data partition on the rest of the drive. I also use USB2 thumb drives as they seem to be more reliable and are fast enough for swap and diversion.
 

Martinski

Senior Member
... but i want to know if there is a way to rescue the first USB somehow
In the past, I have had mixed results (~50% chance of success) with the steps described below this paragraph for getting some "read-only" USB flash drives back to a working condition after a full reformat, so this method may or may not work for your particular case. It's up to you if you want to try it; but before you do, make sure to copy any important files you want to keep. BTW, the two USB flash drives on which this recovery method worked are still working fine, though they are not attached to a router.

1) On a Windows PC, open a Command Prompt terminal window with the "Run as Administrator" option.

2) In the Command Prompt window type the command: diskpart

3)
The window will show a new prompt (DISKPART>).
Now type the command: list disk

You should now get the list of currently detected disk drives like so:
Rich (BB code):
Disk ###  Status         Size     Free     Dyn  Gpt
--------  -------------  -------  -------  ---  ---
Disk 0    Online          476 GB  1024 KB        *
Disk 1    Online          945 GB  1024 KB
...
Disk N    Online           29 GB     0 B

4) From the list of disk drives shown, get the number assigned to the target USB flash drive (it can usually be identified by its reported size).
Now type the command: select disk X
Where "X" is the number of the target disk drive.

5) After the correct USB flash drive number is selected, type the command:
attributes disk

You should get a list of attributes like so:
Rich (BB code):
Current Read-only State : No
Read-only  : No
Boot Disk  : No
Pagefile Disk  : No
Hibernation File Disk  : No
Crashdump Disk  : No
Clustered Disk  : No

6) Check to see if the following attributes are set to "Yes":
Current Read-only State: Yes
Read-only: Yes

If so, type the following command:
attributes disk clear readonly

If the above command is successful, the "Read-only" state should now be cleared.
You can verify this by repeating step 5 above.

7) Now type "exit" to terminate the "diskpart" program.

8) Now type the command: chkdsk X: /f /r /x
where "X" is the current letter assigned to the USB flash drive

9) If everything went OK, now reformat the USB flash drive. Do not do a "Quick Format" but a full reformat. If any of the commands above fails, it may be that the flash disk drive is beyond recovery.

Good Luck.
 

drinkingbird

Very Senior Member
I use ony Diversion and Skynet
I'l try now to use another USB and create an 2 GB Swap but i want to know if there is a way to rescue the first USB somehow

If it took hours to create the swap and is now bricked, even if you could get it working again, the drive is dying or dead. Why risk it? Thumb drives are cheap.

There is another thread not far below yours about USB drives not lasting long when used for swap. The excessive writes and heat will wear them out quickly. A cheap SSD (128 or 256G) in external enclosure will be faster and last a lot longer.
 

pirx73

Senior Member
@drinkingbird exactly. This thread:
You can get small SSD (64GB) for less than 20$.
We all should think about USB sticks as floppy disks of old - just for short transfer of information, not as storage.
Plus any SSD will be considerably faster for writes than any USB stick due to more advanced controller and when connected to our routers, limiting factor is router USB port speed, not the SSD.
 
Last edited:

c.petras

Occasional Visitor
In the past, I have had mixed results (~50% chance of success) with the steps described below this paragraph for getting some "read-only" USB flash drives back to a working condition after a full reformat, so this method may or may not work for your particular case. It's up to you if you want to try it; but before you do, make sure to copy any important files you want to keep. BTW, the two USB flash drives on which this recovery method worked are still working fine, though they are not attached to a router.

1) On a Windows PC, open a Command Prompt terminal window with the "Run as Administrator" option.

2) In the Command Prompt window type the command: diskpart

3)
The window will show a new prompt (DISKPART>).
Now type the command: list disk

You should now get the list of currently detected disk drives like so:
Rich (BB code):
Disk ###  Status         Size     Free     Dyn  Gpt
--------  -------------  -------  -------  ---  ---
Disk 0    Online          476 GB  1024 KB        *
Disk 1    Online          945 GB  1024 KB
...
Disk N    Online           29 GB     0 B

4) From the list of disk drives shown, get the number assigned to the target USB flash drive (it can usually be identified by its reported size).
Now type the command: select disk X
Where "X" is the number of the target disk drive.

5) After the correct USB flash drive number is selected, type the command:
attributes disk

You should get a list of attributes like so:
Rich (BB code):
Current Read-only State : No
Read-only  : No
Boot Disk  : No
Pagefile Disk  : No
Hibernation File Disk  : No
Crashdump Disk  : No
Clustered Disk  : No

6) Check to see if the following attributes are set to "Yes":
Current Read-only State: Yes
Read-only: Yes

If so, type the following command:
attributes disk clear readonly

If the above command is successful, the "Read-only" state should now be cleared.
You can verify this by repeating step 5 above.

7) Now type "exit" to terminate the "diskpart" program.

8) Now type the command: chkdsk X: /f /r /x
where "X" is the current letter assigned to the USB flash drive

9) If everything went OK, now reformat the USB flash drive. Do not do a "Quick Format" but a full reformat. If any of the commands above fails, it may be that the flash disk drive is beyond recovery.

Good Luck.
Thank you for answer.
I have tried to follow your instructions and no positive results. The USB drive remains Read-only. I am not planning to use it as a swap partition but I have tried to make is usable again for shorts music transfer.
 

Attachments

  • Screenshot 2022-04-27 141624.png
    Screenshot 2022-04-27 141624.png
    120.9 KB · Views: 69

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top