1
00:00:00,000 --> 00:00:14,359
Hey guys and welcome back.

2
00:00:14,359 --> 00:00:19,400
So the last tool that I want to show you for the purposes of our backup operations that

3
00:00:19,400 --> 00:00:24,839
we have to know for the LPIC2 examination is the DD command.

4
00:00:24,839 --> 00:00:30,719
Now the whole purpose of the DD command is really to copy and convert files as we see

5
00:00:30,719 --> 00:00:31,719
right here.

6
00:00:31,719 --> 00:00:36,640
Now this is very good for copying entire disks or partitions.

7
00:00:36,640 --> 00:00:41,879
So if you want to happen to maybe make a backup of a particular partition or a particular

8
00:00:41,879 --> 00:00:48,960
disk using the DD command is going to be a very good way to implement that solution.

9
00:00:48,960 --> 00:00:52,280
So let me quickly show you an example of doing such a thing.

10
00:00:52,280 --> 00:00:53,960
So what I'll do is I'll press Q.

11
00:00:53,960 --> 00:01:00,280
Okay, so if I do an LSBLK-F, now what I can see here are my block devices and one of

12
00:01:00,280 --> 00:01:07,040
these devices is SDB1, which I happen to use as a RAID member from a previous skill within

13
00:01:07,040 --> 00:01:08,040
this course.

14
00:01:08,040 --> 00:01:11,719
But it doesn't actually matter what the block device happens to be.

15
00:01:11,719 --> 00:01:16,760
Let's just say we wanted to copy the contents of this block device and back it up.

16
00:01:16,760 --> 00:01:18,680
We can do this using DD.

17
00:01:18,680 --> 00:01:27,400
So if I say sudo dd and I'll say if for the input file and I'll just specify devsdb1,

18
00:01:27,400 --> 00:01:29,360
this is what I want to copy.

19
00:01:29,360 --> 00:01:34,320
And then I'll say of for the output file ie, where do I want to copy it to?

20
00:01:34,320 --> 00:01:39,840
So I'll just say home IPv0 and I'll just call this file that I'm going to make a copy of.

21
00:01:39,840 --> 00:01:46,760
Now I can choose anything I wish, but I'll just say sdb1.ing to be nice and descriptive.

22
00:01:46,760 --> 00:01:48,400
And then I'll say my byte size.

23
00:01:48,400 --> 00:01:51,080
And the default value is 512.

24
00:01:51,080 --> 00:01:53,640
I'll make this a little bit bigger to speed up the process.

25
00:01:53,640 --> 00:01:55,160
I will say 8 meg.

26
00:01:55,160 --> 00:02:02,000
And I'll then say conf no error sync so that DD will ignore any errors if it happens to

27
00:02:02,000 --> 00:02:04,080
encounter them and continue on.

28
00:02:04,080 --> 00:02:10,599
So if I just hit enter now and type in my password, we can see here we've actually copied the

29
00:02:10,599 --> 00:02:14,840
entire contents of this particular disk.

30
00:02:14,840 --> 00:02:23,159
512 meg ie half a gig has been copied and we now have a bit by bit copy of this particular

31
00:02:23,159 --> 00:02:24,159
disk.

32
00:02:24,159 --> 00:02:28,360
And if we do an LS, we can see that copy is right here.

33
00:02:28,360 --> 00:02:34,280
Now as it transpires with respect to our input and our output, what I could do is I could

34
00:02:34,280 --> 00:02:39,159
copy directly from one disk and copy that to another disk, let's just maybe say we had

35
00:02:39,159 --> 00:02:41,840
sdc1, say for example.

36
00:02:41,840 --> 00:02:47,280
What this would ultimately do, it would create pretty much a carbon copy of whatever is on

37
00:02:47,280 --> 00:02:54,120
sdb1 and copy it directly onto the output file ie this disk right here.

38
00:02:54,120 --> 00:02:59,199
So if I happen to lose this disk, say for example it was destroyed, the content would

39
00:02:59,199 --> 00:03:04,560
still be available here within this particular file and I could use this file.

40
00:03:04,560 --> 00:03:12,360
So dd, I'll just say my input file happens to be home ipv0 and I'll use my sdb1 image

41
00:03:12,360 --> 00:03:16,879
and then I'll specify the output file, where do I actually want to copy it to and again

42
00:03:16,879 --> 00:03:22,439
I could copy this to anything I absolutely wish sdc1, whatever it may be, if that was

43
00:03:22,439 --> 00:03:23,920
a new fresh disk.

44
00:03:23,920 --> 00:03:30,199
But for now I'll just create another backup image, I'll call this sdb1 second copy dot

45
00:03:30,199 --> 00:03:34,799
img, gain, 8 meg and we will ignore any errors.

46
00:03:34,799 --> 00:03:40,599
If I hit enter, what we've done is create yet another backup copy of this image here,

47
00:03:40,599 --> 00:03:44,479
which is ultimately a copy of the content of this disk.

48
00:03:44,479 --> 00:03:49,120
So if you happen to have particular block devices, partitions, if you want to be able

49
00:03:49,120 --> 00:03:54,039
to create copies for backups, as we can see here the dd utility is going to allow you

50
00:03:54,039 --> 00:04:00,680
to do this no problem at all and you can ultimately copy from disks to create images, you can

51
00:04:00,680 --> 00:04:05,199
then use that image to copy directly back onto brand new disks, whatever it is you may

52
00:04:05,199 --> 00:04:08,159
choose the dd utility is going to help you out.

53
00:04:08,159 --> 00:04:12,959
Ok dogs so that is us for backing up our block devices, I hope this has been informative

54
00:04:12,959 --> 00:04:15,120
for you and I'd like to thank you for viewing.

