Linux-BTRFS Archive on lore.kernel.org
 help / color / Atom feed
* Timestamp received snapshot is strange
@ 2019-11-29  6:56 btrfsquestion
  0 siblings, 0 replies; only message in thread
From: btrfsquestion @ 2019-11-29  6:56 UTC (permalink / raw)
  To: linux-btrfs

Hi,

I have a question regarding the timestapmp of snapshots on a BTRFS system

I tried to send snapshots as part of backup to another system but I hit 
a problem.
Most snapshots had the timestamp based on the receiving time and a few 
had the timestamp the original snapshot was created.
Here is an ls

  LANG=C ls -lah
total 0
drwxr-xr-x 1 root root 1.7K Nov 28 20:36 .
drwxr-xr-x 1 root root   38 Nov 12 14:19 ..
drwxr-xr-x 1 root root   10 Nov 16 18:38 home-snapshot-16.11.2019-10:07
drwxr-xr-x 1 root root   10 Nov 16 19:41 home-snapshot-16.11.2019-18:49
drwxr-xr-x 1 root root   10 Nov 17 11:38 home-snapshot-17.11.2019-10:43
drwxr-xr-x 1 root root   10 Nov 19 08:00 home-snapshot-19.11.2019-07:21
drwxr-xr-x 1 root root   10 Nov 22 20:44 home-snapshot-22.11.2019-20:14
drwxr-xr-x 1 root root   10 Nov 23 18:22 home-snapshot-23.11.2019-17:29
drwxr-xr-x 1 root root   10 Nov 23 18:00 home-snapshot-23.11.2019-18:00
drwxr-xr-x 1 root root   10 Nov 24 14:29 home-snapshot-23.11.2019-19:03
drwxr-xr-x 1 root root   10 Nov 24 14:56 home-snapshot-24.11.2019-09:50
drwxr-xr-x 1 root root   10 Nov 24 15:03 home-snapshot-24.11.2019-10:31
drwxr-xr-x 1 root root   10 Nov 24 15:07 home-snapshot-24.11.2019-10:53
drwxr-xr-x 1 root root   10 Nov 24 15:10 home-snapshot-24.11.2019-11:01
drwxr-xr-x 1 root root   10 Nov 24 15:17 home-snapshot-24.11.2019-11:32
drwxr-xr-x 1 root root   10 Nov 24 15:30 home-snapshot-24.11.2019-12:32
drwxr-xr-x 1 root root   10 Nov 24 15:30 home-snapshot-24.11.2019-13:33
drwxr-xr-x 1 root root   10 Nov 24 15:35 home-snapshot-24.11.2019-14:34
drwxr-xr-x 1 root root   10 Nov 24 15:56 home-snapshot-24.11.2019-15:34
drwxr-xr-x 1 root root   10 Nov 24 17:28 home-snapshot-24.11.2019-16:34
drwxr-xr-x 1 root root   10 Nov 28 08:34 home-snapshot-24.11.2019-18:59
drwxr-xr-x 1 root root   10 Nov 28 08:38 home-snapshot-25.11.2019-07:12
drwxr-xr-x 1 root root   10 Nov 28 08:48 home-snapshot-25.11.2019-19:33
drwxr-xr-x 1 root root   10 Nov 28 08:52 home-snapshot-26.11.2019-07:23
drwxr-xr-x 1 root root   10 Nov 28 09:02 home-snapshot-26.11.2019-19:24
drwxr-xr-x 1 root root   10 Nov 28 09:10 home-snapshot-27.11.2019-07:26
drwxr-xr-x 1 root root   10 Nov 28 09:22 home-snapshot-27.11.2019-19:30
drwxr-xr-x 1 root root   10 Nov 28 09:30 home-snapshot-27.11.2019-20:31
drwxr-xr-x 1 root root   10 Nov 27 21:32 home-snapshot-27.11.2019-21:32
drwxr-xr-x 1 root root   10 Nov 28 20:48 home-snapshot-28.11.2019-08:15

this is a view from the source

