Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I need to shrink my partition to min-size, like resize2fs -M /dev/sba6 but, it seems that resize2fs does not change the physical partition, just the structure of the filesystem.

parted can resize the partitions but it requires start and end numbers .

share|improve this question
1  
So if there is such a thing, are you going to trust it to do such a sensitive measuring? –  Soroosh129 Mar 6 '13 at 18:50

1 Answer 1

The answer is you have to manually combine the both commands.

The reason is that resize2fs processing the ext{2,3,4} filesystem structure.

resize2fs -M /dev/sba6 will ensure that the end of the underlying partition isn't used any more.

With du /dev/sba6 you will see the amount of used space for the filesystem.

parted /dev/sba print|grep "^ 6" you see the current allocation for the partition.

For the resize operation you can now calculate the correct values.

But this is left as an exercise for you. I will not be blamed that you destroyed your data by an error I have done ;-)

And also be warned: Shrinking is not as much tested as expanding a files ystem.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.