Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
extend_hard_disk_debian_vm [2021/07/15 19:18]
warmachine created
extend_hard_disk_debian_vm [2021/07/16 00:50] (current)
warmachine
Line 1: Line 1:
-expand hard disk in linux vm +expand hard disk in linux vm\\ 
- +\\ 
--merge all checkpoints +-merge all checkpoints\\ 
--shutdown VM +-shutdown VM\\ 
--make a copy of your virtual hard drive and store in another location  just in case +-make a copy of your virtual hard drive and store in another location  just in case\\ 
--rightclick VM, seetings, edit +-rightclick VM, seetings, edit\\ 
--virtual hard drive from left menu +-virtual hard drive from left menu\\ 
--edit +-edit\\ 
--click next +-click next\\ 
--choose expand, click next +-choose expand, click next\\ 
--select new size, click finish, click OK +-select new size, click finish, click OK\\ 
--start VM +-start VM\\ 
- +\\ 
--ssh to VM +-ssh to VM\\ 
--sudo fdisk /dev/sda +-sudo fdisk /dev/sda\\ 
--p to list partitions +-p to list partitions\\ 
--d to delete the partitions, then 1, d, 2, etc (data will not be lost) +-d to delete the partitions, then 1, d, 2, etc (data will not be lost)\\ 
--n for a new partition +-n for a new partition\\ 
--p for primary, 1 for 1st, 2048 for starting sector, largest possible for last sector +-p for primary, 1 for 1st, 2048 for starting sector, largest possible for last sector\\ 
--if asked partition contains ext4 signare do you want to remove? choose no +-if asked partition contains ext4 signare do you want to remove? choose no\\ 
--p to verify partitions and size +-p to verify partitions and size\\ 
--a to make the partition bootable +-a to make the partition bootable\\ 
--w to write changes. may get a message about re-reading the table failed. this is ok. +-w to write changes. may get a message about re-reading the table failed. this is ok.\\ 
--sudo reboot +-sudo reboot\\ 
--wait (it takes time to apply the changes, so if ssh doesn't work immediately, wait. connecting through hyperv to watch the messages will show it is working). +-wait (it takes time to apply the changes, so if ssh doesn't work immediately, wait. connecting through hyperv to watch the messages will show it is working).\\ 
--sudo resize2fs /dev/sda1 (this expands the partition to use the rest of the space we just reated) +-sudo resize2fs /dev/sda1 (this expands the partition to use the rest of the space we just reated)\\ 
--df -h to confirm +-df -h to confirm\\ 
- +\\ 
--if your swap partition was deleted, create a swap file +-if your swap partition was deleted, create a swap file\\ 
--sudo fallocate -l 512M /swapfile +-sudo fallocate -l 512M /swapfile\\ 
--sudo chmod 600 /swapfile +-sudo chmod 600 /swapfile\\ 
--sudo mkswap /swapfile +-sudo mkswap /swapfile\\ 
--sudo swapon /swapfile +-sudo swapon /swapfile\\ 
--sudo swapon --show to verify +-sudo swapon --show to verify\\ 
--sudo cp /etc/fstab /etc/fstab.bak to backup the fstab +-sudo cp /etc/fstab /etc/fstab.bak to backup the fstab\\ 
--echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab to make your swap perminant +-echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab to make your swap perminant\\ 
--sudo nano /etc/sysctl.conf +-sudo nano /etc/sysctl.conf\\ 
--add to the end: +-add to the end:\\ 
-vm.swappiness=10 +vm.swappiness=10\\ 
-vm.vfs_cache_pressure=50 +vm.vfs_cache_pressure=50\\ 
--save +-save\\ 
- +\\ 
-go back into fstab and remove old swap partition uuid +go back into fstab and remove old swap partition uuid\\ 
- +\\ 
- +\\ 
-references: +references:\\ 
- +\\ 
-[[https://www.zubairalexander.com/blog/how-to-expand-hard-drives-in-hyper-v-virtual-machines]] +[[https://www.zubairalexander.com/blog/how-to-expand-hard-drives-in-hyper-v-virtual-machines]]\\ 
- +\\ 
-[[https://askubuntu.com/questions/116351/increase-partition-size-on-which-ubuntu-is-installed]] +[[https://askubuntu.com/questions/116351/increase-partition-size-on-which-ubuntu-is-installed]]\\ 
- +\\ 
-[[https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04]] +[[https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04]]\\ 
 +\\
Last modified: le 2021/07/15 19:18