venerdì 23 febbraio 2024

UBUNTU - How do I mount shared folders in Ubuntu using VMware

Per condividere una directory tra host e VM occorre prima accedere a vmware "Virtual Machine Settings" e spostarsi su "Options". 

In questo tab accedere a "Shared Folders" e configurare una directory di cui fare lo share. 

Lato Ubuntu una volta configurato vmware effettuare la configurazione del file fstab. Ma prima occorre configurare i tools di vmware su Ubuntu.

Eseguire il seguente comando per abilitare i tools:

  • sudo apt-get install open-vm-tools open-vm-tools-desktop
A questo punto accedere al file fstab ed aggiungere la stringa che permette la mount della directory presente sull'host.

  • sudo vi /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda3 during installation
UUID=dad2f2d1-2c0a-4e88-831c-67a122f0572c /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda2 during installation
UUID=DA2B-A740  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0

A questo punto aggiungere al termine del file la stringa che permette di effettuare la mount della directory host:

.host:/ORACLE_PROJECT    /mnt/hgfs/ORACLE_PROJECT/    fuse.vmhgfs-fuse    defaults,allow_other,uid=1000     0    0

Salvare il file e creare la directory indicata sopra:
  • cd /mnt/hgfs
  • mkdir ORACLE_PROJECT
A questo punto fare un test eseguendo il comando :
  • mount -a
Se tutto ok allora avremo effettuato correttamente la mount.

orcl1521@orcl1521-virtual-machine:~$ ll /mnt/hgfs
total 28
drwxr-xr-x 3 root     root  4096 feb 23 17:44 ./
drwxr-xr-x 3 root     root  4096 feb 19 17:12 ../
drwxrwxrwx 1 orcl1521 root 20480 feb 23 17:42 ORACLE_PROJECT/
orcl1521@orcl1521-virtual-machine:~$ ll /mnt/hgfs/ORACLE_PROJECT/
total 9308
drwxrwxrwx 1 orcl1521 root   20480 feb 23 17:42  ./
drwxr-xr-x 3 root     root    4096 feb 23 17:44  ../
drwxrwxrwx 1 orcl1521 root    4096 mag 11  2022  001_ORACLE_BASE_DBA_Scripts/
drwxrwxrwx 1 orcl1521 root    4096 gen 11  2023  02_WORKDAY/
-rwxrwxrwx 1 orcl1521 root  974608 feb 19 18:32  report_export1.xml*
-rwxrwxrwx 1 orcl1521 root  211773 feb 19 18:33  report_export2.xml*
-rwxrwxrwx 1 orcl1521 root   91339 feb 19 18:33  report_export3.xml*
-rwxrwxrwx 1 orcl1521 root  601587 feb 19 18:33  report_export4.xml*
-rwxrwxrwx 1 orcl1521 root  148404 feb 19 18:33  report_export5.xml*
-rwxrwxrwx 1 orcl1521 root  160672 feb 19 18:34  report_export6.xml*
-rwxrwxrwx 1 orcl1521 root  137419 gen 15  2019  report_export.xml*
drwxrwxrwx 1 orcl1521 root       0 mag 11  2022  SAP/
-rwxrwxrwx 1 orcl1521 root    3205 feb  1  2019  SEQ_INS_UPD_ANA_EDW_INV2*
-rwxrwxrwx 1 orcl1521 root  109350 apr 30  2019  seq.xml*
-rwxrwxrwx 1 orcl1521 root 3167755 feb 28  2017  SmartExport_PRJ_ODI_AEI_SVIL.xml*
drwxrwxrwx 1 orcl1521 root   12288 mag 11  2022  SOGEI/
drwxrwxrwx 1 orcl1521 root   12288 feb 16 14:05  sw/
drwxrwxrwx 1 orcl1521 root    4096 mag 11  2022  TEST_AEI/
drwxrwxrwx 1 orcl1521 root    4096 mag 11  2022  TEST_EOC/
-rwxrwxrwx 1 orcl1521 root  152302 mar 25  2019  Text1.txt*
-rwxrwxrwx 1 orcl1521 root    7143 mag 10  2019  Text2*
-rwxrwxrwx 1 orcl1521 root     228 apr 30  2019  Text3*