Next Previous Contents

1.3 General converter

The philosophy of General converter is simple, but the implementation is complicated. The normal order of converting the filesystem is:

  1. mkfs a target filesystem
  2. copy files from source to target filesystem
  3. destroy source filesystem
  4. move target filesystem to the original place of source filesystem

GConv modifies this order in the way, that it doesn't need a special space for temporary filesystem. It creates a target filesystem in free blocks of the source filesystem. The filesystem drivers don't need to know about the free blocks, they just say GConv which block thay want to read/write. GConv remembers which block is allocated and where it is really stored.

GConv advances this order yet more. It doesn't really copy the data of converted files from imported to exported filesystem. This wouldn't be much better, because only 50% empty filesystems could be converted in this way. It tries to allocate the same data-blocks in the target filesystem as they are allocated in the source filesystem. If the allocation is successfull, no move of this data block is needed, else it must be permutated at the end of conversion. But it is still better than copying the whole file, because we just move the file data blocks at end (remembering just their original and target position) instead of duplicating them during the conversion. The deduction is that only free space for metadata of the target filesystem (superblock, allocation tables, directories,...) is needed.

This order may be advanced to general M:N in place conversion of the partitions (any number of imported partitions of any type is converted to another configuration of partitions) -- all the imported partitions are sequentially imported and the target filesystems are paralelly exported. The distribution of the imported directories to the exported partitions must be set by the user. Partition Surprise is not prepared for this general order yet.

A free blocks from other partitions and the main memory can be used as a temporary space too. This may be dangerous for sensitive data and is not recommended without backuping the data.

An important note must be noted: The whole conversion is non-destructive! All the imported filesystems are exported to the FREE BLOCKS on the partitions only, and even if the power is turned off or an internal error has occured, no data will be damaged. The only sensitive step in the conversion is the finale permutation of the blocks -- new filesystems are moved/permutated to the final place and the original filesystems are destructed. This operation is totally uninterruptible and the user WILL certainly lose all his converted data if he breaks the conversion. Partition Surprise ignores SIGTERM signal, it can be killed only by SIGKILL in this phase.

GConv informs the user about the current phase of conversion. There are approximately these phases:

  1. Reading the filesystem to compute the file sizes
  2. Initializing the exported filesystem (mkfs)
  3. Moving the files from imported to exported filesystem (a positions of file data blocks are read and then allocated in the exported filesystem), GConv stores an information about partial block permutation during the conversion in its data structures
  4. Generating the optimalized permutation program
  5. Final permutating the blocks to their target positions

Next Previous Contents