Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Mahavir Education Trust's

SHAH & ANCHOR KUTCHHI ENGINEERING COLLEGE


Chembur, Mumbai - 400 088

UG Program in Electronics & Computer Science

Experiment No. 5 managing Storage drives in Linux environment.

Aim: Learning and executing Linux commands for managing Storage


drives in Linux environment
Tool: Virtual box, Red Hat Linux.

Theory: In Linux, there are basically two methods a disk or drive can be partitioned. One way is
by using the standard partitioning method, and the other is by using the LVM partitioning
method.
A standard partition is a method in Linux a drive/disk is splitted/partitioned.
Disks topology in Linux is in the form of (sda, sdb, sdc, sdn..), from first disk to the last disk
respectively, and can be partitioned in a standard method as (sda1, sda2, sdb1, sdb2, sdn1, sdn2,
etc).
The utility parted allows users to:
● View the existing partition table
● Change the size of existing partitions
● Add partitions from free space or additional hard drives
If you want to view the system's disk space usage or monitor the disk space usage, “File
Systems”.
By default, the parted package is included when installing Red Hat Enterprise Linux. To start
parted, log in as root and type the command parted /dev/sda at a shell prompt (where /dev/sda is
the device name for the drive you want to configure).
If you want to remove or resize a partition, the device on which that partition resides must not be
in use. Creating a new partition on a device which is in use—while possible—is not
recommended.
For a device to not be in use, none of the partitions on the device can be mounted, and any swap
space on the device must not be enabled.

As well, the partition table should not be modified while it is in use because the kernel may not
properly recognize the changes. If the partition table does not match the actual state of the
Mahavir Education Trust's

SHAH & ANCHOR KUTCHHI ENGINEERING COLLEGE


Chembur, Mumbai - 400 088

UG Program in Electronics & Computer Science

mounted partitions, information could be written to the wrong partition, resulting in lost and
overwritten data.
The easiest way to achieve this is to boot your system in rescue mode. When prompted to mount
the file system, select Skip.
Alternately, if the drive does not contain any partitions in use (system processes that use or lock
the file system from being unmounted), you can unmount them with the umount command and
turn off all the swap space on the hard drive with the swapoff command.
Table 8.1, “parted commands” contains a list of commonly used parted commands. The sections
that follow explain some of these commands and arguments in more detail.
The first line contains the disk type, manufacturer, model number and interface, and the second
line displays the disk label type. The remaining output below the fourth line shows the partition
table.
In the partition table, the Minor number is the partition number. For example, the partition with
minor number 1 corresponds to /dev/sda1. The Start and End values are in megabytes. Valid
Type are metadata, free, primary, extended, or logical.
Procedure: 1.Suppose we have hard disk /dev/sda we will create partition
#fdisk /dev/sda
press m
press n [for new partiotion]
+10G [ we create partition of 10 GB ]
:p [ to check partition created or not]
:w [save & exit] & {[ to write it in partition table]
#fdisk -l [ to check partiotion table]
#cat /proc/partiotion [ to check the partiotion is in Ram , if
2.so we have to format row file system with the help of any one of like ext3,ext4,xfs

#mkfs.ext4 /dev/sda11 ( file system assign)

#mkdir /oracle ( create mount point)


#mount /dev/sda11 /oracle ( To mount partion on mount point)
#df -h [ to check partition mounted or not ]
so to mount /oracle permanently we you fstab file
# vi /etc/fstab
last line
/dev/sda11 /oracle ext4 default 1 1
Mahavir Education Trust's

SHAH & ANCHOR KUTCHHI ENGINEERING COLLEGE


Chembur, Mumbai - 400 088

UG Program in Electronics & Computer Science

:wq !
#mount -a
#df -h [ now we can see /oracle is mounted even after rebooting system ]

Screenshots(Results):
Mahavir Education Trust's

SHAH & ANCHOR KUTCHHI ENGINEERING COLLEGE


Chembur, Mumbai - 400 088

UG Program in Electronics & Computer Science


Mahavir Education Trust's

SHAH & ANCHOR KUTCHHI ENGINEERING COLLEGE


Chembur, Mumbai - 400 088

UG Program in Electronics & Computer Science

Conclusion: Linux commands for for managing Storage drives in Linux environment
implementation successfully in Linux.

You might also like