12 Replies Latest reply on Aug 14, 2008 12:24 AM by Vinaykmn

    Resize Linux root partition

    crendall Enthusiast

       

      I'm running a SUSE Enterprise Linux 9 VM on ESX 3.5 and my root partition is filling up.  I've expanded a Windows boot partition before on ESX, but not a Linux root partition.  Can I use something line QTParted to resize the linux root partition?  I'm assuming I use the same vmkfstools command to make the virtual drive bigger.  I'm wondering what the steps are to make the Linux VM see the bigger root drive.

       

       

      Thanks.

       

       

        • 1. Re: Resize Linux root partition
          AWo Guru

          You can expand the "disk" by using vmkfstools, but it depends on your guests root partition file system if and how you can reflect the larger disk there. Check if VMare Converter can help you here. It is often suggested as an appropriate tool to expand or shrink guest partitions.

           

          AWo

          • 2. Re: Resize Linux root partition
            crendall Enthusiast

             

            I used the mount command on my Linux VM and it says the root partition is reiserfs.

             

             

            • 3. Re: Resize Linux root partition
              dwight@dwightandamy.com Hot Shot

              Once the volume has been resized run 'resize_reiserfs /dev/devname' to resize the reiserfs filesystem.






              RHCE, VCP

              Blog: http://computing.dwighthubbard.info

              • 4. Re: Resize Linux root partition
                crendall Enthusiast

                The "man" page for resize_reiserfs says it enlarges or shrinks an un mounted reiserfs filesystem.  I need to do this to the root partition.  Do I have to mount the virtual disk for the root partition onto another Linux VM?

                • 5. Re: Resize Linux root partition
                  dwight@dwightandamy.com Hot Shot

                  It's been a while since I've done a reiserfs resize.  But I remember

                  it allowing you to increase the filesystem size while it's mounted,

                  but required dismounting the filesystem if you needed to shrink it.

                  So you should be able to boot up and resize the root filesystem while

                  it is being used.

                  • 6. Re: Resize Linux root partition
                    kjb007 Guru

                     

                    Did you use LVM when you configured your OS?  If not, did you partition your drive so as to break up a disk into smaller partitions?  If you partitioned a disk, remember, that using vmkfstools adds space to the end of the drive.  If your / drive is not at the end of the drive, meaning the last partition, you will not be able to extend the space, unless you move all of the other partitions over.  If you used LVM, then the process is a MUCH SIMPLER.

                     

                     

                     

                     

                     

                    Extend the disk using vmkfstools.  Create a new physical volume.  Extend the volume group that your root volume is on with the new physical volume.  Then increase your logical volume.  Then increase your filesystem. 

                     

                     

                     

                     

                     

                    -KjB

                     

                     

                    • 7. Re: Resize Linux root partition
                      crendall Enthusiast

                      I didn't use LVM when I installed the OS.  Can I boot the VM from a Knoppix CD and use QTParted to move the partitions and increase the root partition?

                      • 8. Re: Resize Linux root partition
                        AWo Guru

                        You should be able to use your SuSE guest installation media.

                         

                        AWo

                        • 9. Re: Resize Linux root partition
                          kjb007 Guru

                           

                          I know parted can do it by itself.  If the options are available in qtparted/gparted, I believe so, but don't know for sure.  But as long as you move the drives over and expand the partition, you will be able to resize the filesystem to encompas that partition as others have already pointed out.  I would strongly recommend using LVM in the future, though.

                           

                           

                           

                           

                           

                          -KjB

                           

                           

                          • 10. Re: Resize Linux root partition
                            Jae Ellers Master

                            Try the systemrescuecd and qtparted.  I always make a clone first before modifying partitions. 

                             

                             

                             

                             

                            -=-=-=-=-=-=-=-=-=-=-=-=-=-=-

                            http://blog.mr-vm.com

                            http://www.vmprofessional.com

                            -=-=-=-=-=-=-=-=-=-=-=-=-=-=-

                            • 11. Re: Resize Linux root partition
                              fraber01 Hot Shot

                              the reiser resize tools should do it, you can do it while it's mounted since you add space, there's no need to unmount it.

                              However, remember that if your root (/) partition is not the last, it may not be optimal since it will be separated in two parts...

                              On the other hand, it's a virtual disk so you don't have to bother about the disk i/o...

                              I would try it...

                              If it don't work, create another vm and use the Ghost for Linux(G4L) tool to ghost your partitions to the new host, with a bigger / (root)

                              • 12. Re: Resize Linux root partition
                                Vinaykmn Lurker

                                 

                                Hi,

                                 

                                 

                                I wanted to install a Oracle Virtual Machine on a linux host. After  initial configuration settings, when I run the installer, installation is getting aborted, getting following errors:

                                 

                                 

                                =========================================================

                                Starting install...

                                Traceback (most recent call last):

                                File "/usr/sbin/virt-install", line 497, in ?

                                main()

                                File "/usr/sbin/virt-install", line 461, in main

                                dom = guest.start_install(conscb)

                                File "/usr/lib/python2.4/site-packages/virtinst/ParaVirtGuest.py", line 221, in start_install

                                (self.kernel, self.initrd) = self._get_paravirt_install_images()

                                File "/usr/lib/python2.4/site-packages/virtinst/ParaVirtGuest.py", line 97, in getparavirt_install_images

                                nfsmntdir = tempfile.mkdtemp(prefix="xennfs.", dir="/var/lib/xen")

                                File "/usr/lib/python2.4/tempfile.py", line 328, in mkdtemp

                                _os.mkdir(file, 0700)

                                OSError: No space left on device: '/var/lib/xen/xennfs.OEtz1N'

                                #

                                =========================================================

                                 

                                 

                                With ref to last error: I checked the disk size by ruuning the command:

                                 

                                 

                                1. df -h

                                 

                                Filesystem    Size    Used   Avail   Use%   Mounted on

                                /dev/hda2       3.0G   3.0G    0       100%        /

                                /dev/hda3      145G   27G  119G     19%        /OVS

                                /dev/hda1        99M  24M    70M     26%       /boot

                                tmpfs 272M 0 272M 0% /dev/shm

                                /OVS/iso_pool/Enterprise-R4-U5-x86_64-disc3.iso

                                638M 638M 0 100% /media/iso

                                 

                                 

                                As per the above details it is confirmed that ther is no space at all in "/dev/hda2". But there is enough space in "/dev/hda3" --> 119 GB. I guess because of this reason installion is is failing.

                                 

                                Could there be any other reason for the failure of installation?

                                 

                                If non availability of the space is the reason,Is it possible to incresae the space in "/dev/hda2" ?

                                 

                                Any Help please?

                                 

                                Regards,

                                Vinay.