Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to shrink an ext4 partition without formatting it? [closed]

Recently i installed Ubuntu 13.04 and allocated 20 GB for it. The system got installed space less than 10 GB. Now, can i shrink it to 10 GB without formatting it? Thats to say, i don't want to have large empty space in the partition.

like image 501
AbdulMomen عبدالمؤمن Avatar asked Oct 15 '13 10:10

AbdulMomen عبدالمؤمن


People also ask

Can you shrink an ext4 partition?

1 Answer. Yes, you need to run fdisk to actually change the partition table. After you resize your file system with resize2fs (the partition must be unmounted), look at the output of the command: $ resize2fs /dev/sdb1 24G ...

How do I shrink a partition without losing data?

Begin -> Right click Computer -> Manage. Locate Disk Management under Store on the left, and click to select Disk Management. Right click the partition you want to cut, and choose Shrink Volume. Tune a size on the right of Enter the amount of space to shrink.

Can ext4 be resized?

The resize2fs is a command-line utility that allows you to resize ext2, ext3, or ext4 file systems. Note: Extending a filesystem is a moderately high-risk operation. So it is recommended to backup your entire partition to prevent data loss.


1 Answers

You could use the resize2fs command.

However, I would suggest to backup the most important files (on e.g. an USB key) before doing that (e.g. /etc/ and some of /home/ )

See also this question...

BTW, 20GB for the system partition is not that much.....

like image 157
Basile Starynkevitch Avatar answered Nov 22 '22 07:11

Basile Starynkevitch