drwxr-xr-x 1 root root   10 Nov 24 16:34 home-snapshot-24.11.2019-16:34
drwxr-xr-x 1 root root   10 Nov 24 18:59 home-snapshot-24.11.2019-18:59
drwxr-xr-x 1 root root   10 Nov 25 07:12 home-snapshot-25.11.2019-07:12
drwxr-xr-x 1 root root   10 Nov 25 19:33 home-snapshot-25.11.2019-19:33
drwxr-xr-x 1 root root   10 Nov 26 07:23 home-snapshot-26.11.2019-07:23
drwxr-xr-x 1 root root   10 Nov 26 19:24 home-snapshot-26.11.2019-19:24
drwxr-xr-x 1 root root   10 Nov 27 07:26 home-snapshot-27.11.2019-07:26
drwxr-xr-x 1 root root   10 Nov 27 19:30 home-snapshot-27.11.2019-19:30
drwxr-xr-x 1 root root   10 Nov 27 20:31 home-snapshot-27.11.2019-20:31
drwxr-xr-x 1 root root   10 Nov 27 21:32 home-snapshot-27.11.2019-21:32
drwxr-xr-x 1 root root   10 Nov 28 07:14 home-snapshot-28.11.2019-07:14
drwxr-xr-x 1 root root   10 Nov 28 08:15 home-snapshot-28.11.2019-08:15
drwxr-xr-x 1 root root   10 Nov 28 09:15 home-snapshot-28.11.2019-09:15
drwxr-xr-x 1 root root   10 Nov 28 19:33 home-snapshot-28.11.2019-19:33

As you can see on the last two snapshots of the receiving site the 
snapshot "home-snapshot-27.11.2019-21:32" is the only one with a date 
based on receiving time. I wrote that script to transfer the snapshots

#!/bin/bash
snapshotdir=$1
remotedest=$2
remotesnapshotdir=$3
localsnapshot=$(ls -t $snapshotdir |head -n 1)
lastremotesnapshot=$(ssh -l root $remotedest "ls -t $remotesnapshotdir | 
head -n 1")
if [ "$lastremotesnapshot" == "" ]; then
   echo Fehler bei der SSH Verbindung
   exit 1
fi
#alte snapshots aufäumen
foundposition=$(ls -tr $snapshotdir |grep -n $lastremotesnapshot |cut 
-f1 -d:)
nextsnapshot=`ls -tr $snapshotdir | head -n $((foundposition+1))|tail -n 1`
if [ "$foundposition" -ge 11 ]; then
   ls $snapshotdir -tr|head -n $((foundposition -10)) |awk -v 
dir="$snapshotdir" '{print "btrfs subvolume delete "dir""$1}' |sh
fi
if [ "$lastremotesnapshot" != "$localsnapshot" ]; then
   if [ -d $snapshotdir$lastremotesnapshot ]; then
     btrfs send -p $snapshotdir$lastremotesnapshot 
$snapshotdir$nextsnapshot |lzop -1 | ssh -l root $remotedest "lzop -d | 
btrfs receive $remotesnapshotdir"
     if [ "$?" -ne 0 ]; then
       exit 1
     fi
     $0 $1 $2 $3
     exit $?
   else
     echo Snapshot Ursprung fehlt bitte Manuell übertragen
     exit 1
   fi
else
   echo Snapshots bereits aktuell
   exit 0
fi

But that scriped fails if it ancounters a problem with the order of the 
snapshots.

But what is the reason of the different timestamps? And how can I avoid it?

recieving site

uname -a
Linux miniserver 4.19.82-gentoo #4 SMP Tue Nov 19 19:55:09 CET 2019 
x86_64 AMD A4-5000 APU with Radeon(TM) HD Graphics AuthenticAMD 
GNU/Linux btrfs --version
btrfs-progs v5.3.1

sending site

uname -a
Linux robindesk 5.3.13-arch1-1 #1 SMP PREEMPT Sun, 24 Nov 2019 10:15:50 
+0000 x86_64 GNU/Linux
btrfs --version
btrfs-progs v5.3.1


greetings



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-29  6:56 Timestamp received snapshot is strange btrfsquestion

Linux-BTRFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-btrfs/0 linux-btrfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-btrfs linux-btrfs/ https://lore.kernel.org/linux-btrfs \
		linux-btrfs@vger.kernel.org
	public-inbox-index linux-btrfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-btrfs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git