Hey guys and welcome back. So now what I want to do in this nugget is to talk about our
hard drives and how we can actually tune them and make amendments to their different parameters.
There are a few terms that we want to have a good grasp of with respect to this objective here.
The first one is something called DMA. This is direct memory access. Now the purpose of DMA
is that it's going to allow hard drive devices themselves to actually access the RAM. So you've
got the hard drive and it can reach in directly and access the RAM. Think about the name direct
memory access. The hard drive is directly accessing the memory and this is enabled by the kernel.
Now the purpose of this is that it's going to give you a great deal of performance going to be much
more efficient for the hard drive to be able to do this operation. So when you're dealing with
devices which happen to have to work with a large amount of data this operation i.e. been able to
invoke DMA can be absolutely vital to you and being able to control how DMA is either used or not
used. This is clearly something that's going to be very very important to us and we'll get to see
how this relates to some of the tools we're going to talk about very very shortly. Now we also have
things such as PATTA we want to be aware of. This is the parallel advanced technology attachments
PATTA and this is ultimately an interface used by different hard disks. You may have heard at least
I hope you have of an IDE. This is an integrated drive electronics device and this is a drive which
uses that ATTA technology the advanced technology attachment. This is really used for older devices
and was ultimately replaced by something called SATA. SATA standing for serial ATTA the advanced
technology attachment and this is a more modern technology. So like I say IDE not often used so
much very kind of old-school so to speak but one thing we do want to be aware of is with respect to
the naming conventions if you happen to see a device and your Linux machine and the dev directory and
it says HDA1 if you see an H you can infer that this is an IDE based device so we know it's IDE
we know this would be the first disk disk A and so a lot of information we can derive from just the
naming convention itself. So if we use HD for these IDE devices what do we use for these SATA
devices well that is going to be as we've seen so many times before SD so that could be SDA
SDB. So if you happen to check your dev directory and you see an S rather than an H you can infer
that your device is using a SATA drive as opposed to an IDE drive which like I say SATA more modern
much more common nowadays. Now whether we are using an IDE based drive or a SATA drive we have a
particular tool which can work with both of these stale of drives. Now this tool is called HD Parm
and I believe this stands for hard drive parameters so what we'll do is we will jump into the man page
for HD Parm and to enter we can see here this tool is going to allow us to either retrieve or change
SATA or IDE device parameters so this one tool HD Parm can work for both stale devices just
remember that. Now before we actually look at this tool in some detail another tool we want to be
aware of is one called SD Parm. Now the temptation might be that if you think you know if a device
is dev HDA that would be an IDE based device because of the H and if you see dev SDA the S
denotes that this would be a SATA drive. The temptation like I say is to assume that HD Parm
just deals with IDEs and SD Parm deals with SATA drives this is absolutely not the case so try to
remember that HD Parm will do both. What SD Parm actually deals with are SCSI based devices and to
be quite frank the use of SD Parm is nowhere near as common as HD Parm so that is the one that we're
going to be looking at so we'll go back into man HD Parm and we can see the different types of
operations that this utility is capable of doing but really as a summary whenever you want to
manipulate the hard drive itself we want to change some particular parameters maybe things like
parameters relating to DMA or direct memory access or if we want to deal with particular interrupts.
Settings relating to these features can be tuned and modified and retrieved using this particular
command HD Parm so if we scroll on down we can see some of the options we can do dash B to get
the bus state or to set the bus state if we wish. Here's a very good example dash D this allows us
to either get or set the using DMA flag for this drive and as it says here what we mentioned with
respect to performance DMA always almost gives the best performance but crucially as we see here
there are some configurations of particular chipsets for which DMA doesn't really give you any such
thing and just having this set might even actually slow things down so in this case having the ability
to toggle this to either turn direct memory access on or direct memory access off for that particular
disk that you're targeting this can be very very useful now if we scroll on down now this one is
a very useful switch the dash capital I this is going to allow us to see identification info right
from the device so let's check this one out first then we'll press quit and what I will do is I'll say
HD Parm dash I and I'll go into devsdb for example and of course I need to use super user privileges
type in my password and we can see this information right here so we can see the model number the serial
number obviously the model number is a little bit strange because this is a virtual hard disk and not
a real one we can see information relating to the cylinders the heads and the sectors to all of these
physical attributes and as we can see here a whole bunch of information we don't really have to
understand all the details here because in the examination you're not going to be asked about
specific output from this particular command but we do want to be aware that we can retrieve such
information using these particular flags now like I say with respect to DMA if we want to turn on
DMA support for our disk or turn off DMA support we can use that dash lowercase d flag now this is
ultimately going to be a binary operation and that if we use the value zero that means we're going to
turn DMA access off and if we use the value one we're going to turn DMA support on so let me show
you how we can actually use this with the warning beforehand by the way that we actually cannot use
or at least I cannot use DMA that is because I'm using a virtual machine and my disk is not actually
a real SATA drive so as it is being emulated I'm going to get some pretty funky outputs when I try
to toggle my DMA access on and off simply put because it's not possible but the good news for
us is that all we have to know is to understand the syntax of the command and what the command
is trying to do so I will say sudo hd param and I'll do dash D for direct memory access if I want
to turn it off I would say the value zero and now I would specify the disk I want to target so I
could maybe say dev I don't know MD zero if I want it and to enter and it says here as we can see
DMA has failed we can't actually set this this is an inappropriate setting but again pretending we
were on a real live physical device and not a virtual machine this would turn direct memory access
off for that device and if we wanted to turn it on we would just change this value here to the value
one and again of course we see we can't actually turn such a thing on due to the virtual nature of
my device now speaking about hardware and kernel based information we want to really understand
for the purposes of the LPIC examination the location where we can find such information we
want to be looking in the PROC directory okay this is a very very important directory for us
whenever we are thinking about information relating to kernel related data this is the go to guy so
if you want to be able to find information relating to the interrupt used by a particular hardware
device where would you go you would go into the PROC directory kernel based stuff goes there so
what we would do is we would clear the screen and I would say cats go into the PROC directory
and if I wanted interrupts we would choose the interrupts file and as we can see here that spits
out all this information we can also find information relating to our system devices in the PROC
devices file so again in this same directory PROC devices let's roll on up so we can see things
like our block devices we can see we have sd which is our SATA devices we can see our md which is
our multiple disks i.e we have our RAID devices now similarly if we wanted to change the way the
kernel was operating we could actually make modifications to particular files now where would
those files be well we know it's going to be somewhere within the PROC directory which it is
but within here if we go into the sys directory we're going to find a directory structure and
within here we could actually modify particular files say for example going to kernel ls all of
these files ultimately can be used to change the configuration now for the purposes of the examination
you absolutely do not have to worry about knowing what all these files are and all the potential
configurations you can do to these files absolutely not no need to panic what we really want to focus
on is where about these files actually reside so if you wanted to change some type of CD-ROM
configuration again we could go into the DEV directory here we can have our CD-ROM configuration
and we can modify this lock file change the value from 0 to 1 this would then mean that the CD-ROM
drive will actually be locked when a CD is mounted again this is all kernel based behavior and you
will notice of course that right now this file is unwriteable because in order to modify this
i would actually have to have super user privileges so really the modification of different kernel
behaviors can be modified within the proc sys directory and the subsequent subdirectories
that follow okay so that is us for our introduction into looking at being able to tune particular
hardware settings the next thing i want to talk to you about is related to SCSI and that's what
we're going to be talking about in the very next nuggets i hope this has been informative for you
and i'd like to thank you for viewing