Tutorial Deepin How to Clone Backup System and Restore
Tofloor
poster avatar
asinoro
deepin
2016-02-05 01:55
Author
Edited by asinoro at 2016-2-4 18:43

                        
Tutorial Deepin How to  Clone Backup System and Restore

There are times when updates or upgrades do not proceed correct causing issues to our system and to us time and energy. Thanks to this tutorial you can do your updates and upgrades without any worries


Clone system backup is the perfect way to store and restore your operating system without to loose data and applications that it took you so long time and effort to achieve. This is very practical before you are going to upgrade or update the system. Additionally very fast you can  restore your operating system and bring back exactly how it was .You can store your operating system on another partition, hard drive or preferably to external medium. The best way is to store it at  img.gz  format to avoid luck of space and size.
For example my operating system installed on 20 gigabyte size partition, it can be stored as an image.gz format to a file taking 8 gigabyte size,  at time approximately 24 minutes. To restore  my laptop with dual core processor it takes about 15 minutes. Time is always according the pc and the store medium speed abilities.

We do the backup by using the command dd and format img.gzip.

Attention: When you perform the backup don’t do other jobs(better for the backup), or running many applications, because it consumes  more cpu and memory.


Step1

The following command you will modify according to your settings, and it would be good to save in LibreOffice Culc also for future use.
  1. dd if=/dev/sda9 bs=4096 conv=notrunc,noerror | gzip> /media/LAPTOPSTORE/Lenovo5030/Deepin-15.1.img.gz
Copy the Code

Pay attention the command after the  /media/ not to have empty space otherwise will not work

Modify the following:
1) Instead sda9 which is my own partition of my operating system, the corresponding yours. You can find yours by
  1. sudo blkid
Copy the Code
or opening the gparted.
3) Made the destination backup folder on a different sector (partition)of the hard drive or an external storage. After making that folder right click that folder copy and paste to replace part of my own example, where the folder is Lenovo5030 [/media /LAPTOPSTORE/Lenovo5030],with the corresponding yours.
After you add the name of the image that you want to give[xxxxxxx.img.gz]at the example is Deepin-15.1.img.gz. So your command will look like this.

dd if=/dev/sda9 bs=4096 conv=notrunc,noerror | gzip> /media/xxxxxx/xxxxxxx/xxxxxxx.img.gz

Ifit is ready your command now copy and paste into the Terminal.

Step2

Open the Terminal and give the command to be as a root user:

  1. sudo su
Copy the Code

Now you can copy and paste the modify command at the terminal and by pressing the enter button will start the backup.You will not see anything but a stripe that flash /. When is complete you will see at the terminal the in and out.

Though if you like to see the procedure during the operation open another terminal give the following command to see the procedure from the first terminal.

  1. watch -n5 'sudo kill -USR1 $ (pgrep ^ dd)'
Copy the Code

When is ready the backup go to the store folder and change the name to Deepin-15.1-1.img.gz, Where you can see very fast that it is the first backup image and you don’t need to modify again the original backup command at the LibreOffice Calc.

Step3

Restore always has to be outside the operating system from Live CD, USB or other Linux operating system. Live CD, USB you can use from any Linux Distro.

To restore the backup image modify the following command:
  1. gzip -dc /media/xxxxxxxx/xxxxxxxx/ Deepin-15.1-1.img.gz | dd of =/dev/sdax bs=4096 conv=notrunc,noerror
Copy the Code

First copy the saved image with your right mouse button and paste to replace[/media/xxxxxxxx/xxxxxxxx/Deepin-15.1-1.img.gz]in LibreOffice Culc. Your command will be then ready with the right form of the stored image. Change also the /dev/sdax where the ax the partition of your operating system.

Attention: dd command is very powerful, it will delete everything at the target partition, so be careful you give the correct  partition in the command /dev/sdax.

Open the Terminal and give the command to be as a root user:

  1. sudo su
Copy the Code

and then paste  your modify command and enter:

  1. gzip -dc /media/xxxxxxxx/xxxxxxxx/ Deepin-15.1-1.img.gz | dd of =/dev/sdax bs=4096 conv=notrunc,noerror
Copy the Code

The procedure will be the same as in step 2.

When is finished your system will be back as you had store.

I hope you enjoy and find helpful this tutorial.

Asinoro

Reply Favorite View the author
All Replies
dance707
deepin
2016-02-05 02:24
#1
Very interesting Tutorial
Reply View the author
asinoro
deepin
2016-02-05 04:08
#2
Edited by asinoro at 2016-2-4 20:15
https://bbs.deepin.org/post/30690
Very interesting Tutorial

This tutorial have saved me several times in the past from many problems and as I am a person that try new things still it does. For example after upgrade from 15 to 15.1 I had some issues, by going back and doing again the upgrade now this issues are gone. I will wait a little before I correct them at the user feedback.
Reply View the author
dance707
deepin
2016-02-05 22:34
#3
https://bbs.deepin.org/post/30690
This tutorial have saved me several times in the past from many problems and as I am a person that  ...

Personally I like Clonezilla , has many advanced features like check file system before saving or restoring and network solutions. Always nice to review the good command line methods.
Reply View the author
tristar
deepin
2016-02-05 23:40
#4
I have 120GB SDD and I do this, to backup:

1) boot to live usb (any live is ok)
2) open terminal
3) mount /dev/sdb1 /mnt (i mount my drive partition where i want my backup)
4) sudo cp /dev/sdc /mnt/deepin.iso (i copy device /dev/sdc to deepin.iso)

i have my system with all settings on it

and restore

