LinuxRocks
New Member
Purchased a new laptop recently, so need to copy files from old laptop to new.
Used the tar command to create an archive, then copied the tar file across to external hard drive, afterwards copied the tar file from external drive to new laptop, then extracted archive on new laptop.
Once extracted to proper location on new laptop. e.g. ~/Music. I did:
to check timestamps of the directories. This was the output:
I went back to old laptop and issued same command:
Output was:
Notice how the timestamps are ever so slightly different. Tar isn't preserving nanosecond precision when it creates the archive or when it's extracted. BTW, I am using the '--atime-preserve' switch when extracting the archive:
If I use the 'cp' command to copy to external drive:
then do:
to check timestamps on the copied files of the external drive, output is:
It's close to the original, but notice how the last four digits of 'Black Holes and Revelations' has '5900' when the original has '5987'.
I've tried using the rar command as well. It was the same as using the tar command. i.e. didn't preserve nanosecond precision at all.
Also tried, drag and drop copy using the windowed interface on xfce. It was the same as the 'cp -ar' copy. i.e. last two digits not preserved. Maybe the default xfce file manager uses the ‘cp -ar’ in the background to copy?
Any idea how to copy files and directories fully preserving nanosecond precision?
Linux distro and version of old laptop is: Ubuntu 16.04
Thanks,
Used the tar command to create an archive, then copied the tar file across to external hard drive, afterwards copied the tar file from external drive to new laptop, then extracted archive on new laptop.
Once extracted to proper location on new laptop. e.g. ~/Music. I did:
Code:
ls -la --time-style=full-iso
to check timestamps of the directories. This was the output:
Code:
[w@wt Music]$ ls -la --time-style=full-iso
total 28
drwxrwxrwx 7 k k 4096 2017-05-13 00:09:35.000000000 +0700 .
drwxr-xr-x 3 k k 4096 2020-09-24 14:59:04.748455435 +0700 ..
drwxrwxrwx 3 k k 4096 2017-05-13 00:09:33.000000000 +0700 'Amy MacDonald'
drwxrwxrwx 2 k k 4096 2017-05-13 00:09:33.000000000 +0700 'Black Holes and Revelations'
drwxrwxrwx 3 k k 4096 2017-05-13 00:09:34.000000000 +0700 'Kings Of Leon'
drwxrwxrwx 2 k k 4096 2017-05-13 00:09:32.000000000 +0700 'Learn Thai'
drwxrwxrwx 3 k k 4096 2017-05-13 00:09:35.000000000 +0700 'Richard Wagner'
I went back to old laptop and issued same command:
Code:
ls -la --time-style=full-iso
Output was:
Code:
drwxrwxr-x 7 k k 4096 2017-05-13 00:09:35.699641876 +0700 .
drwxrwxr-x 14 root adm 20480 2020-09-24 23:58:56.950677706 +0700 ..
drwxrwxr-x 3 k k 4096 2017-05-13 00:09:33.555626045 +0700 Amy MacDonald
drwxrwxr-x 2 k k 4096 2017-05-13 00:09:33.547625987 +0700 Black Holes and Revelations
drwxrwxr-x 3 k k 4096 2017-05-13 00:09:34.223630978 +0700 Kings Of Leon
drwxrwxr-x 2 k k 4096 2017-05-13 00:09:32.671619517 +0700 Learn Thai
drwxrwxr-x 3 k k 4096 2017-05-13 00:09:35.755642289 +0700 Richard Wagner
Notice how the timestamps are ever so slightly different. Tar isn't preserving nanosecond precision when it creates the archive or when it's extracted. BTW, I am using the '--atime-preserve' switch when extracting the archive:
Code:
tar --atime-preserve -xvpf Music.tar
If I use the 'cp' command to copy to external drive:
Code:
cp -ar ~/Music /media/ext_drive/backup
then do:
Code:
ls -la --time-style=full-iso
to check timestamps on the copied files of the external drive, output is:
Code:
[w@wt Music-copy]$ ls -la --time-style=full-iso
total 28
drwxrwxrwx 7 k k 4096 2017-05-13 00:09:35.699641800 +0700 .
drwxr-xr-x 4 k k 4096 2020-09-27 15:11:23.603036057 +0700 ..
drwxrwxrwx 3 k k 4096 2017-05-13 00:09:33.555626000 +0700 'Amy MacDonald'
drwxrwxrwx 2 k k 4096 2017-05-13 00:09:33.547625900 +0700 'Black Holes and Revelations'
drwxrwxrwx 3 k k 4096 2017-05-13 00:09:34.223630900 +0700 'Kings Of Leon'
drwxrwxrwx 2 k k 4096 2017-05-13 00:09:32.671619500 +0700 'Learn Thai'
drwxrwxrwx 3 k k 4096 2017-05-13 00:09:35.755642200 +0700 'Richard Wagner'
It's close to the original, but notice how the last four digits of 'Black Holes and Revelations' has '5900' when the original has '5987'.
I've tried using the rar command as well. It was the same as using the tar command. i.e. didn't preserve nanosecond precision at all.
Also tried, drag and drop copy using the windowed interface on xfce. It was the same as the 'cp -ar' copy. i.e. last two digits not preserved. Maybe the default xfce file manager uses the ‘cp -ar’ in the background to copy?
Any idea how to copy files and directories fully preserving nanosecond precision?
Linux distro and version of old laptop is: Ubuntu 16.04
Thanks,
Last edited: