WEBVTT

1
00:00.000 --> 00:04.400
So friends, let's begin this subject by discussing the whole concept of

2
00:04.400 --> 00:05.400
partitions.

3
00:05.400 --> 00:09.300
What are they actually used for? Why do we even need them in the first place?

4
00:09.300 --> 00:13.500
But really, when we're thinking about why we need a partition, primarily,

5
00:13.500 --> 00:16.200
it's going to allow us to organize our data.

6
00:16.200 --> 00:20.500
And the way this actually happens is via segmentation on the physical disk.

7
00:20.500 --> 00:23.800
So let's maybe say we happen to have a disk right here.

8
00:23.800 --> 00:26.200
This could just be a regular hard drive.

9
00:26.200 --> 00:30.940
Now suppose this is just one large disk that happens to be completely unpart
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

9
00:26.200 --> 00:30.940
Now suppose this is just one large disk that happens to be completely unpart

10
00:30.940 --> 00:31.700
itioned.

11
00:31.700 --> 00:34.400
So what do we actually have on this disk?

12
00:34.400 --> 00:37.800
What we're going to have, let's maybe say our operating system, the OS.

13
00:37.800 --> 00:41.700
And let's also say we happen to have some data on the disk.

14
00:41.700 --> 00:45.300
So that could be just your regular files, perhaps maybe some pictures, maybe

15
00:45.300 --> 00:46.300
some MP3s,

16
00:46.300 --> 00:47.300
that type of thing.

17
00:47.300 --> 00:51.000
Now as it transpires right here, because we have no separation between the

18
00:51.000 --> 00:52.100
actual operating system

19
00:52.100 --> 00:56.820
and the data, as we begin to write more and more data on the disk, things as

20
00:56.820 --> 00:57.800
you can see here,

21
00:57.800 --> 01:00.200
gradually become more and more cluttered.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

21
00:57.800 --> 01:00.200
gradually become more and more cluttered.

22
01:00.200 --> 01:03.800
And eventually as the disk gets filled up with more and more data,

23
01:03.800 --> 01:08.600
eventually the disk becomes to become overrun and it effectively bogs it down.

24
01:08.600 --> 01:12.320
Now the good news is, is that we do not actually have to contend with this in

25
01:12.320 --> 01:13.100
the real world.

26
01:13.100 --> 01:15.400
We don't really operate in such a way.

27
01:15.400 --> 01:16.600
So what does it we do?

28
01:16.600 --> 01:17.400
Well, you guessed it.

29
01:17.400 --> 01:19.400
We make use of partitions.

30
01:19.400 --> 01:24.350
Let's then reimagine the same type of scenario this time using the concept of

31
01:24.350 --> 01:25.400
partitions.

32
01:25.400 --> 01:29.200
So let's draw out our circle right here representing our hard disk.

33
01:29.200 --> 01:33.820
And just like you would with a pizza, let's say we wanted to slice this up and
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

33
01:29.200 --> 01:33.820
And just like you would with a pizza, let's say we wanted to slice this up and

34
01:33.820 --> 01:35.100
subdivide it.

35
01:35.100 --> 01:38.500
In this case here, the way we are subdividing it is via the use of the

36
01:38.500 --> 01:40.000
partitions themselves.

37
01:40.000 --> 01:41.700
So let's just take this chunk right here.

38
01:41.700 --> 01:45.900
Let's imagine we have a quarter of the disk and we say, hey, on that particular

39
01:45.900 --> 01:46.500
partition,

40
01:46.500 --> 01:49.300
all we want to have is the operating system itself.

41
01:49.300 --> 01:52.000
It's going to have its own little segmentation.

42
01:52.000 --> 01:55.600
And let's maybe say for the rest of the disk, we're just going to use it to

43
01:55.600 --> 01:56.200
store data.

44
01:56.200 --> 01:59.840
Now perhaps in the real world, maybe you would like to subdivide the disk into

45
01:59.840 --> 02:00.900
many more slices.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

45
01:59.840 --> 02:00.900
many more slices.

46
02:00.900 --> 02:04.880
Maybe we've got a slice here and another slice here and perhaps another chunk

47
02:04.880 --> 02:06.900
here and here, whatever it may be.

48
02:06.900 --> 02:10.500
But just for the illustration, let's just say we just have these two partitions

49
02:10.500 --> 02:10.500
,

50
02:10.500 --> 02:15.000
a partition dedicated for the operating system and another for the data.

51
02:15.000 --> 02:19.920
What the net effect is here is as we write more and more data onto the disk, as

52
02:19.920 --> 02:20.700
we saw before,

53
02:20.700 --> 02:25.500
you know, data here, data here, and it begins to fill all this partition up.

