0

Say a disk is full with three equal-length partitions. It could be any type of disk: an SDD, an HDD, anything. In my mind, moving a partition is taking every bit of it and placing it elsewhere, until the whole partition is moved. That's why the process takes so much time for large partitions. Now, what if one were to try and swap the first and last of the three earlier-mentioned partitions? If the first partition is moved first, then the last will be overwritten. If the third partition is moved first, than the first partition will be overwritten. Is RAM the magic key, here? Up to what point does having more RAM speed up the process?

P.S. This is a theoretical question. I'm not actually interesting in swapping partitions on a full disk.

GPWR
  • 441
  • 3
  • 17
  • 1
    since this is theoretical, it is off topic, so expect a closure, but I would point out that both partitions would need to be offline for such an operation to take place, meaning that their contents could be swapped one block at a time as raw reads/writes. that would require just a little more ram than the disk block size, though I'm sure a larger ram cache would make the operation more efficient. this approach would not use an HDDs sequential write capabilities to their maximum, but it would work. – Frank Thomas Feb 21 '22 at 22:09
  • 1
    For HDD moving data around [may make sense](https://superuser.com/q/643013/432690), but for SSD and similar it does not. For SSD the only thing you will achieve is swapping like `sdb1` and `sdb3`, which can be done in constant time by modifying entries in the partition table. For SSD don't bother even with this fast method, as you (and hopefully your OS) should recognize partitions or filesystems by their UUIDs anyway. – Kamil Maciorowski Feb 21 '22 at 22:36

0 Answers0