Hi a_zakhary
Pages and Numbers sort according to the data type. For example, 12.93 GB Is text, and is sorted as text, not as a number value.
Here is a half-baked idea created in Numbers for Mac. It may start you on your journey, or it may encourage other users to improve on this. Where I got stuck was reducing the number of digits in the results with the very different magnitudes.
Based upon:
1 megabyte = 1,024 kilobytes.
1 gigabyte = 1,024 megabytes (1,024 kilobytes times 1,024 kilobytes = 1,048,576 kilobytes).
The advantage of Numbers is that we can add "helper" tables and then hide them by moving them (Cut and Paste) to another Sheet (which we don't print).

Enter your raw data as kilobytes in the "kilobytes" table.
In the Display table, formula in C2 (and fill down to the bottom of the table, then fill right to column F)
=IF(kilobytes::A2<1024,kilobytes::A2&" KB",IF(kilobytes::A2<1048576,kilobytes::A2÷1024&" MB",kilobytes::A2÷1048576&" GB"))
Now Sort Descending on any column in the "kilobytes" table. Here we go with column A:

In other words, do the sorting in the "kilobytes" table (proper sorting of number values) and the "Display" table (text values) will follow.
Regards,
Ian