54
02:25.500 --> 02:29.600
The difference here is that we actually have this type of physical boundary as

55
02:29.600 --> 02:31.700
set out by the partition itself.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

55
02:29.600 --> 02:31.700
set out by the partition itself.

56
02:31.700 --> 02:35.880
So we're never, ever, ever going to be writing data into this particular

57
02:35.880 --> 02:36.900
section of the disk

58
02:36.900 --> 02:40.150
because it has been partitioned off and is used for something entirely

59
02:40.150 --> 02:40.900
different.

60
02:40.900 --> 02:44.900
This is the organization and segmentation that I was talking about.

61
02:44.900 --> 02:48.100
Now, of course, once again, if you want to get a little bit more creative and

62
02:48.100 --> 02:49.600
inventive with the partitions,

63
02:49.600 --> 02:52.100
you could have maybe a book partition.

64
02:52.100 --> 02:55.500
Maybe you want to have a partition that is designed for backups.

65
02:55.500 --> 02:59.600
And hey, maybe you just want to utilize partitioning for the security aspects

66
02:59.600 --> 03:01.200
of having that isolation
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

66
02:59.600 --> 03:01.200
of having that isolation

67
03:01.200 --> 03:04.400
so that sensitive data is kept separate from the rest of the system.

68
03:04.400 --> 03:07.550
So these are just some of the reasons why we would maybe want to utilize

69
03:07.550 --> 03:08.300
partitioning.

70
03:08.300 --> 03:11.950
Let's briefly discuss what different types of partitioning tables we can

71
03:11.950 --> 03:12.800
actually use.

72
03:12.800 --> 03:15.800
So depending on the type of firmware on the system,

73
03:15.800 --> 03:20.300
so if you happen to have an older system, which is utilizing the BIOS firmware,

74
03:20.300 --> 03:24.320
the type of partitioning table that you would want to be using would be

75
03:24.320 --> 03:26.100
something known as the MBR.

76
03:26.100 --> 03:27.700
This is the master boot record.

77
03:27.700 --> 03:32.150
Now, the master boot record style of partitioning is a lot more limited than
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

77
03:27.700 --> 03:32.150
Now, the master boot record style of partitioning is a lot more limited than

78
03:32.150 --> 03:33.400
the more modern version

79
03:33.400 --> 03:37.700
in the sense that we only have support for four partitions.

80
03:38.500 --> 03:42.120
Or more accurately, should I say, we have the option for four primary

81
03:42.120 --> 03:43.200
partitions.

82
03:43.200 --> 03:46.980
Now, when I'm talking about a primary partition, I'm talking about the type of

83
03:46.980 --> 03:47.600
partition

84
03:47.600 --> 03:50.600
that is capable of booting an operating system.

85
03:50.600 --> 03:55.200
Now, if you happen to recall from your red hat, certified system admin studies,

86
03:55.200 --> 03:59.330
you can kind of get around this limitation by creating three primary partitions

87
03:59.330 --> 03:59.600
.

88
03:59.600 --> 04:04.500
And then you can add in what is known as one logical extended partition.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

88
03:59.600 --> 04:04.500
And then you can add in what is known as one logical extended partition.

89
04:04.500 --> 04:08.700
Now, this particular partition here can actually be further subdivided into

90
04:08.700 --> 04:10.800
many more volumes,

91
04:10.800 --> 04:14.200
which pretty much allows you to have many more little storage containers,

92
04:14.200 --> 04:18.680
so to speak, whereas on modern systems, if you happen to be utilizing the UEFI

93
04:18.680 --> 04:19.600
firmware,

94
04:19.600 --> 04:22.400
which is much, much more common as we see nowadays,

95
04:22.400 --> 04:26.700
we have the ability for the support of a GPT style partitioning,

96
04:26.700 --> 04:31.710
which is much more advanced, much more expressive and has support for 128
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

96
04:26.700 --> 04:31.710
which is much more advanced, much more expressive and has support for 128

97
04:31.710 --> 04:32.900
partitions,

98
04:32.900 --> 04:36.500
much, much better than the four partitions offered by MBR.

99
04:36.500 --> 04:40.000
So these are the types of partitioning tables we can actually create.

100
04:40.000 --> 04:43.420
The question, therefore, is how do we actually create these particular

101
04:43.420 --> 04:44.200
partitions?

102
04:44.200 --> 04:47.960
Well, as is so often the case in Linux, we have many different utilities to do

103
04:47.960 --> 04:48.900
similar jobs.

104
04:48.900 --> 04:52.800
We can utilize something known as F-disc, which was originally developed just

