• Home
  • About
  • Contact
  • Privacy
  • Terms
  • DCMA
  • Write For Us / Submit
Tech News, Magazine & Review WordPress Theme 2017
  • Tech
    transfer whatsapp from android to iphone

    How to Transfer WhatsApp from Android to iPhone!

    Understanding the Role of Humidity Chambers in Climate Testing

    Understanding the Role of Humidity Chambers in Climate Testing

    Everything You Get to Know About Movember Beard Memes

    Everything You Get to Know About Movember Beard Memes

    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

    Enhance your omnichannel service strategies with data-driven insights.

    Black Market for Fraudulent Ad Accounts Found on Facebook

    Sen. Mark Warner and Sen. Marco Rubio at a hearing.

    Trump’s TikTok ban might have been right after all

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    6 Android Apps for Budget Management

    Twitter, Facebook, Lyft layoffs spark fears of dotcom crash 2.0

  • Gear
    • All
    • Camera
    • Laptop
    • Smartphone
    Latest Smart Home Gadgets for a Connected Life

    Latest Smart Home Gadgets for a Connected Life

    Eco-Friendly Products for Students

    Eco-Friendly Products for Students

    Essential Photography Equipment and Gadgets

    Mastering Your Shots: Essential Photography Equipment and Gadgets

    Level Up Your Game: Must-Have Gaming Gear!

    Level Up Your Game: Must-Have Gaming Gear!

    Pixel Watch in the test

    Google Pixel Watch in the Test

    Top 5 Websites To Buy Camera Lenses At Reasonable Price

    Top 5 Websites To Buy Camera Lenses At Reasonable Price

    Trending Tags

    • Best iPhone 7 deals
    • Apple Watch 2
    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • iOS 10
    • iPhone 7
    • Sillicon Valley
  • Gaming
    9 Best Alternative Games Like Kahoot

    9 Best Alternative Games Like Kahoot

    The Top 8 Free Bubble Shooter Games for Endless Entertainment

    The Top 8 Free Bubble Shooter Games for Endless Entertainment

    Cloud Gaming Revolution: How Streaming is Changing the Future of Gaming

    Cloud Gaming Revolution: How Streaming is Changing the Future of Gaming

    Level Up Your Game: Must-Have Gaming Gear!

    Level Up Your Game: Must-Have Gaming Gear!

    Game Streaming Platforms: Evolution & Impact on Industry

    Game Streaming Platforms: Evolution & Impact on Industry

    The Rise of Esports Games

    Esports Games: Exploring the Ecosystem, Growth, and Impact

  • Crypto
    transfer whatsapp from android to iphone

    How to Transfer WhatsApp from Android to iPhone!

    Understanding the Role of Humidity Chambers in Climate Testing

    Understanding the Role of Humidity Chambers in Climate Testing

    Everything You Get to Know About Movember Beard Memes

    Everything You Get to Know About Movember Beard Memes

    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

    Enhance your omnichannel service strategies with data-driven insights.

    Black Market for Fraudulent Ad Accounts Found on Facebook

    Sen. Mark Warner and Sen. Marco Rubio at a hearing.

    Trump’s TikTok ban might have been right after all

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    6 Android Apps for Budget Management

    Twitter, Facebook, Lyft layoffs spark fears of dotcom crash 2.0

  • Business
    transfer whatsapp from android to iphone

    How to Transfer WhatsApp from Android to iPhone!

    Understanding the Role of Humidity Chambers in Climate Testing

    Understanding the Role of Humidity Chambers in Climate Testing

    Everything You Get to Know About Movember Beard Memes

    Everything You Get to Know About Movember Beard Memes

    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

    Enhance your omnichannel service strategies with data-driven insights.

    Black Market for Fraudulent Ad Accounts Found on Facebook

    Sen. Mark Warner and Sen. Marco Rubio at a hearing.

    Trump’s TikTok ban might have been right after all

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    6 Android Apps for Budget Management

    Twitter, Facebook, Lyft layoffs spark fears of dotcom crash 2.0

