Why Is the File System Size Inconsistent Before and After the Migration?
Symptom
- After the migration is complete, the used partition space on the target server is different from that on the source server.
- After the migration is complete, a particular file size on the target server is different from that on the source server.
Possible Causes
If there are sparse files on the source server, the total size of the migrated files on the target server may be smaller than that on the source server. This is because rsync automatically truncates sparse files during 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 are consistent before and after the migration. For details, see Procedure.
In a UNIX file system, when the file displacement is greater than the file length, the next write operation will extend the file length and form a hole in the file, creating a sparse file. This is achieved by writing brief information (metadata) representing the empty blocks to disks instead of the actual "empty" space which makes up the block, thus consuming 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
- 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.
- Check the size of the /tmp/test-data.img file.
ll /tmp/test-data.img
- Check the disk space occupied by /tmp/test-data.img.
du -sh /tmp/test-data.imgFigure 1 Checking the file size
- Check the size of the /tmp/test-data.img file.
- After the migration is complete, check the size of the migrated file on the target server. Figure 2 shows that the used disk space decreases after the migration.
- Run the following command on the source server and target server 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
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot