can you chkdsk from a windows vm? - eviltoast

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 =(

  • MentalEdge@sopuli.xyz
    link
    fedilink
    arrow-up
    6
    arrow-down
    2
    ·
    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 Coruscare@beehaw.org
      link
      fedilink
      arrow-up
      4
      ·
      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.

  • DefederateLemmyMl@feddit.nl
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    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
    link
    fedilink
    arrow-up
    2
    ·
    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
    link
    fedilink
    arrow-up
    3
    arrow-down
    1
    ·
    edit-2
    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.