No Result
View All Result
Geeky Insider
  • Tech
    transfer whatsapp from android to iphone

    How to Transfer WhatsApp from Android to iPhone!

    Understanding the Role of Humidity Chambers in Climate Testing

    Understanding the Role of Humidity Chambers in Climate Testing

    Everything You Get to Know About Movember Beard Memes

    Everything You Get to Know About Movember Beard Memes

    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

    Enhance your omnichannel service strategies with data-driven insights.

    Black Market for Fraudulent Ad Accounts Found on Facebook

    Sen. Mark Warner and Sen. Marco Rubio at a hearing.

    Trump’s TikTok ban might have been right after all

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    6 Android Apps for Budget Management

    Twitter, Facebook, Lyft layoffs spark fears of dotcom crash 2.0

  • Gear
    • All
    • Camera
    • Laptop
    • Smartphone
    Latest Smart Home Gadgets for a Connected Life

    Latest Smart Home Gadgets for a Connected Life

    Eco-Friendly Products for Students

    Eco-Friendly Products for Students

    Essential Photography Equipment and Gadgets

    Mastering Your Shots: Essential Photography Equipment and Gadgets

    Level Up Your Game: Must-Have Gaming Gear!

    Level Up Your Game: Must-Have Gaming Gear!

    Pixel Watch in the test

    Google Pixel Watch in the Test

    Top 5 Websites To Buy Camera Lenses At Reasonable Price

    Top 5 Websites To Buy Camera Lenses At Reasonable Price

    Trending Tags

    • Best iPhone 7 deals
    • Apple Watch 2
    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • iOS 10
    • iPhone 7
    • Sillicon Valley
  • Gaming
    9 Best Alternative Games Like Kahoot

    9 Best Alternative Games Like Kahoot

    The Top 8 Free Bubble Shooter Games for Endless Entertainment

    The Top 8 Free Bubble Shooter Games for Endless Entertainment

    Cloud Gaming Revolution: How Streaming is Changing the Future of Gaming

    Cloud Gaming Revolution: How Streaming is Changing the Future of Gaming

    Level Up Your Game: Must-Have Gaming Gear!

    Level Up Your Game: Must-Have Gaming Gear!

    Game Streaming Platforms: Evolution & Impact on Industry

    Game Streaming Platforms: Evolution & Impact on Industry

    The Rise of Esports Games

    Esports Games: Exploring the Ecosystem, Growth, and Impact

  • Crypto
    transfer whatsapp from android to iphone

    How to Transfer WhatsApp from Android to iPhone!

    Understanding the Role of Humidity Chambers in Climate Testing

    Understanding the Role of Humidity Chambers in Climate Testing

    Everything You Get to Know About Movember Beard Memes

    Everything You Get to Know About Movember Beard Memes

    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

    Enhance your omnichannel service strategies with data-driven insights.

    Black Market for Fraudulent Ad Accounts Found on Facebook

    Sen. Mark Warner and Sen. Marco Rubio at a hearing.

    Trump’s TikTok ban might have been right after all

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    6 Android Apps for Budget Management

    Twitter, Facebook, Lyft layoffs spark fears of dotcom crash 2.0

  • Business
    transfer whatsapp from android to iphone

    How to Transfer WhatsApp from Android to iPhone!

    Understanding the Role of Humidity Chambers in Climate Testing

    Understanding the Role of Humidity Chambers in Climate Testing

    Everything You Get to Know About Movember Beard Memes

    Everything You Get to Know About Movember Beard Memes

    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

    Enhance your omnichannel service strategies with data-driven insights.

    Black Market for Fraudulent Ad Accounts Found on Facebook

    Sen. Mark Warner and Sen. Marco Rubio at a hearing.

    Trump’s TikTok ban might have been right after all

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    6 Android Apps for Budget Management

    Twitter, Facebook, Lyft layoffs spark fears of dotcom crash 2.0

Submit
Geeky Insider
No Result
View All Result

How to Increase a KVM Virtual Machine’s Disk Size

by Staff Writer
October 13, 2022
in How To
Reading Time: 6 mins read
Photo of the internals of hard drives
Share on FacebookShare on Twitter

Shutterstock.com/zentilia

KVM is a virtualization technology that’s integrated into the Linux kernel. You can create virtual machines and interact with KVM using tools such as virsh, virt-manager, and GNOME Boxes.

Running out of disk space is one of the most common VM guest issues. You might have started out with an intentionally small disk while you tested a new VM. Over time you accumulate files until the virtual disk is almost full. Here’s how to resize your disk in-place, without having to copy files to a separate larger drive.

Table of Contents

    • READ ALSO
    • How to Turn Off Autoplay on YouTube
    • How to go through your CV in a job interview
  • Shut Down Your VM
  • Find The Disk’s Location
  • Delete VM Snapshots
  • Resizing the Disk
  • Extending the Disk’s Partitions
  • Downsizing a Disk
  • Summary

