Creating a backup with "dd if" please help!.

23 Antworten [Letzter Beitrag]
arcu
Offline
Beigetreten: 05/25/2015

Hi, I have been using Trisquel for several months and at this point I would like to back up my whole drive using the "dd if" command on a terminal.

My drive (sda) is a SSD containing a Masterboot record with GRUB, a 4GB Swap partition, 100GB ext4 system disk containing GNU Linux-Trisquel and 150GB NTFS Storage partition.

I got another 1TB storage Drive (sdb)

I ve tried this with small capacity USB sticks but it is the first time that I'm going to try it with my main drive wich contains MBR and several partitions, so would like to check some aspects to see If I got things clear. Thanks in advance to those who could say something back.

1- Creating an ISO file from my drive:

This does not requires unmounting the drive first so the only thing I should do is:

sudo dd if=/dev/sda of=/dev/sdb/mybackup.iso

and "mybackup.iso" will be created on my 1TB drive "sdb"

I'm going to run Trisquel from USB stick to perform this, so I suppose "sudo" at the beginning it is not required, am I right?.

Plus; Does anybody knows if this other arguments make any sense for this operation?:

"bs=", wich is used to set the blocksize and represents speed of clonation

"conv=notrunc, noerror", wich is used to maintain data integrity and to ignore possible errors on the physical drive.

Understand than this improves the accuracy of the operation as I ve been reading."bs" it is necessary when restoring from ISO to the drive, and "conv=notrunc, noerror" useful too on this case, but what I m going to do is not restoring but just creating an ISO from the drive.

So, that's my question: makes any sense adding any of the arguments above for creating an ISO from the drive?.or they are only useful when going on the opposite direction? (Restoring an empty drive with a previously created ISO ) I would not like to create a bad ISO which would make restoring the drive impossible.

just would like to check out if just typping this will be enough for this purpose.

dd if=/dev/sda of=/dev/sdb/mybackup.iso

There's a 250GB image to be created. I wonder how long will it take or if there's any command to check out what's going on, time remaining, blocks transfered or whatever. Told you so because the only thing that happens after running "dd" is a square on a white line on the Terminal, and then at some point it finishes giving a block transfering report and process completed confirmation.

Kind Regards!.

Magic Banana

I am a member!

I am a translator!

Offline
Beigetreten: 07/24/2010

Any reason you want to use 'dd'? Trisquel has an excellent backup utility (in "System settings"):

  • incremental backup (only backup what has not been backup-up yet);
  • compressed backup (faster and save space);
  • integrated with the file manager (you revert to any previous version of the file/folder in about three clicks);
  • periodic backup (or a notification if the external drive is not plugged);
  • the oldest versions of the files are automatically removed if space is missing;
  • very easy to use (choose where to backup and then use the graphical utility with two buttons: "backup" and "restore");
  • possible encryption;
  • ...
arcu
Offline
Beigetreten: 05/25/2015

Well didn't knew too much about this utility. I've been using Trisquel just for several months. Learning Linux by myself as much as I could. Will take a look at this. Thanks

arcu
Offline
Beigetreten: 05/25/2015

Hi, I have been using Trisquel for several months and at this point I would
like to back up my whole drive using the "dd if" command on a terminal.

My drive (sda) is a SSD containing a Masterboot record with GRUB, a 4GB Swap
partition, 100GB ext4 system disk containing GNU Linux-Trisquel and 150GB
NTFS Storage partition.

I got another 1TB storage Drive (sdb)

I ve tried this with small capacity USB sticks but it is the first time that
I'm going to try it with my main drive wich contains MBR and several
partitions, so would like to check some aspects to see If I got things clear.
Thanks in advance to those who could say something back.

1- Creating an ISO file from my drive:

This does not requires unmounting the drive first so the only thing I should
do is:

sudo dd if=/dev/sda of=/dev/sdb/mybackup.iso

and "mybackup.iso" will be created on my 1TB drive "sdb"

I'm going to run Trisquel from USB stick to perform this, so I suppose "sudo"
at the beginning it is not required, am I right?.

