Using the Terminal to Backup Home Dir.

Quick to answer questions about finding your way around Linux Mint as a new user.
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. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
chazb
Level 5
Level 5
Posts: 713
Joined: Wed Nov 30, 2016 2:56 am
Location: Oklahoma

Using the Terminal to Backup Home Dir.

Post by chazb »

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?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Sir Charles

Re: Using the Terminal to Backup Home Dir.

Post by Sir Charles »

Mute Ant

Re: Using the Terminal to Backup Home Dir.

Post by Mute Ant »

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.
User avatar
chazb
Level 5
Level 5
Posts: 713
Joined: Wed Nov 30, 2016 2:56 am
Location: Oklahoma

Re: Using the Terminal to Backup Home Dir.

Post by chazb »

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
chrisuk

Re: Using the Terminal to Backup Home Dir.

Post by chrisuk »

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
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Using the Terminal to Backup Home Dir.

Post by catweazel »

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...
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
Mute Ant

Re: Using the Terminal to Backup Home Dir.

Post by Mute Ant »

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.
User avatar
chazb
Level 5
Level 5
Posts: 713
Joined: Wed Nov 30, 2016 2:56 am
Location: Oklahoma

Re: Using the Terminal to Backup Home Dir.

Post by chazb »

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 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Using the Terminal to Backup Home Dir.

Post by catweazel »

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.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
User avatar
chazb
Level 5
Level 5
Posts: 713
Joined: Wed Nov 30, 2016 2:56 am
Location: Oklahoma

Re: Using the Terminal to Backup Home Dir.

Post by chazb »

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 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Using the Terminal to Backup Home Dir.

Post by catweazel »

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.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
User avatar
chazb
Level 5
Level 5
Posts: 713
Joined: Wed Nov 30, 2016 2:56 am
Location: Oklahoma

Re: Using the Terminal to Backup Home Dir.

Post by chazb »

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 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Using the Terminal to Backup Home Dir.

Post by catweazel »

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.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
Sir Charles

Re: Using the Terminal to Backup Home Dir.

Post by Sir Charles »

@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 :?
User avatar
Boca
Level 5
Level 5
Posts: 691
Joined: Sun Feb 15, 2015 5:02 am

Re: Using the Terminal to Backup Home Dir.

Post by Boca »

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 5
Level 5
Posts: 713
Joined: Wed Nov 30, 2016 2:56 am
Location: Oklahoma

Re: Using the Terminal to Backup Home Dir.

Post by chazb »

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 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Using the Terminal to Backup Home Dir.

Post by catweazel »

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.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
User avatar
chazb
Level 5
Level 5
Posts: 713
Joined: Wed Nov 30, 2016 2:56 am
Location: Oklahoma

Re: Using the Terminal to Backup Home Dir.

Post by chazb »

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 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Using the Terminal to Backup Home Dir.

Post by catweazel »

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.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
User avatar
chazb
Level 5
Level 5
Posts: 713
Joined: Wed Nov 30, 2016 2:56 am
Location: Oklahoma

Re: Using the Terminal to Backup Home Dir.

Post by chazb »

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.
Locked

Return to “Beginner Questions”