[parted-devel] Partition move function

Phillip Susi psusi at cfl.rr.com
Thu Apr 29 14:35:59 UTC 2010


On 4/29/2010 9:52 AM, Jim Meyering wrote:
> I presume that moving a file system may require knowledge of the internals
> of that file system, and Parted is getting rid of its FS-manipulation
> functionality (which includes "move", "check", "mkfs", etc.)  Note that
> any FS-aware code in parted is probably broken when it comes to operating
> on a system with >512-byte sectors.

Generally no, you don't need specific knowledge of the fs to move it.
NTFS is an exception since it encodes the location of the boot sector in
the boot sector, so that needs fixed after a move ( if you want Windows
to still boot that is ).  As I said before, having some knowledge of the
fs can help speed the process since you can skip moving free blocks, but
isn't required.

Getting rid of the fs creation and checking is all well and good, but
being able to copy and move partitions seems like it should still be
something that parted can do, since those are about manipulating
partitions, rather than the filesystems in them.

> If you can come up with reliable FS-independent code
> to move a partition and its file system, please post it.

The non optimized version is just dd.  To move a partition x sectors to
the left, you move the start position of the partition in the partition
table, then dd if=/dev/sda1 of=/dev/sda1 skip=x.  It sounds like gparted
used to just run this, but now has a bit better internal implementation,
possibly smart enough to skip unused blocks, and transfer larger chunks
at a time to reduce seeks, and handle moving the partition slightly to
the right by starting at the end and working backwards.  Hopefully
Curtis can shed some more light on this.




More information about the parted-devel mailing list