Solved - backup using rsync

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
JohnLL
Level 3
Level 3
Posts: 116
Joined: Mon May 11, 2015 6:58 am

Solved - backup using rsync

Post by JohnLL »

I screwed up!!!
I originally wanted to create an exact copy of my desktop Home folder on my external drive SDC ( which is a 2TB drive) as a backup and then setup my desktop Home folder on SDB so I don't run out of space. As an alternative how would I setup specific folders like woodworking, Linux, Ham radio etc on SDB but have them show up as sub-folders under a primary folder which is under 'Home' on the desktop of SDA.

My setup (mint 20.2) is on SDA which is 1TB drive. I was sitting around 500GB free. What I was trying to do was enable SDB which is an internal HD of 1TB as my Home folder storage. I did a google on how to do it and I found a page (https://www.howtogeek.com/427480/how-to ... ux-system/) on how to back up my Home directory as a backup on what I thought was an external 2TB drive (SDC) which if have named 'Storage A' using 'sudo rsync -r /home/ve3sjv /media/ve3sjv/Storage_A'. What that did was create a directory in SDA under /media/home/ve3sjv/Storage_A. And my usable free space on SDA is now 130GB. I've tried going into /media/Storage_A as root and rm -rf ve3sjv, I've tried going into individual directories like PDFs or Videos and tried deleting the directories and files. The result is permission denied.
That's where things stand at the moment. I need to regain the 350GB I lost.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: backup using rsync

Post by rene »

There's an unfortunate set of alternatives in your report. I.e., you say that you did

Code: Select all

sudo rsync -r /home/ve3sjv /media/ve3sjv/Storage_A
but then say that wound up in /media/home/ve3sjv/Storage_A, i.e., with the additional home. Then one sentence later you say to have tried to delete /media/Storage_A/ve3sjv, i.e., leaving out the first occurrence of "ve3sjv" as a path component: assuming that your rsync command was quoted correctly, where things ended up was /media/ve3sjv/Storage_A/ve3sjv and a simple

Code: Select all

sudo rm -r /media/ve3sjv/Storage_A/ve3sjv
would get rid of it again. Of course make sure that indeed all that's there can and should go before doing so.

Other that that it seems the main issue was that you hadn't in fact mounted the drive before doing the copying (and that you used sudo; normally that should not be needed when having the automounter mount stuff under /media/<you>).
JohnLL
Level 3
Level 3
Posts: 116
Joined: Mon May 11, 2015 6:58 am

Re: backup using rsync

Post by JohnLL »

Actually Storage A was mounted but as USER I didn't have permission to write to it hence the sudo. Also I did not realize that "Storage A" is different than "Storage_A". I thought I would need something to "tie" "Storage" and "A" together because when I did the line with "Storage A" it told me Storage was not found. Did some reading and have since found the exclamation ties a two word named folder as a single name (as I understand it). I'll keep trying to remove the /media/ve3sjv/Storage_A and I will succeed at some point.
vanadium
Level 4
Level 4
Posts: 325
Joined: Sun Dec 27, 2015 1:07 pm

Re: backup using rsync

Post by vanadium »

That is a very unclear story. However, as long as your original files you attempted to move, you have not screwed up, yet.

You used "sudo" to copy your data elsewhere using "rsync". You used the option `-r`, which means "recursive", nothing more (that were the wrong options to create an identical copy of your home folder). Accordingly, the copied files or folders are owned by user "root", i.e., system administrator. And therefore, you cannot delete these copied data as normal user. You again need "root" permissions to delete these data.

Be very careful in removing the copied data again. Because you must do that as root, you will be playing with fire. As a general rule, use "sudo" only when you know very well what you are doing.
User avatar
AndyMH
Level 21
Level 21
Posts: 13582
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: backup using rsync

Post by AndyMH »

vanadium wrote: Fri Jul 23, 2021 9:20 am That is a very unclear story.
Agreed, I couldn't work out whether the OP had mounted the partition on the external drive or not.

Back when I used home grown scripts with rsync to backup my home folder I used:

Code: Select all

rsync -aAXhz --stats --delete --no-inc-recursive --info=progress2 --log-file=$logfile --exclude={".*",".*/","VirtualBox VMs/"} "$source1" "$destination"
where source1 would be my home folder and destination wherever I had mounted my external storage device.

Haven't used this since 2017 when I discovered that timeshift and backintime were easier.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
JohnLL
Level 3
Level 3
Posts: 116
Joined: Mon May 11, 2015 6:58 am

Re: backup using rsync

Post by JohnLL »

Hi Rene
I used the suggested command <sudo rm -r /media/ve3sjv/Storage_A/ve3sjv> as suggested and all files(folders) are gone and I have my 300+GB free space again. My original intent was to create an exact copy of all files/folders in my Home directory on an external 2TB hard drive. I didn't think it would create the "Storage_A" as a sub-folder under /media. Lesson learned. I think I'll just stick to regular backups from now on. Again thanks for your help.
JohnLL
Level 3
Level 3
Posts: 116
Joined: Mon May 11, 2015 6:58 am

Re: backup using rsync

Post by JohnLL »

Hi vanadium and AndyMH.
My original intent was to create an exact copy of my Home directory on an external 2TB hard drive. I did a google and found a page that seemed to be what I needed. What I didn't realize was that even though SDC (the 2TB HD) was formatted as ext4 and mounted I as user had no access to write to the drive and also I wasn't aware it would create a new virtual device under /media which filled my hard drive. I think I will stick to just a plain backup from now on. Lesson learned. Thanks for the assistance. Never had a course on Linux and just basically learning as I continue to use the OS. Rene provided me with a code that removed all files under the "Storage_A" virtual drive I created under /media. Your help was definitely appreciated.
mikeflan
Level 16
Level 16
Posts: 6974
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: Solved - backup using rsync

Post by mikeflan »

What I didn't realize was that even though SDC (the 2TB HD) was formatted as ext4 and mounted I as user had no access to write to the drive
That is generally a bad thing. You should correct that. Perhaps you formatted it with gparted? If so, that makes root the owner. I recommend you format it EXT4 with the Disks software if you can accept losing all the data on the drive. Another option is to just force all of it to you being the owner. Perhaps something like this:

Code: Select all

sudo chown -R $USER:$USER /media/john/[your_drive_name]
But I think this command won't stick for good, so formatting with Disks is much better.
User avatar
AndyMH
Level 21
Level 21
Posts: 13582
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Solved - backup using rsync

Post by AndyMH »

mikeflan wrote: Fri Jul 23, 2021 1:45 pm But I think this command won't stick for good, so formatting with Disks is much better.
It should be persistent.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
JohnLL
Level 3
Level 3
Posts: 116
Joined: Mon May 11, 2015 6:58 am

Re: Solved - backup using rsync

Post by JohnLL »

Hi Mikeflan. Yes, I formatted it with gparted. I move all pertinent files to a 4TB drive so anything that was left was fair game to delete.
mikeflan
Level 16
Level 16
Posts: 6974
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: Solved - backup using rsync

Post by mikeflan »

OK, so try the sudo chown command above and maybe that is all you need to do. Then after you own all the files and directories you don't need to use sudo again to manipulate the files.
Locked

Return to “Cinnamon”