READ ALSO

How to protect yourself from phishing

Phishing: The nasty tricks of the cybercriminals – this is how they protect themselves

July 28, 2023
How to Unsend an Email in Outlook

How to Unsend an Email in Outlook

November 16, 2022

Shut Down Your VM

Begin by shutting down your virtual machine. You can shutdown within the guest operating system, using the controls in your management UI, or by issuing the virsh shutdown command:

$ sudo virsh list
Id Name State
——————————
– ubuntu22.04 running

$ sudo virsh shutdown ubuntu22.04
Domain ubuntu22.04 is being shutdown

Wait until the VM is powered off. It will disappear from the virsh list output after it shuts down. You can see details of inactive VMs by adding the –all flag:

$ sudo virsh list –all
Id Name State
——————————
– ubuntu22.04 shut off

Find The Disk’s Location

Next you need to identify the path where your VM’s disk is saved. Each VM gets a disk image file that stores the complete content of its filesystem. Several formats can be used including QCOW2, VDI, VMDK, and VHDX.

Most VMs created in a modern KVM environment will have a QCOW2 disk image stored inside the /var/lib/libvirt/images directory. The file’s name will match the name of the VM that’s displayed in the virsh list command’s output.

You can check the path to a VM’s disk by running virsh domblklist:

$ sudo virsh domblklist ubuntu22.04
Target Source
—————————————————–
sdb /var/lib/libvirt/images/ubuntu22.04.qcow2

This confirms the file to resize for this VM is /var/lib/libvirt/images/ubuntu22.04.qcow2.

Delete VM Snapshots

You can’t resize disk images which have snapshots stored against them. You’ll have to delete snapshots before you perform the resize. If you need to keep snapshots, clone the VM first and use the copy to access the snapshotted states. You can then delete the snapshots from the original VM and continue your resize operation.

The virsh snapshot-list command will reveal whether your VM has any snapshots:

$ virsh snapshot-list ubuntu22.04
Name Creation Time State
—————————————————
13-09-2022 2022-09-13 22:36:41 +0100 shutoff

Delete them with the snapshot-delete command. The snapshot to delete is identified using <vm-name> <snapshot-name> syntax.

$ virsh snapshot-delete ubuntu22.04 13-09-2022

Resizing the Disk

The qemu-img command can now be used to resize the disk. Its arguments are the path to the disk image file and the amount of extra capacity to add to the disk.

$ sudo qemu-img resize /var/lib/libvirt/images/ubuntu22.04.qcow2 +16G

The +16G means the disk will become 16 GB larger than its current size. You can use other standard suffixes too such as M for megabytes and T for terabytes. Omitting the + notation instructs QEMU to make the disc a specific size, such as 1T to provide 1 TB of capacity.

The resize process should only take a few seconds. It won’t necessarily have an immediate effect on your host’s total disk usage depending on the image format used.

Extending the Disk’s Partitions

Next boot up your virtual machine and use the guest operating system’s disk management utility to extend the disc’s partition table into the newly allocated free space. Without this step your new capacity won’t be accessible to the operating system.

Linux’s resize2fs command will automatically grow a designated partition to the maximum extent allowed by any available free space:

$ sudo resize2fs /dev/sda

Find the right device to target (/dev/sda in the command above) by running df -h and looking for the filesystem that’s mounted to /:

$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda 32G 17G 15G 53% /

To resize the partition graphically you could use GParted or GNOME Disks in a Linux guest or Disk Management for a Windows machine.

Here’s the Ubuntu 22.04 virtual machine that had its disk resized by 16 GB in the example above. After starting the guest and opening GParted, the 16 GB of free space is visible as an unallocated area at the end of the disk.

image of partitions in gParted

The space is brought into use by right-clicking the existing system partition, selecting “Resize/Move” from GParted’s menu, and growing the partition into the free space at the end. After applying the operation, the partition has a usable capacity of 48 GB as expected.

image of partitions in gParted

Downsizing a Disk

Disk images can be downsized if your VM’s been allocated more storage than it needs. This is a potentially risky operation. Backup your disk before you start the resize so you can recover the situation if data gets deleted:

$ sudo cp /var/lib/libvirt/images/ubuntu22.04.qcow2 ubuntu22.04.qcow2.bak

Next you must adjust the partition table from within the VM so that there’s unallocated free space available on the disk. When you’re resizing a 32 GB disk to 20 GB, you should ensure there’s at least 12 GB of free space at the end of the partition table, for example. Forgetting this step will cause the resize to indiscriminately delete data from the end of the disk, corrupting the partition table and leaving your VM unbootable.

This Windows 10 machine has a 40 GB disk of which only 32 GB is mapped into partitions. The 8 GB unallocated space at the end of the drive means you can safely downsize the disk by up to 8 GB.

image of Windows 10's Disk Management utility

Once you’ve prepared your partitions, you can use qemu-img resize to perform the downsize. Support for this operation must be manually enabled every time by including the –shrink flag with your command. This lets you specify a target size smaller than the disk’s current capacity. You can also -8G syntax to downsize by a predetermined amount.

$ qemu-img resize –shrink /var/lib/libvirt/images/win10.qcow2 -8G

After rebooting the guest, Windows confirms the 8GB free space has been removed from the end of the disk.

image of Windows 10's Disk Management utility

Summary

Disk images used by KVM virtual machines can be resized with the virsh and qemu-img commands. Resizing a disk is reliable and should complete in a matter of seconds but it doesn’t work when VMs have stored snapshots. It’s always a good idea to back up your disk image before you start work.

Some KVM GUIs such as GNOME Boxes include support for resizes, letting you enlarge a disk without using the terminal. However you apply the resize, you must boot up the guest VM afterwards and adjust the partition table to use the space. This allows the operating system to utilize the increased disk capacity.



Source by www.howtogeek.com

Related Posts

transfer whatsapp from android to iphone
Articles

How to Transfer WhatsApp from Android to iPhone!

September 19, 2023
How to prevent phishing attacks
How To

How to Prevent Phishing Attacks: Safeguarding Your Digital Identity

May 14, 2023
How to Activate Iphone With Sim Card
Apple

How to Activate Iphone With Sim Card

March 3, 2023
How to quickly divide or Split PDF files
Apps And Softwares

How to Quickly Divide or Split PDF Files

February 28, 2023

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended.

How to Set Up a Greenscreen on a Budget (2022): Stands, Materials, Lighting

How to Set Up a Greenscreen on a Budget (2022): Stands, Materials, Lighting

October 14, 2022
Browser-based spell check from Google and Microsoft can lead to stolen personal data

Browser-based spell check from Google and Microsoft can lead to stolen personal data

September 18, 2022

Trending.

MicroSD card in hand.

How to Move Apps to SD Card on an Amazon Fire Tablet

October 5, 2022
How to Downgrade Google Chrome to an Older Version

How to Downgrade Google Chrome to an Older Version

September 7, 2022
Google's No Internet Dino game running on a laptop computer

How to Hack the Hidden Google Chrome Dinosaur Game

October 23, 2022
Employee Payroll Management Software Simplifying Processes

Employee Payroll Management Software: Simplifying Processes

August 23, 2023
Symbolic Link Header Image. A Windows folder on a blue background.

The Complete Guide to Creating Symbolic Links (aka Symlinks) on Windows

July 27, 2022
Geeky Insider

Geeky Insider is Web based independent Tech Magazine covering Topics Related to Technology, Gadgets, Software, Gaming, Crypto, Business And So on. Read More...

Submit a Techy Post | Write For Us

Feel free to contact us for submission queries. via contact form or email us at [email protected].

Categories

  • Android
  • Apple
  • Apps And Softwares
  • Articles
  • Business
  • Camera
  • Crypto
  • Education
  • Entertainment
  • Gadget and Gear
  • Gaming
  • How To
  • Laptop
  • Marketing
  • Microsoft
  • Review
  • Security
  • Smartphone
  • Technology
00-samsung FRP unlock tool

Unlock Samsung in Minutes: 5 Proven Hacks with the Ultimate FRP Unlock Tool!

September 19, 2023
transfer whatsapp from android to iphone

How to Transfer WhatsApp from Android to iPhone!

September 19, 2023
Understanding the Role of Humidity Chambers in Climate Testing

Understanding the Role of Humidity Chambers in Climate Testing

September 4, 2023
  • Home
  • About
  • Contact
  • Privacy
  • Terms
  • DCMA
  • Write For Us / Submit

© 2022 GeekyInsider.com

No Result
View All Result
  • Home
  • Review
  • Apple
  • Gaming
  • Gadget and Gear
    • Camera
    • Smartphone
  • Microsoft
  • Security