# Disk size

**URL:** <https://forums.suse.com/t/disk-size/25381>\
**Category:** SLES Virtualization\
**Created:** [April 14, 2014, 3:32pm UTC](https://forums.suse.com/t/disk-size/25381 "2014-04-14T15:32:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Gill](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@John\_Gill](https://forums.suse.com/u/John_Gill)\
**Post date:** [April 14, 2014, 3:32pm UTC](https://forums.suse.com/t/disk-size/25381/1 "2014-04-14T15:32:00Z")

</div>

Hi,

Running XEN on SLES11sp3. My disk setup is a block of 100GB of which 25GB is used. I want to shrink the disk to about 50GB. Any ideas of what to use to adjust the partition without losing the data?

Regards  
John

---

<div class="post-metadata">

**Author:** ![KEVIN1](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@KEVIN1](https://forums.suse.com/u/KEVIN1)\
**Post date:** [April 15, 2014, 11:00am UTC](https://forums.suse.com/t/disk-size/25381/2 "2014-04-15T11:00:33Z")

</div>

John Gill wrote:  
[color=blue]

> Running XEN on SLES11sp3. My disk setup is a block of 100GB of which  
> 25GB is used. I want to shrink the disk to about 50GB. Any ideas of  
> what to use to adjust the partition without losing the data?[/color]

What is this 100 GB block? 25 GB is used but how much is allocated?

Is it storage assigned to a DomU or storage used by Dom0?

What other information do you think would be helpful in trying to  
assess the situation?

–  
Kevin Boyle - Knowledge Partner  
If you find this post helpful and are logged into the web interface,  
show your appreciation and click on the star below…

---

<div class="post-metadata">

**Author:** ![John\_Gill](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@John\_Gill](https://forums.suse.com/u/John_Gill)\
**Post date:** [April 15, 2014, 3:39pm UTC](https://forums.suse.com/t/disk-size/25381/3 "2014-04-15T15:39:38Z")

</div>

Hey Kevin,

From the host I set aside 105GB for use by the VM. On the VM I partitioned the space as follows:  
/dev/xvda 105GB  
/dev/xvda1 1GB Ext3 /boot  
/dev/xvda2 4GB Swap swap  
/dev/xvda3 100GB Ext3 /

The server is running Groupwise Mobility and I am using 25GB of space. I would like to shrink the partition to about 50GB cos when I make a backup of the image I am copying 50GB of empty space ☹ I am not concerned about reclaiming the space for the host.

The more I think about this, the more I think I should create a new VM and reinstall GMS …

Regards  
John

---

<div class="post-metadata">

**Author:** ![KEVIN1](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@KEVIN1](https://forums.suse.com/u/KEVIN1)\
**Post date:** [April 15, 2014, 6:43pm UTC](https://forums.suse.com/t/disk-size/25381/4 "2014-04-15T18:43:20Z")

</div>

John Gill wrote:  
[color=blue]

> The more I think about this, the more I think I should create a new VM  
> and reinstall GMS …[/color]

That’s one option, but as long as you have a backup you could try to  
resize the filesystem and expand your Linux skills in the process.

This is a good place to start:  
[https://www.suse.com/documentation/sles11/stor\_admin/data/biuymaa.html](https://www.suse.com/documentation/sles11/stor_admin/data/biuymaa.html)

–  
Kevin Boyle - Knowledge Partner  
If you find this post helpful and are logged into the web interface,  
show your appreciation and click on the star below…

---

<div class="post-metadata">

**Author:** ![John\_Gill](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@John\_Gill](https://forums.suse.com/u/John_Gill)\
**Post date:** [April 17, 2014, 11:31am UTC](https://forums.suse.com/t/disk-size/25381/5 "2014-04-17T11:31:47Z")

</div>

mmmh, I tried to implement the changes according to the documentation, but no joy. I tried various hacks, trickery and magic but no go. I did cause some issues on the VM but a simple reboot of the VM and all was restored. The biggest issue was trying to umount /dev/xvda3. So I suspect the resize is not possible with the way I have setup the VM disks, but I am impressed that I could NOT break the VM (I guess I could hit it with a big hammer but then I would need more hardware :o )

---

<div class="post-metadata">

**Author:** ![KEVIN1](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@KEVIN1](https://forums.suse.com/u/KEVIN1)\
**Post date:** [April 17, 2014, 8:27pm UTC](https://forums.suse.com/t/disk-size/25381/6 "2014-04-17T20:27:13Z")

</div>

John Gill wrote:  
[color=blue]

> The biggest issue was trying to umount /dev/xvda3.[/color]

Of course… 😉

When you resize an ext3 filesystem, you can increase the size while it  
is online but you can only decrease the size when it is offline. If you  
think about it, it only makes sense that you can’t umount the  
filesystem while you are using it.

It would be nice if there were a step-by-step set of instructions to  
accomplish what you want but unfortunately I have not been able to  
locate any.

Shrinking the root filesystem usually involves booting from a “live” CD  
or booting into the rescue system. This becomes more difficult when it  
involves a paravirtual DomU. A better solution is to do it from Dom0.

There are several TIDS that discuss how to access a DomU disk from  
Dom0. I find they all come up a bit short.

[http://www.novell.com/support/kb/doc.php?id=3756370](http://www.novell.com/support/kb/doc.php?id=3756370)  
[http://www.novell.com/support/kb/doc.php?id=3312774](http://www.novell.com/support/kb/doc.php?id=3312774)  
[http://www.novell.com/support/kb/doc.php?id=3564240](http://www.novell.com/support/kb/doc.php?id=3564240)

It may be easier to access DomU partitions using “kpatrx”. See the man  
pages for more info. Remember you want access to your DomU’s partition  
but you don’t want it mounted. Be sure to shutdown your DomU before  
attempting to access the disks/partitions from Dom0.

Google found this article on how to shrink an ext3 partition. It is the  
most detailed I could find.

[http://linuxnextgen.blogspot.ca/2010/10/shrink-ext3-partition-without-losing.html](http://linuxnextgen.blogspot.ca/2010/10/shrink-ext3-partition-without-losing.html)

While I have looked at this procedure and it appears to do what you  
want, I have not tested it so you proceed at your own risk. Still, I  
hope they are helpful.

–  
Kevin Boyle - Knowledge Partner  
If you find this post helpful and are logged into the web interface,  
show your appreciation and click on the star below…
