0

I am tyring to understand linux file system layout. Why does the command work inside virtual box but not on linux shell on windows?

I tried to use the command sudo fdisk -l dev/sda on both my virtual box(Ubuntu) and Ubuntu on windows(from microsoft store). It didn't work on any of them but when I changed the command to sudo fdisk -l, it worked inside virtual box but not on linux bash shell on windows.

Inside linux shell on windows:

~$ sudo fdisk -l /dev/sda
fdisk:cannot open /dev/sda: No such file or directory
:~$ sudo fdisk -l 
fdisk: cannot open /proc/partitions: No such file or directory
:~$ man fdisk 
:~$ whereis fdisk
fdisk: /sbin/fdisk /usr/share/man/man8/fdisk.8.gz
  • I assume you are speaking about WSL-1. This is not a real Linux kernel: it is Linux ABI emulation written by Microsoft. Disks are not under the control of Linux, so you can't access them. You need real Linux: either WSL-2 or fresh install on virtual machine (virtualbox, hyper-v or vmware) – user996142 Nov 7 at 22:41
0

There are several issues that may be happening here. The most likely one is that VirtualBox does not provide the disk drive as a serial interface. Potentially it virtualises the old IDE drive.

To check that, open a terminal and execute:

ls -l /dev/disk/by-path/

You will see several links with the associated paths. Note what the links link to (it maybe something like ../../hda) These are the drives that your system sees.

Alternatively, if those disks are already mounted (and at the very least one should be) you can run

mount -l -t ext4

This should list all the ext4 partitions that are currently mounted (i assume here that you have formatted your drive as an ext4 partition, if you have for whatever reason chose a different file system, you can ommit the -t type and try to find your partition or provide the file system format that you have used).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.