LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-21-2017, 05:55 AM   #1
isaac.dvorz
Member
 
Registered: Apr 2015
Posts: 33

Rep: Reputation: Disabled
Help with expending HD on KVM


Hello,

I have a VPS with "EDIS" and recently they added extra 5GB of storage which I don't know how to use.
I tried asking them, they either don't know how to add it or doesn't want to help.

the server uses Debian 7, here is some info that I think is helpful, but I'm not sure what to do with it:

Code:
 fdisk -ls

Disk /dev/vda: 16.1 GB, 16106127360 bytes
16 heads, 63 sectors/track, 31207 cylinders, total 31457280 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00055096

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048      194559       96256   83  Linux
/dev/vda2          194560    10000383     4902912   83  Linux
/dev/vda3        10000384    10483711      241664   82  Linux swap / Solaris
Code:
(parted) print free
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 16.1GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system     Flags
        32.3kB  1049kB  1016kB           Free Space
 1      1049kB  99.6MB  98.6MB  primary  ext3            boot
 2      99.6MB  5120MB  5021MB  primary  xfs
 3      5120MB  5368MB  247MB   primary  linux-swap(v1)
        5368MB  16.1GB  10.7GB           Free Space

Of course I don't want to lose data and I can't unmount anything.
Thank you for your help.
 
Old 02-21-2017, 01:31 PM   #2
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
you won't be able to increase this without a reboot, since the kernel will refuse to reload the system table.

It's possible but more risk to get this down to just a reboot for downtime but as it is riskier, I'd advise using a proper tool such as gparted.

If you want a summary of the riskier method it'd be this.

swapoff /dev/vda3
fdisk -u /dev/sda
delete /dev/vda3
delete /dev/vda2
create /dev/vda2 at the same start location but 5G larger for end location
create new /dev/vda3 at new location
save

Reboot
xfs_growf /dev/vda2

This is definitely risker, if you recreate the partition wrong then it could be good game to your data and so unless you are willing to take such risks, I'd advise using a proper/dedicated tool for this work instead.

Last edited by r3sistance; 02-21-2017 at 01:34 PM.
 
Old 02-21-2017, 01:49 PM   #3
Timothy Miller
Moderator
 
Registered: Feb 2003
Location: Arizona, USA
Distribution: Debian, EndeavourOS, OpenSUSE, KDE Neon
Posts: 4,003
Blog Entries: 26

Rep: Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521
The way I do it (and it's lazy), is I keep an image of the latest gparted .iso on my machine, and temporarily attach that as the cd-rom, then boot to it, do all the resizing from the live iso (with most of it being done through gparted obviously), then reboot into the actual machine. THis way I never have to worry about resizing a running filesystem (even though growing running filesystems shouldn't usually be an issue, I've been burned before).
 
Old 02-22-2017, 03:00 AM   #4
isaac.dvorz
Member
 
Registered: Apr 2015
Posts: 33

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by r3sistance View Post
you won't be able to increase this without a reboot, since the kernel will refuse to reload the system table.

It's possible but more risk to get this down to just a reboot for downtime but as it is riskier, I'd advise using a proper tool such as gparted.

If you want a summary of the riskier method it'd be this.

swapoff /dev/vda3
fdisk -u /dev/sda
delete /dev/vda3
delete /dev/vda2
create /dev/vda2 at the same start location but 5G larger for end location
create new /dev/vda3 at new location
save

Reboot
xfs_growf /dev/vda2

This is definitely risker, if you recreate the partition wrong then it could be good game to your data and so unless you are willing to take such risks, I'd advise using a proper/dedicated tool for this work instead.
Why am I deleting all the partitions ? can't I delete just vda2 and create new partition instead ?
I don't have issues rebooting the system, not sure what you meant there.
 
Old 02-22-2017, 05:23 AM   #5
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by isaac.dvorz View Post
Why am I deleting all the partitions ? can't I delete just vda2 and create new partition instead ?
I don't have issues rebooting the system, not sure what you meant there.
I'd highly advise to use a proper tool like gparted, sure it will mean more downtime but right now you probably aren't familiar enough with partitions to be doing something risky like this on a production system. If you insist/want to do it this way, my advice is build a test machine and do it several times there first in tests.

But to answer your question, where are you going to expand vda2? vda3 is in the way. vda3 is only swap anyways, so what does it matter? it is just an extension of the paging system. So you can move vda3 completely. admittedly this is only a summary and I missed the mkswap step on vda3

Last edited by r3sistance; 02-22-2017 at 05:27 AM.
 
Old 02-22-2017, 09:16 AM   #6
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,649
Blog Entries: 4

Rep: Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934
I would also strongly suggest that you use LVM = Logical Volume Management.

With this feature, you can add and remove physical storage on-the-fly. And, you no longer have to be terribly concerned with physical partitioning since you are free to establish whatever logical picture you prefer. "Running out of space on a volume," which can be an extremely difficult thing to work out without LVM, becomes quite trivial to deal with if you do have it.

I install this feature on all of my Linux boxes as a matter of routine.
 
Old 02-22-2017, 09:26 AM   #7
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by sundialsvcs View Post
I would also strongly suggest that you use LVM = Logical Volume Management.

With this feature, you can add and remove physical storage on-the-fly. And, you no longer have to be terribly concerned with physical partitioning since you are free to establish whatever logical picture you prefer. "Running out of space on a volume," which can be an extremely difficult thing to work out without LVM, becomes quite trivial to deal with if you do have it.

I install this feature on all of my Linux boxes as a matter of routine.
I agree with the above, but doesn't really help with an already live production system unfortunately...

as it goes, for VMs I would look to having LVM running on a separate unpartitioned/raw disk, since without partitioning you can actually increase the size of the LVM even easier. So currently I get something like this...

/sda1 = /boot
/sdb = LVM PV

Unfortunately I don't have a good test box set-up like that right now tho...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
firewalld help: trying to forward https from kvm host to kvm guest on same port GaWdLy Linux - Networking 4 07-15-2016 02:27 PM
[SOLVED] "No KVM, No qemu-kvm" Available error while trying to install KVM on CentOS 6.3 sriramdas Linux - Virtualization and Cloud 5 01-01-2013 10:46 AM
[SOLVED] Centos 6 and KVM - how to setup bridged networking in KVM in a -Class B- environment? rylan76 Linux - Virtualization and Cloud 7 11-07-2012 06:46 AM
[Debian/Qemu/KVM] Why qemu --enable-kvm works but not kvm directly? gb2312 Linux - Virtualization and Cloud 2 03-21-2011 02:05 PM
LXer: Install Oracle 11gR2 on SL6 KVM at KVM-QEMU Instance on SL 6 (alpha 3) LXer Syndicated Linux News 2 01-01-2011 06:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration