# is it safe to resize (shrink) ext3 and "move" the free space

## printf

i searched around the net, but i found no direct answer to this

the situation is as follows:

3 partitions, all primary, in following order: / (sda1), swap (sda2), /home (sda3)

i would like to shrink /sda1 and add the gained free space to sda3

is that possible in a 100% safe way (i know it is possible with win/dos partitions)

----------

## HeissFuss

There's definitely no way to shrink an ext3 filesystem while it's running.  You can boot into a livecd, disable the ext3 journal, and shrink it.  You'll then need to shrink sda1, remove and recreate the swap partition, then grow sda3.  A tool like gparted may be able to help with this.

Unless you're very careful, there's a large probability that you'll lose all of your data.  The best option is to make a backup and recreate the partitions/filesystems the size you want.  You should make a backup in any case.

----------

## printf

i know that when working with partitions under linux they all should be unmounted

i forgot to mention that i would use a knoppix livecd anyway

but if there is a slight chance of data loss i might reconsider to recreate everything

----------

## ShadowCat8

Well, 

     What type of disklabel did you set it as?

     If you set it as an 'msdos' partition table, then the safest way I have found is to:

 Back up your data. (Better to have and not need than need and not have.)

 Boot the system to a current version of PartitionMagic's Rescue Disks.  It has full support for ext2 & ext3.  (Another option is to use the Hiren's Boot CD.  It has a trial version of PartitionMagic.)

 Make your adjustments.

 Reboot  back to your system.

HTH.

----------

## Gusar

Why use a proprietary tool? GParted from a livecd will work just fine. Might take a while as the data is being moved around, but it'll work. Use Parted Magic instead of Knoppix though, it has a newer gparted: http://partedmagic.com/

----------

## Hu

 *printf wrote:*   

> but if there is a slight chance of data loss i might reconsider to recreate everything

 The risk of data loss is dependent upon your proficiency and care in handling of the tools, rather than any specific known issue with the tools.  If you are careful, make no mistakes, and understand the implications of each command you issue, you will be fine.  If you fly off and try to guess your way through, there is a possibility you will issue a command that results in destruction of data.  :Smile: 

----------

## printf

i dont think the msdos partition table is set because the whole partition table was erased before i installed gentoo and the disk prior to installation was partitioned with fdisk from gentoo's livecd

and primarily i thought using gparted from knoppix

----------

## ShadowCat8

 *Gusar wrote:*   

> Why use a proprietary tool? GParted from a livecd will work just fine. Might take a while as the data is being moved around, but it'll work. Use Parted Magic instead of Knoppix though, it has a newer gparted: http://partedmagic.com/

 

Because I have had little success with the different flavors of parted (gparted and QtParted) on resizing existing partitions, even ext2 and ext3 partitions.  Making partitions, parted is great and can do far more than the old fdisk.  The fact that it can handle the GUID Partition Table is reason enough to use parted over fdisk.  

Conversely, I have had great success with PartitionMagic's "rescue" disks on being able to modify my linux drives without causing the chaos and data loss that are common with some utilities.  It has been able to grow and shrink ext2/3 filesystems and those filesystems have been consistently solid on the next boot of the system.  And, at least from their license back in the late '90s/early-2000's, you could make as many rescue disk sets from one installation of PartitionMagic as you wanted.  Of course, you can also understand that I never cared for the idea of using an M$-style application for administration and care of my linux boxes, but as they taught us in the Army: "If it's stupid, but it works... It's not stupid!"

Now, I had not come across Parted Magic until I read your post.  Thanks for the URL.  If it's stable and capable of handling the cases where parted alone cannot do it, then they will likely have another user soon.  I see that it really is the combination of many different disk and partition utilities, and they seem to have put it together in a good package for their LiveCD.  I'll pull one down to play with.

BTW, usually, when I use *any* LiveCD/DVD, I will stop the Xserver from starting, if I can.  If I am using a LiveCD on a system, then I am already under the impression that there is a problem with the system.  Why burn what may be limited resources on a given system by starting the full Xserver if I *should* be able to do everything I need from the terminal?  That is why in cases like this, I never even think of gparted.   No Xserver, no GNOME, no gparted.

Just my 2¢.    :Cool: 

----------

