Make VMware Workstation on Linux Use Whole Disk without sudo privilege
With VMware Workstation, we can select a physical disk for use in a virtual machine.
However, accessing raw disks will require us to launch vmware
with sudo
, which is inconvenient.
To solve this, we can add ourself to the disk
group with the following command:
sudo usermod -a -G disk $USER
A reboot or logout/login is required after this operation. Then we can launch vmware
without sudo
, but still has the ability to access raw disks.
This will work because raw disks are owned by user root
and group disk
, and adding ourself to the disk
group effectively gives us enough privilege. We can check this with the following command:
$ ls -l /dev/sdw
brw-rw---- 1 root disk 8, 0 Jun 17 14:55 /dev/sda
brw-rw---- 1 root disk 8, 1 Jun 17 14:55 /dev/sda1
brw-rw---- 1 root disk 8, 2 Jun 17 14:55 /dev/sda2
brw-rw---- 1 root disk 8, 16 Jun 17 14:55 /dev/sdb
brw-rw---- 1 root disk 8, 32 Jun 17 14:55 /dev/sdc
brw-rw---- 1 root disk 8, 33 Jun 17 14:55 /dev/sdc1