You are not logged in.

#1 2020-11-20 10:28:03

ArchNewbieKernel
Banned
Registered: 2020-09-25
Posts: 74

[SOLVED] frequently backup my system to a external disk

Hi there,

i have several questions yikes

1.
if i want to move the whole backup content from /actualbackup folder to /oldandstable folder

have i to use

mv /run/media/myusername/ArchBackup/actualbackup/* /run/media/myusername/ArchBackup/oldandstable

?


2.
if i want to do a backup on external drive and overwrite existing data, i do

sudo rsync -aAXHv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /run/media/myusername/ArchBackup/actualbackup

is that about right?



Thanks for reading and hopefuly even replying to my thread! cool

Last edited by ArchNewbieKernel (2020-11-25 09:22:17)

Offline

#2 2020-11-20 15:14:24

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: [SOLVED] frequently backup my system to a external disk

Mooks reasonable.  Two things I noticed:  /media is not in a standard Arch Linux file system, and you are not backing it up.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2020-11-20 15:47:40

seth
Member
Registered: 2012-09-03
Posts: 49,951

Re: [SOLVED] frequently backup my system to a external disk

The "mv" will not cover hidden files.
For regular backups you might want to use a hardlink copy (cp -al) of the last backup and "rsyc … --delete …" for space conserving full backup versions.
Then use the date as path denominator.

Offline

#4 2020-11-21 10:08:18

ArchNewbieKernel
Banned
Registered: 2020-09-25
Posts: 74

Re: [SOLVED] frequently backup my system to a external disk

ewaller wrote:

Mooks reasonable. I noticed:  /media is not in a standard Arch Linux file system

thats correct, i use Dolphin file Manager and it worked the last time i made the first backup to the external drive.

Offline

#5 2020-11-21 10:20:17

ArchNewbieKernel
Banned
Registered: 2020-09-25
Posts: 74

Re: [SOLVED] frequently backup my system to a external disk

seth wrote:

The "mv" will not cover hidden files.
For regular backups you might want to use a hardlink copy (cp -al) of the last backup and "rsyc … --delete …" for space conserving full backup versions.
Then use the date as path denominator.

would it be something like this

cp -al /run/media/myusername/ArchBackup/actualbackup/* /run/media/myusername/ArchBackup/oldandstable

then

sudo rsync -aAXHv --delete --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /run/media/myusername/ArchBackup/actualbackup

? big_smile

Offline

#6 2020-11-21 12:23:38

seth
Member
Registered: 2012-09-03
Posts: 49,951

Re: [SOLVED] frequently backup my system to a external disk

What does "/run/media/myusername/ArchBackup/oldandstable" look like before?
You want that to be an empty  directory.

What you could do is sth. like

bkpdir=/run/media/myusername/ArchBackup/$(date +%F.%R) # date based backup path
cp -ai $(realpath /run/media/myusername/ArchBackup/latest) $bkpdir # hardlink the last backup there
sudo rsync -aAXHv --delete --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / $bkpdir # update the backup
ln -sf $bkpdir /run/media/myusername/ArchBackup/latest # symlink the new bakup as "latest"

I've written this down as is w/o any testing, there could even be typos in it, so use it as inspiration and test it. Not a blind copy-and-whoopsadaisy.

Offline

#7 2020-11-21 13:06:30

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,783
Website

Re: [SOLVED] frequently backup my system to a external disk

Please edit your topic title to actually describe what you are trying to accomplish.

https://wiki.archlinux.org/index.php/Co … ow_to_post


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#8 2020-11-21 19:46:43

ArchNewbieKernel
Banned
Registered: 2020-09-25
Posts: 74

Re: [SOLVED] frequently backup my system to a external disk

seth wrote:

What does "/run/media/myusername/ArchBackup/oldandstable" look like before?

Its the most actual backup in it. I guess i gonna shred /oldandstable.

seth wrote:

You want that to be an empty  directory.

why?
What you could do is sth. like

# date based backup path
bkpdir=/run/media/myusername/ArchBackup/$(date +%F.%R)
# hardlink the last backup there
cp -ai $(realpath /run/media/myusername/ArchBackup/latest) $bkpdir
# update the backup
sudo rsync -aAXHv --delete --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / $bkpdir
# symlink the new bakup as "latest"
ln -sf $bkpdir /run/media/myusername/ArchBackup/latest

the codes with explainations in # looks lovely.

seth wrote:

whoopsadaisy.

this got me laughin'! Definitely like your humor and i mean it in a good way!

gonna try your written solution in a VM tomorrow!

Last edited by ArchNewbieKernel (2020-11-21 19:51:18)

Offline

#9 2020-11-21 20:58:37

seth
Member
Registered: 2012-09-03
Posts: 49,951

Re: [SOLVED] frequently backup my system to a external disk

why?

mkdir -p foo/bar bar/bar
touch foo/bar/foo bar/bar/foo
mv foo/* bar/

Also you'd end up with a wild mix of "backup" iterations (more like a random heap of old data)

Offline

#10 2020-11-23 13:44:41

ArchNewbieKernel
Banned
Registered: 2020-09-25
Posts: 74

Re: [SOLVED] frequently backup my system to a external disk

seth wrote:

why?

mkdir -p foo/bar bar/bar
touch foo/bar/foo bar/bar/foo
mv foo/* bar/

Also you'd end up with a wild mix of "backup" iterations (more like a random heap of old data)

thanks, it seems to work!
I just noticed, that in Latest symlink with 2020-11-23.09.58 inside of home folder it has a sdc folder (which is a disk) beside myusername. Is that normal? When i try to open 2020-11-23.09.58/home/sdc/home/myusername which has a lock symbol on it, i get error saying
"could not enter folder /run/media/myusernamer/ArchBackup/2020-11-23.09.58/home/sdc/home/myusername."
while
2020-11-23.09.58/home/myusername
can be opened.

Offline

#11 2020-11-23 14:19:50

seth
Member
Registered: 2012-09-03
Posts: 49,951

Re: [SOLVED] frequently backup my system to a external disk

Well, is there a "/home/sdc"?
Can you see in the rsync output where the directory came from?
It would seem it's a second (bound) mount of the root directory?
What's

stat /run/media/myusernamer/ArchBackup/2020-11-23.09.58/home/sdc/home/myusername
stat /run/media/myusernamer/ArchBackup/2020-11-23.09.58/home/myusername

Offline

#12 2020-11-23 18:29:28

ArchNewbieKernel
Banned
Registered: 2020-09-25
Posts: 74

Re: [SOLVED] frequently backup my system to a external disk

seth wrote:

Well, is there a "/home/sdc"?

yes, right after the "/2020-11-23.09.58"

seth wrote:

Can you see in the rsync output where the directory came from?

tried "cat ~/.bash_history" but couldnt find the output anymore ( maybe i looked wrong)

seth wrote:

It would seem it's a second (bound) mount of the root directory?
What's

stat /run/media/myusernamer/ArchBackup/2020-11-23.09.58/home/sdc/home/myusername
stat /run/media/myusernamer/ArchBackup/2020-11-23.09.58/home/myusername

input with output:

 $ stat /run/media/myusername/ArchBackup/2020-11-23.09:58/home/sdc/home /myusername
File: /run/media/myusername/ArchBackup/2020-11-23.09:58/home/sdc/home/myusername
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fe00h/65024d Inode: 28709811 Links: 19
Access: (0700/drwx------) Uid: ( 0/   root) Gid: ( 1000/myusername)
Access: 2020-11-23 10:01:33.493652915 +0000
Modify: 2020-09-20 17:58:24.678572445 +0000
Change: 2020-11-23 10:01:33.626986251 +0000
Birth: 2020-11-23 10:01:33.493652915 +0000


$ stat /run/media/myusername/ArchBackup/2020-11-23.09:58/home /myusername
File: /run/media/myusername/ArchBackup/2020-11-23.09:58/home/myusername
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fe00h/65024d Inode: 27526850 Links: 20
Access: (0700/drwx------) Uid: ( 1000/myusername) Gid: ( 1000/myusername)
Access: 2020-11-23 10:31:55.037024707 +0000
Modify: 2020-11-23 09:12:40.483589653 +0000
Change: 2020-11-23 10:13:47.217001702 +0000
Birth: 2020-11-23 09:58:32.426982422 +0000

Offline

#13 2020-11-23 19:03:09

seth
Member
Registered: 2012-09-03
Posts: 49,951

Re: [SOLVED] frequently backup my system to a external disk

yes, right after the "/2020-11-23.09.58"

No… in the absolute path - the one you're backing up…

tried "cat ~/.bash_history"

No again: the rsync output. Not your bashrc.

The directory the inside the "sdc" belogns to the root user, so you sudo'd it there and it should™ not have been the rsync call (because "-a")

stat /run/media/myusername/ArchBackup/2020-11-23.09:58/home/sdc/home
stat /run/media/myusername/ArchBackup/2020-11-23.09:58/home/sdc
stat /run/media/myusername/ArchBackup/2020-11-23.09:58/home
stat /home/sdc

Offline

#14 2020-11-23 19:16:04

ArchNewbieKernel
Banned
Registered: 2020-09-25
Posts: 74

Re: [SOLVED] frequently backup my system to a external disk

seth wrote:

The directory the inside the "sdc" belogns to the root user, so you sudo'd it there and it should™ not have been the rsync call (because "-a")

stat /run/media/myusername/ArchBackup/2020-11-23.09:58/home/sdc/home
stat /run/media/myusername/ArchBackup/2020-11-23.09:58/home/sdc
stat /run/media/myusername/ArchBackup/2020-11-23.09:58/home
stat /home/sdc

I'm sorry but this time i don't get what you mean. You want me to sudo execute  something and then run the 4 "stat" commands ?

Offline

#15 2020-11-23 19:21:08

seth
Member
Registered: 2012-09-03
Posts: 49,951

Re: [SOLVED] frequently backup my system to a external disk

Just run the 4 stats and post the output.

---
The other part is an explanation that you must have created "/run/media/myusername/ArchBackup/2020-11-23.09:58/home/sdc/home/myusername" using some sudo command - and that this sudo command cannot have been "rsync -…a…" (because that preserves ownership)

Offline

#16 2020-11-23 19:40:51

ArchNewbieKernel
Banned
Registered: 2020-09-25
Posts: 74

Re: [SOLVED] frequently backup my system to a external disk

seth wrote:

an explanation that you must have created "/run/media/myusername/ArchBackup/2020-11-23.09:58/home/sdc/home/myusername" using some sudo command - and that this sudo command cannot have been "rsync -…a…" (because that preserves ownership)

ah! thats right because UID=1000  is main user/root.

seth wrote:

Just run the 4 stats and post the output.

$ stat /run/media/myusername/ArchBackup/2020-11-23.09:58/home/sdc/home       
  File: /run/media/myusername/ArchBackup/2020-11-23.09:58/home/sdc/home
  Size: 4096      	Blocks: 8          IO Block: 4096   directory
Device: fe00h/65024d	Inode: 27526862    Links: 3
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: ( 1000/myusername)
Access: 2020-11-23 10:55:05.680387907 +0000
Modify: 2020-09-08 06:23:03.384053293 +0000
Change: 2020-11-23 10:01:33.626986251 +0000
 Birth: 2020-11-23 09:58:32.426982422 +0000


$ stat /run/media/myusername/ArchBackup/2020-11-23.09:58/home/sdc     
  File: /run/media/myusername/ArchBackup/2020-11-23.09:58/home/sdc
  Size: 4096      	Blocks: 8          IO Block: 4096   directory
Device: fe00h/65024d	Inode: 27526849    Links: 19
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: ( 1000/myusername)
Access: 2020-11-23 10:31:55.030358041 +0000
Modify: 2020-09-26 07:40:47.874561119 +0000
Change: 2020-11-23 09:58:32.643649093 +0000
 Birth: 2020-11-23 09:58:32.426982422 +0000


$ stat /run/media/myusername/ArchBackup/2020-11-23.09:58/home    
  File: /run/media/myusername/ArchBackup/2020-11-23.09:58/home
  Size: 4096      	Blocks: 8          IO Block: 4096   directory
Device: fe00h/65024d	Inode: 27525130    Links: 4
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: ( 1000/myusername)
Access: 2020-11-23 10:01:12.390319136 +0000
Modify: 2020-09-08 06:23:03.384053293 +0000
Change: 2020-11-23 09:58:32.643649093 +0000
 Birth: 2020-11-23 09:58:31.606982405 +0000


$ stat /home/sdc                                                  
  File: /home/sdc
  Size: 4096      	Blocks: 8          IO Block: 4096   directory
Device: 803h/2051d	Inode: 45754647    Links: 19
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: ( 1000/myusername)
Access: 2020-11-23 09:58:32.413649089 +0000
Modify: 2020-09-26 07:40:47.874561119 +0000
Change: 2020-09-29 18:51:11.687665946 +0000
 Birth: 2020-09-26 12:31:11.182639548 +0000

Offline

#17 2020-11-23 19:44:26

seth
Member
Registered: 2012-09-03
Posts: 49,951

Re: [SOLVED] frequently backup my system to a external disk

$ stat /home/sdc                                                  
  File: /home/sdc
  Size: 4096      	Blocks: 8          IO Block: 4096   directory
Device: 803h/2051d	Inode: 45754647    Links: 19
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: ( 1000/myusername)
Access: 2020-11-23 09:58:32.413649089 +0000
Modify: 2020-09-26 07:40:47.874561119 +0000
Change: 2020-09-29 18:51:11.687665946 +0000
 Birth: 2020-09-26 12:31:11.182639548 +0000

So the directory is simply there - you created it 2020-09-26 12:31:11 (and it obviously gets archived)
What or why it is, I've no idea. Look at it, but I suspect it's some botched previous backup attempt?

Offline

#18 2020-11-23 19:56:40

ArchNewbieKernel
Banned
Registered: 2020-09-25
Posts: 74

Re: [SOLVED] frequently backup my system to a external disk

seth wrote:
$ stat /home/sdc                                                  
  File: /home/sdc
  Size: 4096      	Blocks: 8          IO Block: 4096   directory
Device: 803h/2051d	Inode: 45754647    Links: 19
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: ( 1000/myusername)
Access: 2020-11-23 09:58:32.413649089 +0000
Modify: 2020-09-26 07:40:47.874561119 +0000
Change: 2020-09-29 18:51:11.687665946 +0000
 Birth: 2020-09-26 12:31:11.182639548 +0000

So the directory is simply there - you created it 2020-09-26 12:31:11 (and it obviously gets archived)
What or why it is, I've no idea. Look at it, but I suspect it's some botched previous backup attempt?

I assume this happened when i chroooted into the System back then and used the wrong directory to place the backup.

Do you think its safe to shred "/sdc" folder ?
Must be an old backup attemp, since you underlined the fact that the user inside of it is locked because i havent ran it in sudo.

Offline

#19 2020-11-24 04:59:06

seth
Member
Registered: 2012-09-03
Posts: 49,951

Re: [SOLVED] frequently backup my system to a external disk

I think you need to look into the directory and its subdirectories to see whether you've important data there.
I'm not going to make a statement about deleting a path that I know nothing about.

Offline

#20 2020-11-25 09:21:57

ArchNewbieKernel
Banned
Registered: 2020-09-25
Posts: 74

Re: [SOLVED] frequently backup my system to a external disk

seth wrote:

I think you need to look into the directory and its subdirectories to see whether you've important data there.
I'm not going to make a statement about deleting a path that I know nothing about.

worked!
Thank you so much for your time and patience in this topic! smile

Offline

#21 2020-11-25 16:43:46

herbie643
Member
Registered: 2015-03-03
Posts: 28

Re: [SOLVED] frequently backup my system to a external disk

I would have used Timeshift.  Simple and easy to set up then set up a cron with
0 0 * * 1,3,5 timeshift --create --comments "cron time"
Works great.
Hey, but that's me.  Different strokes for different folks.

If you don't like cron you could set up a systemd timer instead.

Last edited by herbie643 (2020-11-25 16:45:28)

Offline

Board footer

Powered by FluxBB