[Linux-cluster] unformat gfs2

Mr.Pine pine5514 at gmail.com
Tue Mar 18 18:11:07 UTC 2014


On Tue, Mar 18, 2014 at 9:25 PM, Bob Peterson <rpeterso at redhat.com> wrote:
> ----- Original Message -----
>> What is your opinion about this scrip?
>>
>> for ((i = 17; i < 1756377984; ++i)); do gfs2_edit -p $i blockalloc 3
>> /dev/sdb >/dev/null 2>&1; done
>>
>> Could we change all of block allocations to "3"?
>
> Hi,
>
> That would be dangerous. I would hope that the resource groups would be
> ignored, but I've never done it. I wouldn't be surprised if you had
> gfs2_edit segfault for some of it. At the very least, you would be turning
> all your journal blocks to appear like dinodes, as well as all the
> extended attributes, directory leaf blocks, etc., which will confuse
> fsck.gfs2. The fsck.gfs2 will do a much better job if you only change
> the dinode blocks from 0 to 3.
>
> You would be much better off writing a loop that first checked the
> block's current type, with -p <block number> blocktype, and only
> change its bit to 3 if it is type 4 (dinode).
>
> Also, the script would take a very long time, because it's going to
> invoke gfs2_edit a trillion and a half times. Writing a program to
> do this once would be quicker.
>
> Regards,
>
> Bob Peterson
> Red Hat File Systems
>
> --
> Linux-cluster mailing list
> Linux-cluster at redhat.com
> https://www.redhat.com/mailman/listinfo/linux-cluster

Hi,

Do you mean program likes this?

for ((i = 17; i < 1756377984; ++i)); do
        ss=$(gfs2_edit -p $i blocktype /dev/sdc | cut -d " " -f 1);
        if [[ $ss -eq 4 ]]; then
                gfs2_edit -p $i blockalloc 3 /dev/sdb >/dev/null 2>&1;
        fi
done

I'm a C/C++ programmer, if you trust program logic, i would try
to implement with C/C++. and would public in reply.

Regards.
Pine.




More information about the Linux-cluster mailing list