1) boot to live usb
2) mount /dev/sdb1 /mnt
3) sudo cp /mnt/deepin.iso /dev/sdc

that's all

Reply View the author
tristar
deepin
2016-02-05 23:47
#5
for live server backup, I do this:

tar -cpzf /backup/sistem.tar.gz / --exclude="/dev/*" --exclude="/proc/*" --exclude="/sys/*" --exclude="/tmp/*" --exclude="/run/*" --exclude="/mnt/*" --exclude="/media/*" --exclude="/backup/*" --exclude="/boot/*" --exclude="/etc/fstab" --exclude="lost+found"

with that I have full backup of system without some not needed system maps, to restore I do just this:

1) boot to live cd
2) mount /dev/sdb1 /mnt (where i have archive)
3) mkdir sistem
4) mount /dev/sdc sistem (whre i want restore)
5) tar -xvpzf /mnt/sistem.tar.gz -C sistem --numeric-owner

in short ;)
Reply View the author
asinoro
deepin
2016-02-06 08:26
#6
Every tutorial that help the user is welcome. The backup I show can be done from the system and in the future I will modify for automatic backup.
Reply View the author
dance707
deepin
2016-02-07 01:26
#7
Over the years I have found its best to Clone the root partition and backup the Home partition.
Reply View the author
asinoro
deepin
2016-02-07 01:55
#8
https://bbs.deepin.org/post/30690
Over the years I have found its best to Clone the root partition and backup the Home partition.

I also thought about this but there is one problem if configuration files are damaged, for example Firefox extensions and so on, there is a very big trouble to find and solve them. What I have doen because I have many OS on my laptop, I have a very big partition with the music and other files and I use it as a common store for downloads etc for all the operating systems. The more compact are things more easily to handle them.
Reply View the author
dance707
deepin
2016-02-07 02:17
#9
https://bbs.deepin.org/post/30690
I also thought about this but there is one problem if configuration files are damaged, for example ...

Yes that is true as well as some other configuration files I normally after first install clone home just one time just in case the home partition gets too messed up.Then I do regular Clone of the root.
Reply View the author
zisco
deepin
2016-03-28 02:08
#10
Edited by zisco at 2016-3-27 18:11

Hi to all,
I would make a backup of my deepin 15.1.1, but after giving the command as in the guide I have these errors:http://imgur.com/uCfgcZS

Now I know that my actually HD is not very fit, but I had installed deepin on this hard drive to be able to try this before use it permanently on the good HD.
Now I have my deepin perfectly configured and I do not want to install it from the beginning, there is a way to make a copy and then put it on the good HD?
thanks very much

Reply View the author
dance707
deepin
2016-03-28 03:17
#11
https://bbs.deepin.org/post/30690
Hi to all,
I would make a backup of my deepin 15.1.1, but after giving the command as in the guide I ...

Hi, As mentioned above I like Clonezilla as it has a lot of advanced features and will do what you want provided your good hard drive is the same size are larger. Command line methods can work also but they are more for advanced Linux users.
I would recommend doing a fresh install to your good hard drive. As you mentioned the original hard drive not very fit , and the time learning and using these clone methods can be just as time consuming as a fresh install that is more likely to work better.
Reply View the author
zisco
deepin
2016-03-28 12:11
#12
Hi dance707, I have used Clonezilla, now backup is done.... but I can't it restored because: Target partition size (25Gb) is smaller than source (35Gb). Use option -C to disable size checking.But I am not able to use this command ' -C ' I do not know where it is.....
The partition of my deepin15.1.1 is 35Gb but I use only 8,5Gb and the Backup file is only 3,5Gb, the target partition in the good HD is 25Gb, enough for deepin but the checking size stop everything....
can you help me?
Thanks


Reply View the author
dance707
deepin
2016-03-28 15:23
#13
https://bbs.deepin.org/post/30690
Hi dance707, I have used Clonezilla, now backup is done.... but I can't it restored because: Target  ...

Hi, As I mentioned earlier your good hard drive needs to be same size or larger and that I would recommend doing a fresh install of Deepin instead of clone.
I have not used the -C option my self but from what I read it must be passed to the partclone program. If the information I read is still current the bash script should be named ocs-sr and line 490 should read like the first line and add -C so the line reads like the following line, then save exit to gui and run wizard again
PARTCLONE_RESTORE_OPT="$PARTCLONE_RESTORE_OPT_INIT -N"
PARTCLONE_RESTORE_OPT="$PARTCLONE_RESTORE_OPT_INIT -C -N"
Reply View the author
zisco
deepin
2016-03-28 23:29
#14
Edited by zisco at 2016-3-28 15:31

Dance sorry but I have not understood where I schould change the option...
Reply View the author
dance707
deepin
2016-03-29 00:32
#15
https://bbs.deepin.org/post/30690
Dance sorry but I have not understood where I schould change the option...

Hi Zisco ,The home page of the project list the limitations and one of them are. The destination partition must be equal or larger than the source one. The -C option refers to a way to modify a line in the bash script of the partclone program for advanced users that know how to find and modify bash scripts. I have used this good software for years and never needed that option, maybe you can find more detailed information on this non standard option from them or the internet.
Reply View the author
mi******28@kaimdr.com
deepin
2022-10-23 02:06
#16
The user is banned, and the content is hidden.
ol******99@gmail.com
deepin
2022-10-25 20:09
#17
The user is banned, and the content is hidden.
sa******64@ilusale.com
deepin
2022-10-28 22:26
#18
The user is banned, and the content is hidden.
sa******64@ilusale.com
deepin
2022-10-31 02:43
#19
The user is banned, and the content is hidden.