105
04:52.800 --> 04:55.000
to create MBR style partitions.

106
04:55.000 --> 04:59.090
And then we had tools such as G-disc come out, which supported GPT style

107
04:59.090 --> 04:59.900
partitioning,

108
04:59.900 --> 05:04.500
as well as another utility known as Parted, which is the partition editor.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

108
04:59.900 --> 05:04.500
as well as another utility known as Parted, which is the partition editor.

109
05:04.500 --> 05:07.960
Now, in the case of Ansible, the partitioning tool that we're going to be

110
05:07.960 --> 05:09.500
focusing on is Parted.

111
05:09.500 --> 05:12.900
This one here is the one we're going to be using within our Playbooks.

112
05:12.900 --> 05:15.700
So in order to help us work with our lab environment,

113
05:15.700 --> 05:20.300
what we want to do is you want to add additional disks to our virtual machines.

114
05:20.300 --> 05:24.700
Now, you can add as many new disks as you want to as many virtual machines,

115
05:24.700 --> 05:29.300
but at least at a very minimum, add one disk to one of your machines.

116
05:29.300 --> 05:31.900
So let me show you how I can do this here on VM,
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

116
05:29.300 --> 05:31.900
So let me show you how I can do this here on VM,

117
05:31.900 --> 05:35.100
where if I go to one of my devices that are going to be managed by Ansible,

118
05:35.100 --> 05:39.900
which in my case here is my blue box, if I go to settings, and then I go down

119
05:39.900 --> 05:41.300
to hard disk,

120
05:41.300 --> 05:47.700
and I choose add device, and then I say new hard disk, and then select add.

121
05:47.700 --> 05:51.220
What it's going to prompt me to do is to specify the size of the disk that I

122
05:51.220 --> 05:52.200
want to create.

123
05:52.200 --> 05:56.520
Now, by default, as we can see here, it's going to create a disk of 20 gig and

124
05:56.520 --> 05:58.100
size that is way more than I need.

125
05:58.100 --> 06:00.900
So I'm just going to move it down to let's maybe just say one gig.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

125
05:58.100 --> 06:00.900
So I'm just going to move it down to let's maybe just say one gig.

126
06:00.900 --> 06:04.300
Okay. So with that now done, I'm going to choose apply.

127
06:04.300 --> 06:09.100
All I'm going to do here is press X, and then I will just start up my machine.

128
06:09.100 --> 06:13.100
So if I go to my terminal right here, and I just say the command man part it's,

129
06:13.100 --> 06:16.970
we can see the manual page for the utility that we want to be using a partition

130
06:16.970 --> 06:18.400
manipulation program.

131
06:18.400 --> 06:22.820
Now it says if we do dash L, we can actually list the partition layouts on all

132
06:22.820 --> 06:24.000
the block devices.

133
06:24.000 --> 06:24.700
So let's try that.

134
06:24.700 --> 06:29.900
Okay. So I will say pseudo parted dash L, and now I'll type in my super user

135
06:29.900 --> 06:30.900
password right here.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

135
06:29.900 --> 06:30.900
password right here.

136
06:30.900 --> 06:31.900
Now look at this right here.

137
06:31.900 --> 06:34.700
It tells us the summary of our disks right here.

138
06:34.700 --> 06:38.500
We have one particular disk here, which is going to be our book partition.

139
06:38.500 --> 06:42.700
This is the fat 32,000 system, and then we have this one here number three.

140
06:42.700 --> 06:45.300
This is LVM, our logical volume management.

141
06:45.300 --> 06:48.700
We'll talk about that in a little bit more detail within this very scale.

142
06:48.700 --> 06:55.140
The one that I just added was this one right here, you see that 174 meg, which

143
06:55.140 --> 06:55.800
is one gig.

144
06:55.800 --> 06:59.820
Now also an output here, we can actually see the contents, which is a device is

145
06:59.820 --> 07:02.700
in dev NVM E 0 N2.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

145
06:59.820 --> 07:02.700
in dev NVM E 0 N2.

146
07:02.700 --> 07:05.700
Now this is because I happen to be using a solid state drive,

147
07:05.700 --> 07:08.700
whereas if you happen to use a traditional hard disk,

148
07:08.700 --> 07:11.700
you might see the option as dev SDB.

149
07:11.700 --> 07:15.900
The name itself doesn't actually matter just as long as you know to reference

150
07:15.900 --> 07:16.900
the correct device,

151
07:16.900 --> 07:18.900
whatever the name happens to be.

152
07:18.900 --> 07:21.900
So now we have this unpartitioned physical disk.

153
07:21.900 --> 07:25.850
What we want to do is to make use of the part of tool to actually write the

