9
submitted 11 months ago* (last edited 11 months ago) by juli@programming.dev to c/linux@lemmy.ml

I need to repair a drive with chkdsk and don't have access to windows

edit: hopefully, I only have to do it once. I will search for someone with a real windows machine. It's not worth the trouble =(

top 6 comments
sorted by: hot top controversial new old
[-] SeeJayEmm@lemmy.procrastinati.org 7 points 11 months ago

I'm assuming it's an external drive. So long as you directly mount the device to the VM you should be able to, yes.

[-] MentalEdge@sopuli.xyz 4 points 11 months ago

I don't think so, but you should be able to create an install usb, same as for linux, boot into that, and access recovery tools. From there, you can definitely run chkdsk, done it before though I don't recall every step.

[-] ryonia@beehaw.org 4 points 11 months ago

For those who don't know, shift+F10 to bring up a command prompt when using a windows install image. Can do it when it starts asking you for stuff. I know the chkdsk tools and manage-bde (the bitlocker cli) are avaliable there at least.

[-] SpaceCadet@feddit.nl 4 points 11 months ago* (last edited 11 months ago)

100% possible with a Windows 10 guest in kvm/libvirt.

You can connect the disk to your Linux system, and then pass through the disk's entire block device to the VM. Windows will see the device as an actual disk, and you can perform your repairs that way. I have something like this in my domain definition to pass through my game drive to my Windows 10 VM: https://pastebin.com/GzuvMTWP

I can even use the manufacturer's SSD maintenance tool from my VM.

Edit: lemmy doesn't seem to like XML in code blocks, so used pastebin instead.

[-] palordrolap@kbin.social 2 points 11 months ago

Tentatively yes.

I did once manage to mount an external USB NTFS drive to a VirtualBox-hosted copy of Windows 7 and was actually able to defrag it. I assume I also ran a quick disk check before that, but it was a long time ago now.

Before I did it, I backed up everything important off the drive to another location just in case. I'd recommend you do the same.

As to how I did it, I'm afraid I don't remember, but it can't have been that difficult. There may have been some kind of raw mount option in the virtualisation software.

The other potential obstacle is the fact that things have moved on since I did it. Newer Windows / NTFS might be not be as easy to fool into accepting a drive over weird virtualisation pathways. Or the virtualisation software might not allow it as easily or at all.

Hopefully that's not the case.

[-] mvirts@lemmy.world 2 points 11 months ago* (last edited 11 months ago)

Yes. But since we're in Linux land, you may be able to replay the journal and un-dirty your disk by mounting with the ntfs3 driver listed here https://docs.kernel.org/filesystems/ntfs3.html, or you could try using 'ntfsfix -d [your device]' from the ntfs-3g package to clear the journal and the dirty bit, although whatever the last operation was on the filesystem may be left in an incomplete state since the journal is not replayed.

I haven't done it in a while, but with virtualbox I have used direct disk access by creating a special vmdk with vboxmanage to give a VM access to real partitions.

this post was submitted on 08 Dec 2023
9 points (84.6% liked)

Linux

48033 readers
765 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS