6 Replies Latest reply on Mar 8, 2011 8:46 AM by continuum

    Shrink XFS by means of dump, mkfs, restore

    UlyssesOfEpirus Hot Shot

      It seems one can make a partition smaller and at the same time shrink a virtual disk as follows: documentation for XFS says an XFS partition can only be made smaller of you "do a complete dump, mkfs and restore."

       

      http://xfs.org/index.php/XFS_FAQ#Q:_Is_there_a_way_to_make_a_XFS_filesystem_larger_or_smaller.3F

       

      This should also do a shrink if the restore is to a brand new empty disk, but what are the specific steps for the following?

       

      "do a complete dump, mkfs and restore"

        • 1. Re: Shrink XFS by means of dump, mkfs, restore
          UlyssesOfEpirus Hot Shot

          And as a side-effect, would this defrag the partition?

           

          Would this work to also convert to a new filing system?

          • 2. Re: Shrink XFS by means of dump, mkfs, restore
            WoodyZ Guru
            This should also do a shrink if the restore is to a brand new empty disk, but what are the specific steps for the following?

             

            "do a complete dump, mkfs and restore"

             

            I'd probably start by reading the manpages for xfsdump, xfsrestore and mkfs and then utilize forums centric to XFS and Linux first and then here with VMware specific questions after learning what "do a complete dump, mkfs and restore" means.

            • 3. Re: Shrink XFS by means of dump, mkfs, restore
              UlyssesOfEpirus Hot Shot

              Isn't there something that would work with all filing systems? I mean, just copying files across to a new disk while taking care of special cases like /dev, soft links, hard links etc? You guys must have hit this obstacle of copying special files.

              • 4. Re: Shrink XFS by means of dump, mkfs, restore
                WoodyZ Guru

                Isn't there something that would work with all filing systems?

                 

                Technology is great however it doesn't work that way, there is no such a thing as one widget fitting all use case scenarios.

                 

                If you have a specific issue or a question involving a VMware product it would be much easier if you'd provide VMware product specific information along with explicit and specific information regarding what it is your trying to do and or accomplish and go from there.

                • 5. Re: Shrink XFS by means of dump, mkfs, restore
                  UlyssesOfEpirus Hot Shot

                  Shrinking that works with all filing systems is not general abstract philosophy but very vmware specific.  And where vmware tools fail, the common sense that says "make a new .vmdk and copy files to it" should do it in all filing systems.

                   

                  Somewhere in these forums I saw someone recommending something like this, but can't locate that post. Anyone who's bookmarked those instructions?

                  • 6. Re: Shrink XFS by means of dump, mkfs, restore
                    continuum Guru
                    Community WarriorsvExpert

                    > Isn't there something that would work with all filing systems?

                     

                    Not that I know  about such a thing - however the procedure itself works in all cases


                    - power off VM

                    - add new disk

                    - boot into LiveCD
                    - wipe blank space on the disk you want to clone

                    - partition new disk

                    - copy data disk to disk using the smartest procedure available
                    - power off VM

                    - edit vmx and exchange vmdks BEFORE first next boot

                     


                    for Windows I use robocopy, unstopablecopier or ghost 32, for unknown filesystems I use dd

                    for Linux you may know the best procedure yourself I guess ... rsync maybe ?

                     

                    if unsure use dd for the / partition to preserve special files and use rsync or whatever for data partitions

                     

                    that resizes, defragments and shrinks the vmdk all in one run when you can use "clever" tools like ghost32