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.
3 Answers
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.
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,
- Win32 Disk Imager: a dedicated cloning tool
- Rufus in 'dd-mode': cloning (default mode: extracting the files into a FAT32 file system)
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.
-
1As an alternative I would also recommend trying Cygwin's dd binary, it has worked perfectly for me and I still use it to backup disk and partition images. Nov 12, 2019 at 16:59
-
@PanosKordis, Thanks for this tip :-) Please write an answer and describe how to identify the drives in Cygwin, and the command line to use, and I will upvote it.
dd
can be very useful, but risky. There is no 'safety belt' against writing to the wrong drive.– sudodusNov 12, 2019 at 17:24
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
-
1
dd
in an OS like Windows.dd
being used there is NOT going to work properly. DO NOT use it in WSL!dd
on mounted devices in WSL 2 which is scheduled to be released in April, 2020.