Using the Terminal to Backup Home Dir.

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
User avatar
chazb
Level 3
Level 3
Posts: 166
Joined: Wed Nov 30, 2016 2:56 am
Location: Oklahoma

Using the Terminal to Backup Home Dir.

Post by chazb » Thu May 03, 2018 3:44 am

I really would like to get some experience using the Command Line, and this looks a good place to start. I have explored it on the web and not fond much Mostly Using the tar command, but I think I read somewhere that tar doesn't work well in Linux Mint. Is there there anybody out there that know how to do a backup using the Terminal?

User avatar
Sir Charles
Level 7
Level 7
Posts: 1832
Joined: Thu Jan 04, 2018 1:00 pm

Re: Using the Terminal to Backup Home Dir.

Post by Sir Charles » Thu May 03, 2018 4:16 am

I suppose that's one of the ironies of life, doing the wrong thing at the right moment -C.C.

Mute Ant
Level 13
Level 13
Posts: 4918
Joined: Tue Sep 03, 2013 7:45 pm

Re: Using the Terminal to Backup Home Dir.

Post by Mute Ant » Thu May 03, 2018 4:30 am

My preference is the mksquashfs command.
sudo mksquashfs /home /media/mute/toshipod-e/2018-05-03-home.sfs ### Duplicate /home as a compressed read-only mountable file image.
+ Needs no options at all to do the job.
+ Perfect since 2012.
+ Every live session Debian or Ubuntu or Mint etc etc keeps it perfect as new kernels are released... no squashfs... no live session.
Data stored in an encrypted volume will only be accessible with the original password. Without this key, all the data will remain scrambled beyond hope of recovery.

User avatar
chazb
Level 3
Level 3
Posts: 166
Joined: Wed Nov 30, 2016 2:56 am
Location: Oklahoma

Re: Using the Terminal to Backup Home Dir.

Post by chazb » Thu May 03, 2018 11:58 pm

Mute Ant wrote:
Thu May 03, 2018 4:30 am
My preference is the mksquashfs command.
sudo mksquashfs /home /media/mute/toshipod-e/2018-05-03-home.sfs ### Duplicate /home as a compressed read-only mountable file image.
+ Needs no options at all to do the job.
+ Perfect since 2012.
+ Every live session Debian or Ubuntu or Mint etc etc keeps it perfect as new kernels are released... no squashfs... no live session.
Copied your code into my terminal, and this was the response...

Code: Select all

sudo: mksquashfs: command not found

User avatar
chrisuk
Level 5
Level 5
Posts: 593
Joined: Thu Jun 12, 2008 6:16 am

Re: Using the Terminal to Backup Home Dir.

Post by chrisuk » Fri May 04, 2018 2:54 am

More than what you asked for, but:

Here's a couple of pages worth reading... both are the same, but one has a few more details about hard links. It's basically what Timeshift does, but you'll maybe learn something useful in the process ;)

Rsync Date Stamped, Snapshot Style, Incremental Backups

Time Machine for every Unix out there
Chris

Manjaro MATE - MX Linux - LMDE MATE

User avatar
catweazel
Level 16
Level 16
Posts: 6977
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Using the Terminal to Backup Home Dir.

Post by catweazel » Fri May 04, 2018 3:30 am

Mute Ant wrote:
Thu May 03, 2018 4:30 am
My preference is the mksquashfs command.
sudo mksquashfs /home /media/mute/toshipod-e/2018-05-03-home.sfs ### Duplicate /home as a compressed read-only mountable file image.
+ Needs no options at all to do the job.
+ Perfect since 2012.
+ Every live session Debian or Ubuntu or Mint etc etc keeps it perfect as new kernels are released... no squashfs... no live session.
Parallel mksquashfs: Using 16 processors

Cool!

sudo mount -o loop /media/catweazel/HWRAID10-0/Working/Archives/2018-05-04-home.sfs /mnt -t squashfs

Brilliant! Too easy.

Thanks, it's really appreciated. You've saved me a lot of work when I start writing my backup program...
Caution: Dancing Wu Li Master and Official curmudgeon-in-chief

