I migrated some special directories (not supported by common migration tools) from one Synology NAS volume (ext4) to another (btrfs). After checking if the synchronization was successful I found that sizes differ a lot.
I understand that there are block size differences but du gives me wrong data size within the same volume.
The total size of the whole directory is more than 1 TB so I narrowed the commands below to a smaller sub-directory.
Different sizes:
sudo du -sm /volume[12]/@synologydrive/@sync/repo/1/2
11418 /volume1/@synologydrive/@sync/repo/1/2
11122 /volume2/@synologydrive/@sync/repo/1/2
But for each sub-directory I get correct sizes (more or less when bytes are used) - sub-directory n is selected:
sudo du -sm /volume[12]/@synologydrive/@sync/repo/1/2/n
295 /volume1/@synologydrive/@sync/repo/1/2/n
295 /volume2/@synologydrive/@sync/repo/1/2/n
sudo du -sb /volume[12]/@synologydrive/@sync/repo/1/2/n
308387853 /volume1/@synologydrive/@sync/repo/1/2/n
308391693 /volume2/@synologydrive/@sync/repo/1/2/n
But, I'm getting completely different sizes when * is used (i.e. even on the same volume compare command above and this one on volume2):
sudo du -sm /volume[12]/@synologydrive/@sync/repo/1/2/* | grep n$
295 /volume1/@synologydrive/@sync/repo/1/2/n
200 /volume2/@synologydrive/@sync/repo/1/2/n
sudo du -sb /volume[12]/@synologydrive/@sync/repo/1/2/* | grep n$
308387853 /volume1/@synologydrive/@sync/repo/1/2/n
209533219 /volume2/@synologydrive/@sync/repo/1/2/n
I also counted sizes of all files under the n directory and I'm getting the same sizes:
ls -lA /volume1/@synologydrive/@sync/repo/1/2/n | tr -s ' ' | cut -f5 -d" " | awk '{s+=$1} END {print s}'
308387597
ls -lA /volume2/@synologydrive/@sync/repo/1/2/n | tr -s ' ' | cut -f5 -d" " | awk '{s+=$1} END {print s}'
308387597
So, it seems that the directories are "rsynced" correctly (same number of files, same sizes) and tried to exclude differences between two different file systems. But du gives me significantly bigger size on new volume1 (or more exactly - significantly smaller on old volume2).
Do you have any explanation for it?
Notes:
volume1is new btrfs target volume (I copied data to)volume2is old ext4 source volume (I copied data from)- Data were copied using
sudo rsync -a --progress --delete /volume2/@synologydrive /volume1