Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

Question

online shrink not supported in EXT4_IOC_RESIZE_FS ioctl

Aug 5, 2012 3:55PM PDT

Hi,

I was referring EXT4_IOC_RESIZE_FS ioctl implementation in linux kernel ver 3.3.8.

It is given in the code that online shrinking not supported.

if (n_blocks_count < o_blocks_count) {
/* On-line shrinking not supported */
ext4_warning(sb, "can't shrink FS - resize aborted");
return -EINVAL;
}

Can anyone please tell the reason why online shrinking is not supported.

Thanks in adavance.

Regards,
Raphel

Discussion is locked

- Collapse -
Answer
One for the ages I fear.
Aug 6, 2012 5:14AM PDT

If a volume is online, then there are certain things you can't do. Did you try to shrink it with some bootable version of GPARTED?

Sorry but I fear this is one of those old issue/discussion things. I might be short on the explanation.
Bob

- Collapse -
what are the issues in shrinking volume online
Aug 6, 2012 2:58PM PDT

I am new to this. Could you please explain what are the issues in shrinking volume online.

- Collapse -
Already stated it.
Aug 7, 2012 12:44AM PDT

Some actions/procedures can't be done to an online mounted volume. That's it.

- Collapse -
what are the issues in shrinking volume online
Aug 7, 2012 7:10PM PDT

Thanks for your reply.

It will be more helpful if you can tell me what actions/procedures can't be done to an online mounted volume?

- Collapse -
You discovered this on your own.
Aug 8, 2012 3:07AM PDT

Let's try this another way.

What are you trying to do?

Why isn't the usual offline, un-mounted volume shrink a solution for you?

-> I can't cover all that is needed to understand this in 3 paragraphs. I can however help you find a solution. Some folk get upset that computer science courses can't be held here but as this is a simple discussion forum and not a computer science course, we need to head to solutions as much as possible.
Bob

- Collapse -
what are the issues in shrinking volume online
Aug 8, 2012 7:31PM PDT

Thanks for your reply.

We are developing a tool in Android where we plan to add a feature to expand and shrink volume.
Customer wants to do this online.

I had gone through Technical discussion and linux kernel source for online resize support.
Online resize support is provided through EXT4_IOC_RESIZE_FS ioctl.
In this ioctl on linux kernel side, Online volume expansion support is provided. But shrink support is not given. But Shrink support is provided offline.

Here the question from my team... why online support is not given for shrink?
what are the issues involved in doing online shrink?
I need to provide the reason to team.

Thanks for your support.

Regards,
Raphel

- Collapse -
Re: shrinking
Aug 8, 2012 7:37PM PDT

There might be references to disk sectors that would be removed from the partition by shrinking everywhere in buffers/caches inside the OS. That would give rise to fatal errors when these references would be used later.

Kees

- Collapse -
I see Kees summed it up.
Aug 10, 2012 2:59AM PDT

As a developer you would have a background in operating systems and more. My answers were more for the end user. In the future it would be better if you reveal such details up front so I can tailor my replies to you and your background.

So, in short, read Kees response and I'll add that Android, while is based on Linux is not the same as other distros. There are areas that may have changes that remove the function or create a limitation. This is a good example where it differs.
Bob