Is there an easy way to decrease the disk volume on a Ubuntu server?
I run a virtual environment and need to decrease my disk volume since I'm running out of space in my non virtual environment.
Is there an easy way to decrease the disk volume on a Ubuntu server?
I run a virtual environment and need to decrease my disk volume since I'm running out of space in my non virtual environment.
You will need to first resize the filesystem, then the partition table, and then tell the virtual hypervisor to resize its own disk. As somebody else stated, booting it in a liveCD and then using gparted is VERY easy to do. In fact its the only way to do it if you have the filesystem mounted, which will always be the case for your root filesystem.
If you just want to resize /home or some other thing you can unmount..
umount /dev/sda4
parted will show you the start/stop with parted -l
Model: ATA Hitachi HTS54323 (scsi)
Disk /dev/sda: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 20.5kB 210MB 210MB fat32 EFI System Partition boot
2 210MB 160GB 160GB hfs+ Mac HD
3 160GB 162GB 2000MB linux-swap(v1)
4 162GB 320GB 158GB ext4
If I wanted to resize /dev/sda4:
parted resize /dev/vda1 162GB 300GB
Then I'd just have to tell the virtual disk provider to shrink its disk to the appropriate size.
Note that this is fairly dangerous, so backup any important data.
parted
can't resize the filesystem; you'll need to run resize2fs
( for ext[234] ) to do that first, or better yet, just stick to using gparted
– psusi
Feb 21 '12 at 03:34
If you meant you want to resize your filesystem which is probably ext* have a look at this guide http://www.howtoforge.com/linux_resizing_ext3_partitions
If you meant you want to reduce your disk usage by removing temporary and cache data have a look at this: http://www.webupd8.org/2009/04/clean-unnecessary-temporarily-files-in.html
Beside resizing your partition using a LiveCD and gparted
you could change the amount of space reserved by root (in percent):
sudo tune2fs -m 10 /dev/sda1
But this only affects non root user!
You can also create quotas for specific users using the quota
utility (User Quotas with Ubuntu)
VBoxManage modifyhd yourdisk.vdi –compact
command which looks like it might work for your purpose. See this tutorial, http://michaelcole.com/node/13, linux guest, windows host, but the syntax for theVboxmanage
command is essentially the same I think. Basically, 1. backup data, 2. zerofill guest OS, and 3. runvboxmanage
...and you should be set. Assuming this is what you were asking... – adempewolff May 23 '12 at 13:52