Last active
August 22, 2022 03:28
-
-
Save xbalaji/5b8bc05cffc8292df7ee0e1bb87a19be to your computer and use it in GitHub Desktop.
vm-custom.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create the vm - vmx config | |
$grep -i "sharedfolder[0-9]" /mnt/g/Virtual\ Machines/xb-tfe/*.vmx | |
sharedFolder0.present = "TRUE" | |
sharedFolder0.enabled = "TRUE" | |
sharedFolder0.readAccess = "TRUE" | |
sharedFolder0.writeAccess = "TRUE" | |
sharedFolder0.hostPath = "E:\Balaji\home" | |
sharedFolder0.guestName = "xbhome" | |
sharedFolder0.expiration = "never" | |
sharedFolder1.present = "TRUE" | |
sharedFolder1.enabled = "TRUE" | |
sharedFolder1.readAccess = "TRUE" | |
sharedFolder1.writeAccess = "TRUE" | |
sharedFolder1.hostPath = "E:\BigFiles" | |
sharedFolder1.guestName = "edrive" | |
sharedFolder1.expiration = "never" | |
sharedFolder2.present = "TRUE" | |
sharedFolder2.enabled = "TRUE" | |
sharedFolder2.readAccess = "TRUE" | |
sharedFolder2.writeAccess = "TRUE" | |
sharedFolder2.hostPath = "G:\TorrentDownload" | |
sharedFolder2.guestName = "TorrentDownload" | |
sharedFolder2.expiration = "never" | |
# make directories for mount point | |
mkdir -p /host/edrive /host/xbhome /host/torrentdownload | |
# create a new user, so you can modify the home directory of the main user | |
useradd -m -s /bin/bash -G sudo xbalajie | |
echo "xbalajie:balajiv" | sudo chpasswd | |
# grep sudo /etc/group | |
sudo:x:27:xbalaji,xbalajie | |
# reboot the system, login as xbalajie and update home directory for main user | |
usermod -d /host/xbhome xbalaji | |
# grep xbal /etc/passwd | |
xbalaji:x:1000:1000:xbalaji:/host/xbhome:/bin/bash | |
xbalajie:x:1001:1001::/home/xbalajie:/bin/bash | |
# update mount point in /etc/fstab | |
.host:/edrive /host/edrive fuse.vmhgfs-fuse defaults,rw,allow_other 0 0 | |
.host:/xbhome /host/xbhome fuse.vmhgfs-fuse defaults,rw,allow_other,uid=1000,gid=1000,umask=077 0 0 | |
.host:/torrentdownload /host/torrentdownload fuse.vmhgfs-fuse defaults,rw,allow_other 0 0 | |
------------------------------------- | |
### step 1: to increase logical volume - observe the logical (lv) size, only 11G | |
root@xb-tfe-01:/host/xbhome# df -h | |
Filesystem Size Used Avail Use% Mounted on | |
tmpfs 792M 1.6M 791M 1% /run | |
/dev/mapper/ubuntu--vg-ubuntu--lv 19G 6.8G 11G 39% / | |
tmpfs 3.9G 0 3.9G 0% /dev/shm | |
tmpfs 5.0M 0 5.0M 0% /run/lock | |
vmhgfs-fuse 207G 168G 39G 82% /host/torrentdownload | |
vmhgfs-fuse 150G 107G 44G 72% /host/edrive | |
vmhgfs-fuse 150G 107G 44G 72% /host/xbhome | |
/dev/sda2 2.0G 127M 1.7G 7% /boot | |
tmpfs 792M 4.0K 792M 1% /run/user/1000 | |
### step 2: to increase logical volume, lsblock shows sda3 is 39G, only 19G is allocated to lv | |
root@xb-tfe-01:/host/xbhome# lsblk | |
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS | |
loop0 7:0 0 62M 1 loop /snap/core20/1587 | |
loop1 7:1 0 47M 1 loop /snap/snapd/16292 | |
loop2 7:2 0 79.9M 1 loop /snap/lxd/22923 | |
sda 8:0 0 40G 0 disk | |
├─sda1 8:1 0 1M 0 part | |
├─sda2 8:2 0 2G 0 part /boot | |
└─sda3 8:3 0 38G 0 part | |
└─ubuntu--vg-ubuntu--lv 253:0 0 19G 0 lvm / | |
sr0 11:0 1 1024M 0 rom | |
### step 3: to increase logical volume, now extend the lv additional 19G :38G (sda3 size) - 19G (current lv size) | |
root@xb-tfe-01:/host/xbhome# lvextend -L +19G /dev/mapper/ubuntu--vg-ubuntu--lv | |
Size of logical volume ubuntu-vg/ubuntu-lv changed from <19.00 GiB (4863 extents) to <38.00 GiB (9727 extents). | |
Logical volume ubuntu-vg/ubuntu-lv successfully resized. | |
### step 4: to increase logical volume, lsblock now has the logical volume expanded | |
root@xb-tfe-01:/host/xbhome# lsblk | |
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS | |
loop0 7:0 0 62M 1 loop /snap/core20/1587 | |
loop1 7:1 0 47M 1 loop /snap/snapd/16292 | |
loop2 7:2 0 79.9M 1 loop /snap/lxd/22923 | |
sda 8:0 0 40G 0 disk | |
├─sda1 8:1 0 1M 0 part | |
├─sda2 8:2 0 2G 0 part /boot | |
└─sda3 8:3 0 38G 0 part | |
└─ubuntu--vg-ubuntu--lv 253:0 0 38G 0 lvm / | |
sr0 11:0 1 1024M 0 rom | |
### step 5: to increase logical volume, resize the file system now in the logical volume | |
root@xb-tfe-01:/host/xbhome# resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv | |
resize2fs 1.46.5 (30-Dec-2021) | |
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required | |
old_desc_blocks = 3, new_desc_blocks = 5 | |
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 9960448 (4k) blocks long. | |
### step 6: to increase logical volume, run df -h, size increased from 11G to 38G | |
root@xb-tfe-01:/host/xbhome# df -h | |
Filesystem Size Used Avail Use% Mounted on | |
tmpfs 792M 1.6M 791M 1% /run | |
/dev/mapper/ubuntu--vg-ubuntu--lv 38G 6.8G 29G 19% / | |
tmpfs 3.9G 0 3.9G 0% /dev/shm | |
tmpfs 5.0M 0 5.0M 0% /run/lock | |
vmhgfs-fuse 207G 168G 39G 82% /host/torrentdownload | |
vmhgfs-fuse 150G 107G 44G 72% /host/edrive | |
vmhgfs-fuse 150G 107G 44G 72% /host/xbhome | |
/dev/sda2 2.0G 127M 1.7G 7% /boot | |
tmpfs 792M 4.0K 792M 1% /run/user/1000 | |
$cat mount-help.sh | |
# mount vmplayer shared directory | |
#sudo mkdir -p /mnt/hgfs | |
sudo mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other | |
# mount remote machine windows or samba share | |
#sudo mkdir -p $HOME/remote | |
#sudo mount -t cifs -o user=<remote-user> //${REMOTE_HOST}/${REMOTE_EXPORT} $HOME/remote | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment