Hey guys and welcome back.
So the last tool that I want to show you for the purposes of our backup operations that
we have to know for the LPIC2 examination is the DD command.
Now the whole purpose of the DD command is really to copy and convert files as we see
right here.
Now this is very good for copying entire disks or partitions.
So if you want to happen to maybe make a backup of a particular partition or a particular
disk using the DD command is going to be a very good way to implement that solution.
So let me quickly show you an example of doing such a thing.
So what I'll do is I'll press Q.
Okay, so if I do an LSBLK-F, now what I can see here are my block devices and one of
these devices is SDB1, which I happen to use as a RAID member from a previous skill within
this course.
But it doesn't actually matter what the block device happens to be.
Let's just say we wanted to copy the contents of this block device and back it up.
We can do this using DD.
So if I say sudo dd and I'll say if for the input file and I'll just specify devsdb1,
this is what I want to copy.
And then I'll say of for the output file ie, where do I want to copy it to?
So I'll just say home IPv0 and I'll just call this file that I'm going to make a copy of.
Now I can choose anything I wish, but I'll just say sdb1.ing to be nice and descriptive.
And then I'll say my byte size.
And the default value is 512.
I'll make this a little bit bigger to speed up the process.
I will say 8 meg.
And I'll then say conf no error sync so that DD will ignore any errors if it happens to
encounter them and continue on.
So if I just hit enter now and type in my password, we can see here we've actually copied the
entire contents of this particular disk.
512 meg ie half a gig has been copied and we now have a bit by bit copy of this particular
disk.
And if we do an LS, we can see that copy is right here.
Now as it transpires with respect to our input and our output, what I could do is I could
copy directly from one disk and copy that to another disk, let's just maybe say we had
sdc1, say for example.
What this would ultimately do, it would create pretty much a carbon copy of whatever is on
sdb1 and copy it directly onto the output file ie this disk right here.
So if I happen to lose this disk, say for example it was destroyed, the content would
still be available here within this particular file and I could use this file.
So dd, I'll just say my input file happens to be home ipv0 and I'll use my sdb1 image
and then I'll specify the output file, where do I actually want to copy it to and again
I could copy this to anything I absolutely wish sdc1, whatever it may be, if that was
a new fresh disk.
But for now I'll just create another backup image, I'll call this sdb1 second copy dot
img, gain, 8 meg and we will ignore any errors.
If I hit enter, what we've done is create yet another backup copy of this image here,
which is ultimately a copy of the content of this disk.
So if you happen to have particular block devices, partitions, if you want to be able
to create copies for backups, as we can see here the dd utility is going to allow you
to do this no problem at all and you can ultimately copy from disks to create images, you can
then use that image to copy directly back onto brand new disks, whatever it is you may
choose the dd utility is going to help you out.
Ok dogs so that is us for backing up our block devices, I hope this has been informative
for you and I'd like to thank you for viewing.