Partitioning: Part 2 (Demo)

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Time
21 hours 25 minutes
Difficulty
Intermediate
CEU/CPE
21
Video Transcription
00:00
>> Hello Cybrarians,
00:00
>> and welcome back to
00:00
>> the Linux plus course here at Cybrary.
00:00
I'm your instructor, Rob Goelz.
00:00
In today's lesson,
00:00
we're going to take on the second part of
00:00
our two-part on partitioning.
00:00
Upon completion of today's lesson,
00:00
we're going to be able to work with
00:00
the parted command and we'll also know
00:00
how to read the /proc/partitions
00:00
file to get partitioned info.
00:00
Let's do some more demo time
00:00
and hop over to our demo environment.
00:00
Hi, and here we are back in our CentOS environment.
00:00
If you remember from where we
00:00
left off in our previous lesson,
00:00
we had just created a partition on /dev/sdb.
00:00
Let's just do an ls on /dev/sd.
00:00
We can actually see all of our partitions,
00:00
I apologize for the typo dev sd.
00:00
We can see sda with all of its partitions and the
00:00
newly created dev sdb right here.
00:00
Now what we can also do if we wanted to create
00:00
partitions on the sdb disk
00:00
>> is we can use a command called parted.
00:00
>> Parted is a little bit more
00:00
interactive than what we've been using.
00:00
The only thing that you need to know
00:00
about parted by comparison to
00:00
F disc and G disc is that when you're using parted,
00:00
changes are written to disk automatically.
00:00
There's no hidden Q in putting
00:00
out before you finish what you're doing,
00:00
in case you screw up.
00:00
It's written automatically, there's
00:00
no hit W and it's written,
00:00
it's just written. Keep that in mind.
00:00
It is something that is a little more
00:00
interactive and maybe a little bit more intuitive,
00:00
but it certainly is something that's a little bit more
00:00
dangerous if you're not real
00:00
careful about what you're doing.
00:00
The other thing we need to know about parted is that we
00:00
have to select the disk we're going to work on.
00:00
To get started to work on dev sdb,
00:00
we're going to do sudo parted /dev/sdb.
00:00
Because if we don't type that in, it will use sda,
00:00
which is the disk that is running
00:00
the whole VMs. Let's not do that.
00:00
We're in here and then
00:00
the first thing we may want to do is
00:00
type help to get a list of all of our commands.
00:00
Then we can see all of our help commands here.
00:00
This is the equivalent to an M
00:00
on F disk or a question mark on G disk.
00:00
>> In parted, just type help and
00:00
>> you'll get a list of
00:00
all the commands that you want to run.
00:00
For us, we're going to create a new partition.
00:00
We can do that by typing make part,
00:00
mkpart, and the partition name,
00:00
we'll just call this test.
00:00
It's a test partition after all.
00:00
We'll give it the file type ext4.
00:00
For the start, well,
00:00
remember when we created our first partition,
00:00
we started at one and we ended at 1024.
00:00
Let's start at around 1048.
00:00
Then we'll end at 1048 plus 1024,
00:00
I'll say 2072. Hit enter.
00:00
It's going to say we're off by a little bit,
00:00
we'll accept the closest location
00:00
that they can manage by hitting "Yes".
00:00
Now it's done. That partition is written, and in fact,
00:00
we can type print.
00:00
Remember, it'll say right up here,
00:00
print, display the partition table.
00:00
We can hit "Print" and
00:00
we can see that we have a new partition.
00:00
It's done. There's no hitting W
00:00
or anything, it's completed.
00:00
Now we're all set.
00:00
If we go ahead and quit out of here, "Quit".
00:00
We can see that new partition.
00:00
We can run ls /dev/sd star.
00:00
Now we can see not only do we have an sdv1,
00:00
we also have a /dev/sdv2.
00:00
Another command we can run is lsb.
00:00
Let's talk about this more later,
00:00
but this actually just displays block devices.
00:00
We see a nice tree format here,
00:00
we see sdb and then sdb1 and sdb2.
00:00
That's pretty much all we need to know
00:00
about the parted command.
00:00
Now let's take a look at another location on
00:00
the system and hit Control L. There's the clear.
00:00
What we're going to do is we're going to do a
00:00
less on /proc/partitions.
00:00
The /proc/partitions file
00:00
contains information about this partitions.
00:00
Weird. Yes,
00:00
so literally we can just do it [inaudible]
00:00
>> on proc partitions and we can
00:00
>> see information about all of our partitions file.
00:00
We're going to see them, the blocks,
00:00
and the name of all of these partitions
00:00
here that we have.
00:00
We see our new partition,
00:00
dev sdb1, and dev sdb2.
00:00
But with that, we come to the end of the lesson.
00:00
In today's lesson, we covered
00:00
the parted command and the /proc/partitions file.
00:00
Thanks so much for being here,
00:00
>> and I look forward to seeing you in the next lesson.
Up Next