2

I have accidentally copied the entire contents of root to my external hard drive because of using wrong syntax of cp. I have deleted the rest leaving /dev folder. Using rm results to "device busy" and already have opened it on windows to delete but it says "file does not exist" and "name too long".

2 Answers2

0

Since dev is where hardware devices are identified (/dev/sda etc) I suspect that's the reason it's flagged as busy, and I also suspect that this issue might persist even in a live USB boot. I suggest you turn off automatic mount options, reboot, and while the disk is unmounted reformat it using either gnome-disks or gparted.

Failing that, you could always dd it with something like sudo dd if=/dev/zero of=/dev/sd# where # is the disk's identifier in lsblk. It's slow and will fully erase that disk, but it also won't ask questions as to whether the disk is mounted, etc; it will just overwrite regardless (be careful which disk you point it at, it also won't ask questions if you tell it to overwrite your OS disk). After this you will need to create a whole new partition table for the device with one of the aforementioned programs.

Minty
  • 1,208
  • I know reformating is the way but I can't do these because external hdd contains huge files. I can't back-up it on cloud because of internet connection problem(3rd world) I also don't have another hard drive. It also doesnt have any partition(1 primary partition).

    TL;DR I'll just leave the folder since it only has 740kb rather than reformating the whole drive.

    – X3Melectro Jan 01 '19 at 10:44
0

Looks like Windows can't delete /dev folder.

Open the external hard drive in Linux. Open any file manager. Click /dev folder and then delete.