You are not logged in.

#1 2012-11-04 22:18:35

makey
Member
Registered: 2012-11-03
Posts: 20

[SOLVED]Problem shrinking ext4 partition

Hi, I want to shrink my / partition and use the new space to create a swap partition (which i forgot to create during install). I am booting from usb with gparted, then i select shrink, specify the size and press apply button. Gparted first checks the partition for errors and then when it starts shrinking it gives the error - "resize2fs: the combination of flex_bg and !resize_inode feature is not supported by resize2fs". I tried googling this error but no luck sad. May be somebody here knows how to fix it?

My system(i'm trying to resize /dev/sda5 by 3gb):
hdd

Last edited by makey (2012-11-06 22:35:37)

Offline

#2 2012-11-05 06:28:07

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED]Problem shrinking ext4 partition

Why not jut use a swap file?  They are much more versatile than a swap partition, as you can add/remove them as necessary without dealing with all the resizing crap.

Offline

#3 2012-11-05 07:31:14

weirddan455
Member
Registered: 2012-04-15
Posts: 213

Re: [SOLVED]Problem shrinking ext4 partition

I second the swap file idea.  I personally don't use any swap at all.  With the amount of RAM on our system's today, there's a good chance you don't need swap unless you're doing hibernation.  I have 16GB RAM so I know for sure my system will never touch the swap but I think it's safe to run without run if you have at least 4GB RAM or so.

Offline

#4 2012-11-05 09:34:58

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [SOLVED]Problem shrinking ext4 partition

You can't resize the root partition while it's mounted, so you need to use a LiveCD/USB stick with something like Parted Magic, GParted Live, Ubuntu, etc.


By the way, I have 2 GB RAM and I don't use swap. But then again, it's a lightweight Openbox system. Maybe for something like GNOME or KDE...

And don't forget to mark the topic as solved (by editing the first post) so that other people (including yourself sometimes) may find useful.


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#5 2012-11-05 10:03:32

makey
Member
Registered: 2012-11-03
Posts: 20

Re: [SOLVED]Problem shrinking ext4 partition

I need swap in order to hibernate. And yes, I'm already using a swap file but it's just bothering me that I can't resize the partition and may be there is something wrong with the whole file system

@DSpider as I wrote I'm doing it from usb with gparted, just the screenshot was taken from xfce

Offline

#6 2012-11-05 12:01:11

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,097

Re: [SOLVED]Problem shrinking ext4 partition

You can suspend and resume from file, you don't need a swap partition for that.


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#7 2012-11-05 13:27:35

makey
Member
Registered: 2012-11-03
Posts: 20

Re: [SOLVED]Problem shrinking ext4 partition

Thanks guys for advices, I know that I can resume from swapfile, i just want to understand why I can't shrink the partition

Offline

#8 2012-11-05 13:33:01

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [SOLVED]Problem shrinking ext4 partition

Post your partition layout.

# fdisk -l

"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#9 2012-11-05 14:03:14

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,097

Re: [SOLVED]Problem shrinking ext4 partition