154
07:25.850 --> 07:27.900
partition onto the disk itself.

155
07:27.900 --> 07:30.900
Now the first thing we're going to do is to quickly see this manually,
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

155
07:27.900 --> 07:30.900
Now the first thing we're going to do is to quickly see this manually,

156
07:30.900 --> 07:34.500
and then we'll be able to walk through the tasks or rather these steps

157
07:34.500 --> 07:37.900
in order to complete this task via automation using Ansible.

158
07:37.900 --> 07:41.900
So all I'm going to do here is copy the name of the disk that I want to target

159
07:41.900 --> 07:42.900
and partition.

160
07:42.900 --> 07:46.820
All I will do is I will say sudo part it and then paste in the name of the

161
07:46.820 --> 07:47.900
device itself.

162
07:47.900 --> 07:48.900
So let's hit enter.

163
07:48.900 --> 07:50.900
We now go into this interactive menu.

164
07:50.900 --> 07:53.900
If I say help, we can see all of the available options.

165
07:53.900 --> 07:57.250
And the case here, what I want to do is to create a new disk label to generate

166
07:57.250 --> 07:57.900
a partition table.

167
07:57.900 --> 08:00.900
Okay, so I can say help MK label.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

167
07:57.900 --> 08:00.900
Okay, so I can say help MK label.

168
08:00.900 --> 08:03.900
We can see all of the available labels that we have here.

169
08:03.900 --> 08:07.900
If I want to choose GPT, this is one of the options I have available to me.

170
08:07.900 --> 08:09.900
So I can say MK label GPT.

171
08:09.900 --> 08:12.900
I can say help on MK parts.

172
08:12.900 --> 08:15.510
We can see the types of partitions that I can create would be a primary

173
08:15.510 --> 08:15.900
partition

174
08:15.900 --> 08:18.900
or a logical or extended partition, just like we talked before.

175
08:18.900 --> 08:22.900
So now I will say MK parts primary to make a primary partition.

176
08:22.900 --> 08:27.900
It is suggesting the file system type to be EXT2, which is very, very outdated.

177
08:27.900 --> 08:32.900
Much more likely you would choose EXT4 or in the case of my railbase system.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

177
08:27.900 --> 08:32.900
Much more likely you would choose EXT4 or in the case of my railbase system.

178
08:32.900 --> 08:34.900
I'm going to choose XFS.

179
08:34.900 --> 08:36.900
Now I'm going to specify where the partition should start.

180
08:36.900 --> 08:40.900
So I will say 0%, which is at the very start of the partition.

181
08:40.900 --> 08:42.900
And I want to use the entire partition.

182
08:42.900 --> 08:44.900
So I will say the end will be 100% of the disk.

183
08:44.900 --> 08:48.120
If with that now done, if I select prints, this here is going to be our

184
08:48.120 --> 08:48.900
partition disk.

185
08:48.900 --> 08:52.900
And now what I can do is press quit to write the changes.

186
08:52.900 --> 08:56.900
And now if I say pseudo-parted dash L, type in my passwords.

187
08:56.900 --> 09:00.900
And now this particular disk here is using the GPT partition style.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

187
08:56.900 --> 09:00.900
And now this particular disk here is using the GPT partition style.

188
09:00.900 --> 09:04.900
It is a primary partition, meaning that it can support an operating system.

189
09:04.900 --> 09:06.900
And we are using the entire disk.

190
09:06.900 --> 09:10.900
If we so wish though, we could have subdivided this disk into small partitions

191
09:10.900 --> 09:12.900
for different purposes.

192
09:12.900 --> 09:16.900
This here though is ultimately the process that we want to automate.

193
09:16.900 --> 09:20.900
So now if I use part of on the same disk, and I just say print, we can actually

194
09:20.900 --> 09:22.900
see the partition number, which is number 1.

195
09:22.900 --> 09:24.900
The very first partition makes sense.

196
09:24.900 --> 09:25.900
We only have one.

197
09:25.900 --> 09:29.840
Now what I can do here is just say RM to remove and then specify the number of

198
09:29.840 --> 09:30.900
the partition.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

198
09:29.840 --> 09:30.900
the partition.

199
09:30.900 --> 09:33.900
So if I say RM 1 and to enter, now what I can do is press quit.

200
09:33.900 --> 09:39.010
And if I now re-list my part of information, now we have actually removed that

201
09:39.010 --> 09:39.900
particular partition.

202
09:39.900 --> 09:44.140
So now that we have the primer on partitions and the use of the part of utility

203
09:44.140 --> 09:44.900
out the way,

204
09:44.900 --> 09:47.900
let's now walk through the automation of this particular process next.
