4

I installed Ubuntu app on Window 10 OS and trying to run dd command. But the dd command is not listing all drives present in system. I am not sure whether is it Ubuntu app limitation or something is missing in configuration. Please provide me inputs to resolve this issue.

Sagar
  • 49
  • 1
  • 2

3 Answers3

8

You can't.

WSL is not a complete environment. Notably, it lacks a Linux kernel.

WSL is an abstraction layer that allows execution of 64-bit ELF binaries on Windows. It does not provide the traditional Linux device access.

This may change somewhat with WSL2, which is HyperV-based virtualization solution.

vidarlo
  • 23,497
5

Ubuntu and Linux in general running in Windows

As already stated by in the answer by @vidarlo, WSL cannot do everything, that we are used to do in Ubuntu (or Linux in general). But it is a good tool, that provides several of the tools and functions, that we are used to from Ubuntu.

Another alternative, that also suffers from limitations due to the lack of a Linux kernel is the old CygWin.

@vidarlo also mentioned a virtualization solution, that might improve the capability of the next generation of WSL.

There are already other (and general) virtualization solutions. Maybe the most common one for personal use is VirtualBox.

If your computer has enough CPU 'horsepower' and enough memory (RAM), you can run the real Ubuntu live and/or install it in a virtual machine using VirtualBox.

Alternatives to dd in Windows

You want to use dd in WSL. It makes me think that you want to clone from a hybrid iso file, file.iso, or maybe from some other kind of image file file.img to a device, for example a USB pendrive, a memory card, an SSD or a hard disk drive.

In this case you can use Windows tools for cloning,


If you want to do other tasks, for example recovering data from a failing drive, it may be a good idea to create a [persistent] live drive with Ubuntu, install ddrescue from the repository with the package gddrescue and maybe some other tools into it (for example TestDisk and PhotoRec) and work from there.

sudodus
  • 47,684
1

I would recommend giving Cygwin's dd a try.

To find the path to the disk or partition to use as input, view the file /proc/partitions

$ cat /proc/partitions 
major minor  #blocks  name   win-mounts

    8     0 125034840 sda
    8     1    562176 sda1  
    8     2 124470272 sda2   C:\
    8    16 3907018583 sdb
    8    17    131072 sdb1
    8    18 3906885632 sdb2   D:\

first.

To backup the entire disk a Windows partition resides in (e.g. sda2) use a command line like this,

dd if=/dev/sda ...

/dev/sda for the entire disk instead of the partition /dev/sda2

sudodus
  • 47,684