use resize2fs first then fdisk.  gparted is sort of crappy. (and make sure you have the latest version of the tool or you won't be able to resize ext4 with fancy features enabled)

Edit: I would seriously split out /home too, having everything on a big / is silly.

Last edited by Mr.Elendig (2012-11-05 14:10:57)


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#10 2012-11-05 16:21:00

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [SOLVED]Problem shrinking ext4 partition

Gparted is fine for its intended use. Get the latest copy of Parted Magic (which only uses stable versions of gparted) and you should be fine.

Mr.Elendig wrote:

Edit: I would seriously split out /home too, having everything on a big / is silly.

That's your opinion.

Personally, I like to keep my settings (the dot files) separate from my data. Other people may like the idea of ~/Videos, ~/Music ("My Documents" sort of thing), but I don't.

But yeah, having a big root partition (over say, 10-15 GB) is just bad practice, because then the HDD read head could be travelling too much.


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#11 2012-11-05 17:22:20

makey
Member
Registered: 2012-11-03
Posts: 20

Re: [SOLVED]Problem shrinking ext4 partition

so doing sudo fdisk -l shows the following

Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x4fdff27f

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    26050559    13024256   27  Hidden NTFS WinRE
/dev/sda2        26050560   864911359   419430400    7  HPFS/NTFS/exFAT
/dev/sda3       864913345   976773119    55929887+   f  W95 Ext'd (LBA)
Partition 3 does not start on physical sector boundary.
/dev/sda5       864913408   976773119    55929856   83  Linux

Disk /dev/sdb: 60.0 GB, 60022480896 bytes, 117231408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xdf890f13

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sdb2          206848   117147647    58470400    7  HPFS/NTFS/exFAT
/dev/sdb3       117149633   117229567       39967+   f  W95 Ext'd (LBA)
/dev/sdb5       117149696   117229567       39936   83  Linux

Can the problem be because of "Partition 3 does not start on physical sector boundary"?
By the way I was using latest Parted Magic

Offline

#12 2012-11-06 09:34:05

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [SOLVED]Problem shrinking ext4 partition

Back up your system with rsync to another Linux partition so that the permissions will remain intact (because NTFS has no concept of permissions), delete /dev/sda3 (and subsequently /dev/sda5), create a new Extended /dev/sda3 with gparted (with a new /dev/sda5), then transfer your system back (rsync -aAXv source destination), and hopefully fdisk shouldn't complain anymore.

https://wiki.archlinux.org/index.php/Fu … with_rsync


Do you remember what you used to partition the drive with, in the first place?


Edit: If you don't have enough space on another Linux partition, or you don't have another Linux partition at all, you can create a container with the instructions from here:

https://wiki.archlinux.org/index.php/Mo … _into_a_VM

Last edited by DSpider (2012-11-06 10:03:35)


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#13 2012-11-06 09:44:55

SoleSoul
Member
From: Israel
Registered: 2009-06-29
Posts: 319

Re: [SOLVED]Problem shrinking ext4 partition

Just a warning, in my experience it's not recommended to mix partitioning tools, i.e. for example use both cfdisk and gparted on the same drive.
Ususally it's not a problem, but once I had a complex partition layout that I made with gparted, and then I tried to change something with (in my case) cfdisk, and the partition table got corrupt and I lost all of my partitions (I restored the importand ones with testdisk). I believe that there are slight differences between the different partitioning tools.

Offline

#14 2012-11-06 09:59:39

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [SOLVED]Problem shrinking ext4 partition

They do the exact same thing, except that Gparted is a bit more lenient (and more precise) with sizes, because it uses "MiB" instead of "MB". Gparted will also align them properly by starting the partitions at the correct cylinder. It does this by providing a cushion of 2 MiB at the beginning, which other partitioning tools will not.


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#15 2012-11-06 22:34:37

makey
Member
Registered: 2012-11-03
Posts: 20

Re: [SOLVED]Problem shrinking ext4 partition

Did everything as you adviced DSpider and it works! no erros in fdisk smile I only had trouble with creating this container, I was doing it in arch, then rebooting to parted magic and couldn't mount the image, mount said that it didn't recognize any fs. It took a while for me to understand that you can't have a partition inside an image and you have to do all the steps in parted magic. Anyway everything works, i only have to move my /home to the new partition I made. Thanks again DSpider!

Offline

#16 2012-11-06 23:41:42

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [SOLVED]Problem shrinking ext4 partition

makey wrote:

rebooting to parted magic and couldn't mount the image

It was mentioned in the Troubleshooting part of that guide:

# mount -o offset=$((2048 * 512)) /dev/loop5 /mnt/Virtual/

"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#17 2012-11-07 00:43:21

makey
Member
Registered: 2012-11-03
Posts: 20

Re: [SOLVED]Problem shrinking ext4 partition

I should definitely pay more attention when reading the wiki

Offline

Board footer

Powered by FluxBB