Plus; Does anybody knows if this other arguments make any sense for this
operation?:

"bs=", wich is used to set the blocksize and represents speed of clonation

"conv=notrunc, noerror", wich is used to maintain data integrity and to
ignore possible errors on the physical drive.

Understand than this improves the accuracy of the operation as I ve been
reading."bs" it is necessary when restoring from ISO to the drive, and
"conv=notrunc, noerror" useful too on this case, but what I m going to do is
not restoring but just creating an ISO from the drive.

So, that's my question: makes any sense adding any of the arguments above for
creating an ISO from the drive?.or they are only useful when going on the
opposite direction? (Restoring an empty drive with a previously created ISO )
I would not like to create a bad ISO which would make restoring the drive
impossible.

just would like to check out if just typping this will be enough for this
purpose.

dd if=/dev/sda of=/dev/sdb/mybackup.iso

There's a 250GB image to be created. I wonder how long will it take or if
there's any command to check out what's going on, time remaining, blocks
transfered or whatever. Told you so because the only thing that happens after
running "dd" is a square on a white line on the Terminal, and then at some
point it finishes giving a block transfering report and process completed
confirmation.

Kind Regards!.

arcu
Offline
Beigetreten: 05/25/2015

Well didn't knew too much about this utility. I've been using Trisquel just
for several months. Learning Linux by myself as much as I could. Will take a
look at this. Thanks

arcu
Offline
Beigetreten: 05/25/2015

I would like to check out something. Does this is similar to WET from windows, I mean backup will save all installed programs and O.S Configuration?. Thanks!.

Magic Banana

I am a member!

I am a translator!

Offline
Beigetreten: 07/24/2010

You can choose to backup any folder, including /etc that contains the system configuration. Just specify it in "Folders to save" in "Backups" in the "System settings".

I do not see much point to back up the system, only the list of packages you installed. See https://trisquel.info/fr/forum/recommendations-backups-cloning-redistribution#comment-74118

That said, if you tell Déjà-Dup to backup the root folder, I guess it will.

lembas
Offline
Beigetreten: 05/13/2010

For monitoring dd, see the pv package.

arcu
Offline
Beigetreten: 05/25/2015

got it!. Thanks a millioooon!. So suposing pv package is already installed this should allow me to monitor the image creation.

Loading Trisquel from live CD or USB stick: ( so I m not working on the drive I want to copy ).

Generic example: where sda is an SSD I want to clone ( including MBR and all partitions ) and sdb is 1TB NTFS Internal Storage Drive. ( I got a desktop computer, not laptop ).

sudo dd if=/dev/sda bs=256k conv=noerror | pv | of=/dev/sdb/mybackup.iso

arcu
Offline
Beigetreten: 05/25/2015

got it!. Thanks a millioooon!. So suposing pv package is already installed
this should allow me to monitor the image creation.

Loading Trisquel from live CD or USB stick: ( so I m not working on the drive
I want to copy ).

Generic example: where sda is an SSD I want to clone ( including MBR and all
partitions ) and sdb is 1TB NTFS Internal Storage Drive. ( I got a desktop
computer, not laptop ).

sudo dd if=/dev/sda | pv | of=/dev/sdb/mybackup.iso bs=256k conv=noerror

Triqel
Offline
Beigetreten: 12/06/2014

Why do not you use Clonezilla? It's the free and open source software for partition and disk imaging/cloning. It helps you to do system deployment, bare metal backup and recovery. Clonezilla is licensed under the GPLv2.

http://clonezilla.org/

arcu
Offline
Beigetreten: 05/25/2015

It is a great tool too!. I knew about it!.

arcu
Offline
Beigetreten: 05/25/2015

It is a great tool too!. I knew about it!.

arcu
Offline
Beigetreten: 05/25/2015

Loading Trisquel from live CD or USB stick: ( so I m not working on the drive I want to copy ).

Generic example: where sda is an SSD I want to clone ( including MBR and all partitions ) and sdb is 1TB NTFS Internal Storage Drive. ( I got a desktop computer, not laptop ). it is just generic example, I m not gonna writte down this on the terminal just because someone tells me: ey guy this is ok, just proceed. I'm just trying to learn and understand this thing of the dd. Plus, I got "Boxes" installed for trying these kind of things on virtual machines first.:)

Working on the direction "Generating ISO from a Physical Drive" I ve seen that bss and conv arguments must be written after the location of the input file and not at the end of the line as I thought, that's what was really confusing me, so thanks to everybody for their answers.

sudo dd if=/dev/sda bs=256k conv=noerror | pv | of=/dev/sdb/mybackup.iso

So yes, the output file will be on a different disk from which I m copying...
and I will add this "pv" thing for monitoring operation. Definetly, confusing if and of would be a complete mess. Anyway I m gonna take a look as well to backup utility. Best Regards!.

lembas
Offline
Beigetreten: 05/13/2010

You forgot the second dd from that command.

This would probably be best.

pv bigfile.iso [pv options go here] | dd of=/dev/targetdevice [dd options go here]

(Be careful with dd, some people say dd is short for disk destroyer...)

arcu
Offline
Beigetreten: 05/25/2015

Ok. so it will be:

sudo dd if=/dev/sda bs=256k conv=noerror | pv | dd of=/dev/sdb/mybackup.iso

And I see a command for restoring ISO to a target drive:

So writting the command in the way you do typping "dd if=" before "bigfile.iso" is not required. Is that right?.

pv bigfile.iso | dd of=/dev/targetdevice

just like this?.

By the way I m just on creating the ISO. THANKS for this!. Really I knew about it. Thanks for this advice.

lembas
Offline
Beigetreten: 05/13/2010

Yeah. You're welcome.

lembas
Offline
Beigetreten: 05/13/2010

Yeah. You're welcome.

arcu
Offline
Beigetreten: 05/25/2015

it seems a command for restoring from ISO to a drive as I see that of=
(output file ) is the target device.

So writting the command in the way you do typping "dd if=" before
"bigfile.iso" is not required. Is that right?.

By the way I m just on creating the ISO. THANKS for this!. Really I knew
about it. Thanks for this advice.

lembas
Offline
Beigetreten: 05/13/2010

You forgot the second dd from that command.

This would probably be best.

pv bigfile.iso | dd of=/dev/targetdevice options go here optionally

Magic Banana

I am a member!

I am a translator!

Offline
Beigetreten: 07/24/2010

Any reason you want to use 'dd'? Trisquel has an excellent backup utility (in
"System settings"):

incremental backup (only backup what has not been backup-up yet)
compressed backup (faster and save space)
integrated with the file manager (you revert to any previous version of the
file/folder in about three clicks)
periodic backup (or a notification if the external drive is not plugged)
very easy to use (choose where to backup and then use the graphical utility
with two buttons: "backup" and "restore"
possible encryption
...

lembas
Offline
Beigetreten: 05/13/2010

For monitoring dd, see the pv package.

Triqel
Offline
Beigetreten: 12/06/2014

Why do not you use Clonezilla? It's the free and open source software for
partition and disk imaging/cloning. It helps you to do system deployment,
bare metal backup and recovery. Clonezilla is licensed under the GPLv2.

http://clonezilla.org/

arcu
Offline
Beigetreten: 05/25/2015

Loading Trisquel from live CD or USB stick: ( so I m not working on the drive
I want to copy ).

Generic example: where sda is an SSD I want to clone ( including MBR and all
partitions ) and sdb is 1TB NTFS Internal Storage Drive. ( I got a desktop
computer, not laptop ).

Working on the direction "Generating ISO from a Physical Drive" I ve seen
that bss and conv arguments must be written after the location of the input
file and not at the end of the line as I thought, that's what was really
confusing me, so thanks to everybody for their answers.

sudo dd if=/dev/sda bs=256k conv=noerror | pv | of=/dev/sdb/mybackup.iso

So yes, the output file will be on a different disk from which I m copying...
and I will add this "pv" thing for monitoring operation. Anyway I m gonna
take a look as well to backup utility. Best Regards!.