How to delete /dev folder that is accidentaly copied to external hdd?












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".










share|improve this question























  • You could always make a live USB, mount the external hard drive, and remove it that way.

    – Sergiy Kolodyazhnyy
    Dec 31 '18 at 5:33
















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".










share|improve this question























  • You could always make a live USB, mount the external hard drive, and remove it that way.

    – Sergiy Kolodyazhnyy
    Dec 31 '18 at 5:33














2












2








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".










share|improve this question














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".







rm






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 31 '18 at 5:19









X3MelectroX3Melectro

112




112













  • You could always make a live USB, mount the external hard drive, and remove it that way.

    – Sergiy Kolodyazhnyy
    Dec 31 '18 at 5:33



















  • You could always make a live USB, mount the external hard drive, and remove it that way.

    – Sergiy Kolodyazhnyy
    Dec 31 '18 at 5:33

















You could always make a live USB, mount the external hard drive, and remove it that way.

– Sergiy Kolodyazhnyy
Dec 31 '18 at 5:33





You could always make a live USB, mount the external hard drive, and remove it that way.

– Sergiy Kolodyazhnyy
Dec 31 '18 at 5:33










1 Answer
1






active

oldest

votes


















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.






share|improve this answer
























  • 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 1 at 10:44











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1105760%2fhow-to-delete-dev-folder-that-is-accidentaly-copied-to-external-hdd%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









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.






share|improve this answer
























  • 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 1 at 10:44
















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.






share|improve this answer
























  • 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 1 at 10:44














0












0








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.






share|improve this answer













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.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 31 '18 at 13:14









MintyMinty

33817




33817













  • 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 1 at 10:44



















  • 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 1 at 10:44

















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 1 at 10:44





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 1 at 10:44


















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1105760%2fhow-to-delete-dev-folder-that-is-accidentaly-copied-to-external-hdd%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

 ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