• 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.7k
    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.
    • S
      SBrady
      last edited by

      I created my Ubuntu 16.04.6 LTS server in XenCenter. I originally created a 25GB storage. I now would like to increase that storage but I’m having a hard time figuring it out if it’s even possible. I have already changed the 25GB to 250GB in Xen. The path is /dev/xvda. I see the Disk changed for xvda but I can’t add any space to xvda1. What are my options here? I’m trying to do this so I have more space for my images. Thank you.

      7936df3d-246c-4938-8ea5-39b7a2a5c59e-image.png

      A 1 Reply Last reply Reply Quote 0
      • A
        astrugatch @SBrady
        last edited by

        @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

          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 Reply Quote 0
          • S
            Sebastian Roth Moderator
            last edited by Sebastian Roth

            @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 Reply Quote 0
            • S
              SBrady @Sebastian Roth
              last edited by

              @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 Reply Quote 0
              • D
                Daniel Miller @SBrady
                last edited by Daniel Miller

                @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

                  @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 Reply Quote 0
                  • S
                    Sebastian Roth Moderator
                    last edited by Sebastian Roth

                    @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 Reply Quote 1
                    • D
                      Daniel Miller @SBrady
                      last edited by

                      @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

                        @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

                          @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

                            @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
                            • First post
                              Last post

                            189

                            Online

                            12.0k

                            Users

                            17.3k

                            Topics

                            155.2k

                            Posts
                            Copyright © 2012-2024 FOG Project