• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Xen Virtual Server - Resize Disk / Partition?

Scheduled Pinned Locked Moved Solved
Linux Problems
4
12
1.8k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A
    astrugatch @SBrady
    last edited by Nov 25, 2019, 7:22 PM

    @SBrady

    This is more of a Linux question rather than a Xen/Hypervisor question. You can do it by booting to a liveCD and running gparted. Don’t try to modify your drive from your running OS.

    1 Reply Last reply Reply Quote 0
    • D
      Daniel Miller
      last edited by Daniel Miller Nov 25, 2019, 1:48 PM Nov 25, 2019, 7:47 PM

      With the way your partitions are situated, if you want to simply expand xvda1 to take up the new space you allocated, you will have to do so through a live cd or something similar; the extra space is not currently contiguous with xvda1, so something is going to have to move. You could also create a new volume to mount, but that will require modifying the partition table on a running system … not my favorite thing to do. Safest is still to do it with a live cd.

      Alternatively, adding the additional storage as a new virtual disk and then mounting that virtual disk under /images would give you the storage separate from your system volume (always a plus in case you don’t realize you don’t have enough room for a capture) and would give you greater operational flexibility, for instance when you need to add storage later or need to migrate to a new VM.

      S 1 Reply Last reply Nov 25, 2019, 9:10 PM Reply Quote 0
      • S
        Sebastian Roth Moderator
        last edited by Sebastian Roth Nov 25, 2019, 2:33 PM Nov 25, 2019, 8:32 PM

        @Daniel-Miller said in Xen Virtual Server - Resize Disk / Partition?:

        Alternatively, adding the additional storage as a new virtual disk and then mounting that virtual disk under /images would give you the storage separate from your system volume (always a plus in case you don’t realize you don’t have enough room for a capture) and would give you greater operational flexibility, for instance when you need to add storage later or need to migrate to a new VM.

        Thumbs up for this! I’d definitely go that route.

        Instead of expanding xvda you simply add xvdb to your Xen VM as if you’d add a second hard drive to it. Put one single partition on that disk (e.g. using parted or fdisk on the console) and format, then run the following commands:

        mkdir /tempimages/
        mount /dev/xvdb /tempimages/
        mv /images/* /tempimages/
        mv /images/.mntcheck /tempimages/
        umount /tempimages/
        mount /dev/xvdb /images/
        rmdir /tempimages/
        

        Don’t forget to add this second disk to you /etc/fstab so it will be mounted on system boot as well!

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        S 1 Reply Last reply Nov 25, 2019, 8:46 PM Reply Quote 0
        • S
          SBrady @Sebastian Roth
          last edited by Nov 25, 2019, 8:46 PM

          @Sebastian-Roth Thank you for the information. My issue is, I already expanded /dev/xvda to 250GB. If I create a new vdisk can I move the 250GB to it? I cannot reduce the size of /dev/xvda.

          D 1 Reply Last reply Nov 25, 2019, 8:55 PM Reply Quote 0
          • D
            Daniel Miller @SBrady
            last edited by Daniel Miller Nov 25, 2019, 2:56 PM Nov 25, 2019, 8:55 PM

            @SBrady Does Xen not let you shrink virtual disks?
            Well, if you can’t shrink the disk, you could ways create a new 25GB (or whatever your original disk size was) virtual disk, use some kind of disk cloning solution to copy the original disk data to the new volume, then shuffle things around so the new volume is in the same device position as it was originally, then re-partition and format the 250GB disk.

            1 Reply Last reply Reply Quote 0
            • S
              SBrady @Daniel Miller
              last edited by Nov 25, 2019, 9:10 PM

              @Daniel-Miller Thank you for the information. Is it possible to do this using command line if I have the gparted CD loaded?

              D 1 Reply Last reply Nov 25, 2019, 9:46 PM Reply Quote 0
              • S
                Sebastian Roth Moderator
                last edited by Sebastian Roth Nov 25, 2019, 3:11 PM Nov 25, 2019, 9:11 PM

                @SBrady said in Xen Virtual Server - Resize Disk / Partition?:

                My issue is, I already expanded /dev/xvda to 250GB. If I create a new vdisk can I move the 250GB to it? I cannot reduce the size of /dev/xvda.

                Didn’t you take a snapshot of the VM before expanding xvda???

                Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                S 1 Reply Last reply Nov 25, 2019, 9:51 PM Reply Quote 1
                • D
                  Daniel Miller @SBrady
                  last edited by Nov 25, 2019, 9:46 PM

                  @SBrady If you are using the gparted live cd, you should have access to dd. Provided your new small disk is the same size as, or larger than, the original disk and both the new and old disks are attached to said VM, you could do something along the lines of sudo dd if=/dev/xvda of=/dev/xvdb bs=1M where xvda is the old disk and xvdb is the new disk. it will error when it reaches the end of the smaller disk with a message indicating there is no more space left on the device. I’m sure there are more graceful means of doing it, but it will get the job done.

                  Note: if you get the disk identifiers backwards, you will wipe the content of the original disk. It is best to confirm the disk identifiers are mapped to the disks you think they are before running dd.

                  1 Reply Last reply Reply Quote 0
                  • S
                    SBrady @Sebastian Roth
                    last edited by Nov 25, 2019, 9:51 PM

                    @Sebastian-Roth Sadly I did not use a snapshot before making any changes 😞 I was under the impression I could shrink the vdisk if needed but when I tried it told me not possible. This is a fresh install I did awhile ago and only just installed and configured fog. I could do a new one if needed but honestly I would rather not. I was able to get gparted running on it but it’s all command line so more confusing to do. I also like the idea of cloning to a new drive and deleting the original if possible.

                    1 Reply Last reply Reply Quote 0
                    • S
                      SBrady
                      last edited by Nov 25, 2019, 11:43 PM

                      @Sebastian-Roth @Daniel-Miller

                      I’m problably going to just build a new server. Which is better for Xen VM, guided or guided with LVM?

                      1 Reply Last reply Reply Quote 0
                      • S
                        Sebastian Roth Moderator
                        last edited by Nov 26, 2019, 6:03 AM

                        @SBrady said:

                        Which is better for Xen VM, guided or guided with LVM?

                        LVM is great if you know Linux well and can handle that complexity. If you don’t it might make things more prone to errors and I’d suggest installing without LVM.

                        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        1 / 1
                        • First post
                          11/12
                          Last post

                        131

                        Online

                        12.1k

                        Users

                        17.3k

                        Topics

                        155.3k

                        Posts
                        Copyright © 2012-2024 FOG Project