Mute Ant
Level 13
Level 13
Posts: 4918
Joined: Tue Sep 03, 2013 7:45 pm

Re: Using the Terminal to Backup Home Dir.

Post by Mute Ant » Fri May 04, 2018 6:04 am

The sudo ensures all the objects in /home can be duplicated, but it's hiding a helpful message...
mute@kermes ~ $ mksquashfs -----> The program 'mksquashfs' is currently not installed. You can install it by typing: sudo apt install squashfs-tools
...that's just normal build-your-own-GNU... add the commands that a distribution has left out.
Data stored in an encrypted volume will only be accessible with the original password. Without this key, all the data will remain scrambled beyond hope of recovery.

User avatar
chazb
Level 3
Level 3
Posts: 166
Joined: Wed Nov 30, 2016 2:56 am
Location: Oklahoma

Re: Using the Terminal to Backup Home Dir.

Post by chazb » Fri Jun 22, 2018 2:39 am

Mute Ant wrote:
Thu May 03, 2018 4:30 am
My preference is the mksquashfs command.
sudo mksquashfs /home /media/mute/toshipod-e/2018-05-03-home.sfs ### Duplicate /home as a compressed read-only mountable file image.
+ Needs no options at all to do the job.
+ Perfect since 2012.
+ Every live session Debian or Ubuntu or Mint etc etc keeps it perfect as new kernels are released... no squashfs... no live session.
Where does it put the "compressed read-only mountable file image"? Or what additional code would I use to mount it on a usb stick?

User avatar
catweazel
Level 16
Level 16
Posts: 6977
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Using the Terminal to Backup Home Dir.

Post by catweazel » Fri Jun 22, 2018 3:24 am

chazb wrote:
Fri Jun 22, 2018 2:39 am
Where does it put the "compressed read-only mountable file image"?
/media/mute/toshipod-e/2018-05-03-home.sfs
Or what additional code would I use to mount it on a usb stick?
sudo mount -o loop /media/mute/toshipod-e/2018-05-03-home.sfs /mnt -t squashfs

It's in the posts up there. All you need do is read.
Caution: Dancing Wu Li Master and Official curmudgeon-in-chief

User avatar
chazb
Level 3
Level 3
Posts: 166
Joined: Wed Nov 30, 2016 2:56 am
Location: Oklahoma

Re: Using the Terminal to Backup Home Dir.

Post by chazb » Fri Jun 22, 2018 3:09 pm

catweazel wrote:
Fri Jun 22, 2018 3:24 am


/media/mute/toshipod-e/2018-05-03-home.sfs
Or what additional code would I use to mount it on a usb stick?
sudo mount -o loop /media/mute/toshipod-e/2018-05-03-home.sfs /mnt -t squashfs

It's in the posts up there. All you need do is read.
I should use the current date in the code? Correct?

Ok so once I got on the usb stick, what code do I use to get ot off the stick and installed on to 18.3.

I am not just going to copy and paste all this code, I want to know what I am doing and why, like what does "toshipod" do, and why it is followed by "-e".

On the other hand and after searching on line for a bit, I challenge anybody to tell me what "toshipod" does.

User avatar
catweazel
Level 16
Level 16
Posts: 6977
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Using the Terminal to Backup Home Dir.

Post by catweazel » Fri Jun 22, 2018 6:30 pm

chazb wrote:
Fri Jun 22, 2018 3:09 pm
I should use the current date in the code? Correct?

Ok so once I got on the usb stick, what code do I use to get ot off the stick and installed on to 18.3.

I am not just going to copy and paste all this code, I want to know what I am doing and why, like what does "toshipod" do, and why it is followed by "-e".

On the other hand and after searching on line for a bit, I challenge anybody to tell me what "toshipod" does.
/media/mute/toshipod-e/2018-05-03-home.sfs is @Mute Ant's line based on their local machine. You need to modify it to suit your local machine's environment and your personal preferences. It's a unix path and file name. Simply copying it and pasting it into your machine will not work.

If you look at @Mute Ant's instructions and my reply here, you will see that I modified the unix path for my local machine.
Caution: Dancing Wu Li Master and Official curmudgeon-in-chief

User avatar
chazb
Level 3
Level 3
Posts: 166
Joined: Wed Nov 30, 2016 2:56 am
Location: Oklahoma

Re: Using the Terminal to Backup Home Dir.

Post by chazb » Sat Jun 23, 2018 3:04 am

catweazel wrote:
Fri Jun 22, 2018 6:30 pm
chazb wrote:
Fri Jun 22, 2018 3:09 pm
I should use the current date in the code? Correct?

Ok so once I got on the usb stick, what code do I use to get ot off the stick and installed on to 18.3.

I am not just going to copy and paste all this code, I want to know what I am doing and why, like what does "toshipod" do, and why it is followed by "-e".

On the other hand and after searching on line for a bit, I challenge anybody to tell me what "toshipod" does.
/media/mute/toshipod-e/2018-05-03-home.sfs is @Mute Ant's line based on their local machine. You need to modify it to suit your local machine's environment and your personal preferences. It's a unix path and file name. Simply copying it and pasting it into your machine will not work.

If you look at @Mute Ant's instructions and my reply here, you will see that I modified the unix path for my local machine.
charles is the name of my computer, so it should look something like this?,,,,,,,,,,,

Code: Select all

sudo mksquashfs /home /media/charles/2018-06-23-home.sfs
or

Code: Select all

sudo mount -o loop /media/charles/2018-06-23-home.sfs /mnt -t squashfs
for puttting on a usb stick.

I notice you all use some options like -o, -e, -t etc. should I have an option after ,,,charles,,,?

User avatar
catweazel
Level 16
Level 16
Posts: 6977
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Using the Terminal to Backup Home Dir.

Post by catweazel » Sat Jun 23, 2018 4:06 am

chazb wrote:
Sat Jun 23, 2018 3:04 am
charles is the name of my computer, so it should look something like this?,,,,,,,,,,,

Code: Select all

sudo mksquashfs /home /media/charles/2018-06-23-home.sfs
or
/home is your home directory, the directory you want to backup.

2018-06-23-home.sfs is the name of the file you want to back up to.

/media/charles/ is the path to the file. That path must exist already, and because it's on another partition, it needs to be mounted.

Code: Select all

sudo mount -o loop /media/charles/2018-06-23-home.sfs /mnt -t squashfs
for puttting on a usb stick.
No. That is to mount the file so you can recover files from it.

What I don't understand is, given you're struggling with command line syntax and unix paths, why you want to backup using the command line when there are enough GUI applications out there that will do the job reasonably well. Next to flying to wherever you live and typing in the correctly modified command for you, I don't know what else to tell you.
Caution: Dancing Wu Li Master and Official curmudgeon-in-chief

User avatar
Sir Charles
Level 7
Level 7
Posts: 1832
Joined: Thu Jan 04, 2018 1:00 pm

Re: Using the Terminal to Backup Home Dir.

Post by Sir Charles » Sat Jun 23, 2018 7:00 am

@catweazel

I might be mistaken, but wouldn't

Code: Select all

sudo mksquashfs /home /media/charles/2018-06-23-home.sfs
just create the file in /media/charles/ and not on the USB stick which seems to be the intention of the OP?
chazb wrote:
Fri Jun 22, 2018 2:39 am
... Or what additional code would I use to mount it on a usb stick?
Compare to:
Mute Ant wrote:
Thu May 03, 2018 4:30 am
sudo mksquashfs /home /media/mute/toshipod-e/2018-05-03-home.sfs ### Duplicate /home as a compressed read-only mountable file image.
Edit: Of course, if charles is the name of the medium mounted at /media, then it's alright, ...I guess :?
I suppose that's one of the ironies of life, doing the wrong thing at the right moment -C.C.

Boca
Level 4
Level 4
Posts: 342
Joined: Sun Feb 15, 2015 5:02 am

Re: Using the Terminal to Backup Home Dir.

Post by Boca » Sat Jun 23, 2018 4:06 pm

Mute Ant wrote:
Thu May 03, 2018 4:30 am
My preference is the mksquashfs command.
sudo mksquashfs /home /media/mute/toshipod-e/2018-05-03-home.sfs ### Duplicate /home as a compressed read-only mountable file image.
+ Needs no options at all to do the job.
+ Perfect since 2012.
+ Every live session Debian or Ubuntu or Mint etc etc keeps it perfect as new kernels are released... no squashfs... no live session.

Neat !

Tried it out and it's working fine first time.

Thanks, Tony

User avatar
chazb
Level 3
Level 3
Posts: 166
Joined: Wed Nov 30, 2016 2:56 am
Location: Oklahoma

Re: Using the Terminal to Backup Home Dir.

Post by chazb » Sun Jun 24, 2018 12:01 am

catweazel wrote:
Sat Jun 23, 2018 4:06 am

What I don't understand is, given you're struggling with command line syntax and unix paths, why you want to backup using the command line when there are enough GUI applications out there that will do the job reasonably well. Next to flying to wherever you live and typing in the correctly modified command for you, I don't know what else to tell you.
Please forgive me for picking your brain, your are right there are lots of GUI ways to do this. Though I learned a long time ago that if I am going to use a Linux OS I best learn how to use the Terminal. But now I am starting to realize that I may be into something that is a little over my head, or at least beyond me for the moment and is not so cut and dried as, copy and paste this to do that. Thank You for your input, you have been a great help, and I have learned much from you, not only in this thread but others as well.

User avatar
catweazel
Level 16
Level 16
Posts: 6977
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Using the Terminal to Backup Home Dir.

Post by catweazel » Sun Jun 24, 2018 1:37 am

chazb wrote:
Sun Jun 24, 2018 12:01 am
Thank You for your input, you have been a great help, and I have learned much from you, not only in this thread but others as well.
You're most welcome.
Caution: Dancing Wu Li Master and Official curmudgeon-in-chief

User avatar
chazb
Level 3
Level 3
Posts: 166
Joined: Wed Nov 30, 2016 2:56 am
Location: Oklahoma

Re: Using the Terminal to Backup Home Dir.

Post by chazb » Mon Jun 25, 2018 2:43 am

catweazel wrote:
Sun Jun 24, 2018 1:37 am
chazb wrote:
Sun Jun 24, 2018 12:01 am
Thank You for your input, you have been a great help, and I have learned much from you, not only in this thread but others as well.
You're most welcome.
In the name of simplicity the thought occurred to me, forget this whole backup business, and just copy the Home folder to my usb stick, and then after I have installed LM 18.3, copy it back to 18.3's Home folder? But first deleting 18.3's Firefox.

User avatar
catweazel
Level 16
Level 16
Posts: 6977
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Using the Terminal to Backup Home Dir.

Post by catweazel » Mon Jun 25, 2018 3:03 am

chazb wrote:
Mon Jun 25, 2018 2:43 am
In the name of simplicity the thought occurred to me, forget this whole backup business, and just copy the Home folder to my usb stick, and then after I have installed LM 18.3, copy it back to 18.3's Home folder? But first deleting 18.3's Firefox.
Just make sure you show hidden files before you do the copy, assuming you want to retain your settings.
Caution: Dancing Wu Li Master and Official curmudgeon-in-chief

User avatar
chazb
Level 3
Level 3
Posts: 166
Joined: Wed Nov 30, 2016 2:56 am
Location: Oklahoma

Re: Using the Terminal to Backup Home Dir.

Post by chazb » Mon Jun 25, 2018 4:33 pm

catweazel wrote:
Mon Jun 25, 2018 3:03 am
Just make sure you show hidden files before you do the copy, assuming you want to retain your settings.
I unhide all hidden files as a matter of course with in a day or to of installing any OS. In AA they say "Keep it simple, stupid", and that is what I am going to do.

Again Thank You.

Post Reply

Return to “Newbie Questions”