Help Center > > FAQs> After Migration> Why Are the File Sizes Before and After the Migration Different?

Why Are the File Sizes Before and After the Migration Different?

Updated at: Jun 12, 2020 GMT+08:00

Symptom

  • After the migration, the used disk partition space on the target ECS is different from that on the source server.
  • After the migration, the file size on the target ECS is different from that on the source server.

Causes

If sparse files exist on the source server, the total size of the migrated files on the target ECS may be smaller than that on the source server. This is because Rsync automatically processes sparse files during the transmission. The file system transparently converts metadata representing empty blocks into "real" blocks filled with null bytes at runtime.

You can check whether the files before and after the migration are consistent. For details, see Procedure.

In the Unix file system, when the file displacement is greater than the file length, the next write operation extends the file length, creating a sparse file. This is achieved by writing brief information (metadata) representing the empty blocks to disk instead of the actual "empty" space which makes up the block, using less disk space. The full block size is written to disk as the actual size only when the block contains "real" (non-empty) data.

Procedure

  1. Check the size of the file on the source server and the used disk space. The /tmp/test-data.img file is used as an example.
    1. Run the following command to check the size of the /tmp/test-data.img file:

      ll /tmp/test-data.img

    2. Run the following command to check the disk space occupied by /tmp/test-data.img:
      du -sh /tmp/test-data.img
      Figure 1 Checking the file size
  2. After the migration is complete, check the size of the migrated file on the target ECS. Figure 2 shows that the used disk space decreases after the migration.
    Figure 2 Checking target ECS file size
  3. Run the following command on the source server and target ECS to obtain the sha256 values of the files to determine whether the files are the same.

    If the sha256 values of the files are the same, the file content is consistent.

    sha256sum /tmp/test-data.img

    Figure 3 Obtaining the sha256 value

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel