How to create a partition in Solaris Operating system?

In RHEL we use “fdisk” command to divide a disk in to individual partitions, likewise in Solaris, we execute “format” command to create the partitions.First, check how many hard disks available by running the following command,

Step:1 Check the Hard-disk details
#echo |format

From the above screenshot it has been confirmed we have one hard disk attached to the server.

Step:2 Check the currently configured partition details
#format

Step:3 Use “partition” from the above list to select partition table

Step:4 Use “print” from the above list to display the current partition table details

As we can see from the above output slice 0,1,2,4,7,8 are already created, we can now only create a partition under slice 5.

Step:5 Select any unassigned slice to create a new partition (Here I have applied slice 5)

Step:6 Enter the partition id tag, if you use”?” then it will display the available tag and use one of those, Here I have used “reserved”

Step:7 Enter the partition permission flags, Same as above if you use “?” it will display the available flags .you can use one of those

Step:8 Enter the new starting cylinder, here I have applied 201 according to my existing partition table

Step:9 Enter the partition size, here I have used 500MB according to the existing partition table

Step:10 Again use the “print” to see the newly created partition table

As you can see from the above output, the newly created partition is shown in the partition table(slice 5)

Step:11 Now save the partition information to the kernel memory by using the “label” followed by yes

Note: If you forget to label the partition details to the kernel memory then it won’t be available for use.
Step:12 check the partition layout once again by using the “print” and exit from the format command by using the quit followed by “q”

Step:13 Create a new filesystem

In Linux we use the command “mkfs” to create a new filesystem, here we use “newfs” to create a new “ufs “file system

Syntax:

#newfs   <physical device name>

#newfs  /dev/rdsk/c0d0s5

Note: To create a new filesystem you must use the raw disk(rdsk)

As you can see from the above output the slice s5 is formatted successfully with the “ufs” filesystem

Step:14 Check  whether the file system is in the clean state
#fsck  /dev/rdsk/c0d0s5

Step:15 Now mount the filesystem to some mount point directory to bring the partition to online
#mkdir   /ORACLE

#mount  /dev/dsk/c0d0s5   /ORACLE

Step:16 Check the currently mounted filesystem information by using the following command
#df  -h

As you can see from the above screenshot the slice /dev/dsk/c0d0s5 has been successfully mounted on the mount point directory /ORACLE

In Our next article, I will show you how to make the partition available permanently even after restarting the server.

If you found this article useful, Kindly Subscribe here 👉🏿👉🏿  Click this link to Subscribe

Never miss an article Do like my official  FB page 👉🏿 Learn Linux in an easier way

 

Managing Solaris OS FileSystem

A Filesystem is nothing but it is a collection of files and directories that make up a structured set of information.Solaris OS supports three different types of Filesystem

1.Disk-Based Filesystem

2.Distributed System

3.Pseudo filesystem

Let us see the types one by one in detail

Disk-Based Filesystem:

These types are found on the harddisks, CDROM’s, DVD, floppy.The following are the examples  of the disk-based filesystem

UFS –Unix File System is the default file system in Solaris OPerating system and it is based on the Berkeley fast filesystem

hsfs – High Sierra file system is a special type of filesystem developed for the use of CDROM’s media

pcfs – PC filesystem is the UNIX implementation of the DOS(Disk Operating System) FAT32 filesystem.The pcfs filesystem it allows the Solaris OS to access the PC-DOS formatted filesystems.It allows the users to use the UNIX commands for direct read and write access to PC-DOS files.

udfs – Universal Disk Formatted Filesystem is used for the optical storage targeted at DVDROM media.This filesystem allows universal data exchange and support read and writes operations.

 

Distributed Filesystem:

This filesystem it gives the network access to the file system resources

NFS- Network File system allows the users to share the files among many types of system on the network NFS filesystem makes part of the filesystem on one system appear as though it were part of the local directory tree.

Pseudo filesystem: 

These are the memory based filesystem.These filesystems provide for better system performance and also giving access to kernel information.The pseudo file system includes the following

1.tmpfs = The temporary file system stores files in memory, which avoids the overhead of writing to a disk-based filesystem.The tmfs filesystem is created and remob=ved automatically every time the system is rebooted.

2.swapfs = The swap filesystem is used by the kernel to manage the swap space on disks.

3.procfs = It holds the list of ongoing active processes under the /proc directory .all the processes are listed by a process number.all the information from this directory can be fetched with the ps command.

4.mntfs = The mount filesystem provides the read-only information from the kernel about the locally mounted filesystem details.

5.devfs = This filesystem is used to manage the namespace of all devices on the system This file system  is mainly used for the /devices

 

So in our next article, I will show you how to create partitions in Solaris.

If you found this article useful, Kindly Subscribe here 👉🏾 Click this link to Subscribe
Never miss an article Do like my official  FB page 👉🏿 Learn Linux in an easier way

 

LVM Logical Volume Manager

Introduction:

Logical Volume Manager(LVM) is the powerful tool in Linux to manage the Disk management system.Adding more space to the existing filesystem or partitions can be easily done by using the LVM.If a filesystem needs more space it could be added to its logical volumes from the free spaces in its volume group and then filesystem can be resized as per the requirement.

In today’s IT environment all the server’s needs more space day by day and we need to expand that based on our requirements.LVM can be used in RAID, SAN.A physical disk will be grouped together to create a  volume group, Then from the volume group, we need to create the individual partitions and create a new filesystem then mount it on some mount point directory to make it visible to the users.

Let me say this in simple words.To bring a disk in to the LVM structure,

1.Group all the physical disks together to create a physical volume

2.Create a volume group and add all the disks in the volume group

3.Now from the total volume group size we need to create the individual partitions i.e logical volumes

Logical Volume Manager Features:

1.It is very flexible to increase the size of the partition at any time.

2.Any filesystem can be installed

3.Migration can be used to recover the defective disk.

Now let us configure the LVM disk storage,

Ex:1 How to configure LVM

In this example, i  will add three hard disks(more than 3 u can use there are no limitations) to the server.After adding the additional hard disks to the server check whether the kernel recognized the disks by using the “fdisk” command.

#ls -l     /dev/sd*

Note: You can also use the “fdisk -l” command to check.

As you can see from the above screenshot, the newly added disks are recognized by the kernel.

Now its time to configure the LVM,Before we bring the disks in to the LVM structure we should format the disks with the LVM id.This can be done in two ways, I will show you here both the methods to label the disk with LVM partition type.

Remember you have to use either method:1 or method:2 to do this if you try both the methods when you run pvcreate command. you will get the disk missing error message 

Note: LVM Partition type ID is 8e

Method:1
#fdisk  /dev/sdb

Follow the steps as shown in the screenshot to associate the harddisks with LVM id

Repeat the same steps for the remaining harddisks i.e for /dev/sdc and /dev/sdd

Now check with “fdisk -l” whether all the disks are labeled with LVM id partition type

AS YOU CAN SEE THE ABOVE SCREENSHOT ALL THE DISKS HAVE BEEN LABELED WITH THE LVM PARTITION ID.

Method:2

Syntax:

Step:1

#pvcreate   <disk1>     <disk2>   <disk3>

In our case we have /dev/sdb,/dev/sdc,/dev/sdd

#pvcreate   /dev/sdb   /dev/sdc  /dev/sdd

This will write an LVM  header to the devices to indicate that they are ready to be added to a volume group

Step:2 Check the Physical Volume Details(PV)

Now verify that LVM has  registered the physical volumes by using the following command,

#pvdisplay

or

#pvs

From the above screenshot, all the three devices are present in the PV column

To view the same in detailed output run the following command

#pvdisplay

Note: For better view output has been truncated

Step:3  Create Volume Group(VG)

Now add the physical volumes to a volume group

Syntax:

#vgcreate    <VG name>    <disk1>   <disk2>  <disk3>
#vgcreate    VG1   /dev/sdb   /dev/sdc   /dev/sdd

Now if we check the pvdisplay or pvs command again, we can see that our physical volumes are now associated with the new volume group

#pvs or pvdisplay

As you can see from the above screenshot, now the physical volume disks have been added to volume group VG1.

To check the VG details
#vgs

or

#vgdisplay

As you can see from the above output the volume group VG1 has three physical volumes and zero logical volumes.

Here is the description of each parameter as shown in above screen shot.

1.VG NAME=Volume group name

2.Format = LVM architecture used lvm2

3.VG access = Volume group is in read and write and ready to use

4.VG status = Volume group can be resized, we can expand more if we need  to add more space

5.Cur LV= Currently there were two logical volumes in this volume groups

6.PE size= Physical extents, size for a disk can be defined using PE or GB size, 4MB is the default PE size of LVM, Say for example if we need to create 5 GB size of logical volume we can use the sum of 1280 PE, Got confused????🙄🙄

let me explain this in a easier way,as we all know 1024 MB=1 GB,if so 1024 MB * 5=5120 PE =5 GB,now divide the  5120 / 4= 1280,4 is the default PE size.

7.Total PE=  This volume group have

8.Alloc PE=  Total PE used.full PE already used,6141 * 4 PE = 24564

9.Free PE= Spaces are available as the lv are not yet been started using

Step:5 Create a Logical volume from the Volumegroup pool

We have a volume group available, we can use it for creating logical volumes.Unlike conventional partitioning, when working with logical volumes, you don’t need to know the layout of the volume since LVM maps and handle this for you.You only need to provide the size of the volume and name.

Now we will create three seprate logical volumes from the volume group

2G for  “lv1” volume

4G for “lv2” volume

4G for “lv3” volume

Syntx:

#lvcreate   -L <size>  -n  <Lv Name>   <Volume group name>
#lvcreate  -L  +2G  -n  lv1   vg1
#lvcreate  -L +4G  -n  lv2  vg1
#lvcreate   -L +4G  -n    lv3  vg1

Now check the logical volumes and their relationship with the volume group

#vgs

Step:6 Create a filesystem on logical volumes

Everything is done,inorder to make use of this logical volumes to store data we need to create a filesystem

#mkfs  /dev/vg1/lv1

#mkfs /dev/vg1/lv2

#mkfs  /dev/vg1/lv3

Repeat the same for the remaining logical volumes also i.e for lv2 and lv3

Step 7: Mount the Logical volumes to some mount point directory
#mount  /devv/vg1/lv1   /BACKUP

#mount  /dev/vg1/lv2   /DATABASE

#mount  /dev/vg1/lv3  /WEBDATA

All the logical volumes have been successfully mounted and its now ready to use

check the mounted filesystem information by using the following command

#df  -h

In our next article, we will see how to grow the size of the logical volume partitions, increase the size of the volume group and many more.

Never miss any articles from Vasanth blog follow my facebook page for updates Learn Linux in an easier way

If you found this article useful, Kindly Subscribe here 👉👉🏿Click this link to Subscribe

 

 

 

How to create a Partition in Linux

Understanding Linux Disk Management


Before we start creating the partitions it’s very important to know the basis of the disk management, So let us first learn the basic concepts of the Linux disk management.

The disk management Includes  Adding the disk, Removing a disk from the storage, creating partitions and mounting the partitions to the directory structure

1.BIOS(Basic Input and Output System)

2UEFI(Unified Extensible Firmware Interface)

3.File system type

4.MBR (Master Boot Recorder)

5.Primary Partition

6.Extended  Partition

BIOS/UEFI:

a)This is the first program that starts when you power on your system(based upon the operating system either BIOS/UEFI it starts)

b)The main task for the BIOS/UEFI is to perform the hardware test on your system,This will check each and every hardware devices that are associated with your system,if it found no error then it will search  and run the next process(i.e starting the boot loader program)This test is called as Power on Self-Test(POST).

Let me show you some of the important difference between BIOS and UEFI

BIOS(Basic Input and Output System)

1.Very old method to connect and detect the hardware in the system.

2.It doesn’t provide us any Troubleshooting options.

3.It runs in 16-bit processor mode &4.It has only 1MB of space

4.It supports only MBR partition.

5.It doesn’t have drivers for the latest network cards and other storage devices.

6.Settings are saved in Non-Volatile CMOS memory

UEFI(Unified Extensible Firmware Interface)

1.It came as a replacement of BIOS

2.It has very advanced options for troubleshooting such as emergency mode, remote diagnosis, internet connectivity and backup.

3.It can run in 32-bit or 64-bit mode

4.It supports MBR and GPT partition

5.It can detect and support all the latest modern devices.

6.All settings are saved in Flash memory

Now let us see  what is MBR partition and GPT Partition

MBR(Master boot recorder) Partition :

1.It stores in the 1st sector of the hard disk, it contains the information that is necessary to boot the systems, Inside MBR the bootloader program resides.

2.Bootloader contains only the partition layout pieces of information and how many harddisks connected, it doesn’t know anything about the operating system filesystems.

3.The default size of the sector is only 512 bytes and from these only 64 bytes are taken to save the partition table pieces of information.So due to this less space, it allows creating only 4 partitions(With the limitations of 2Tib(Tebibyte) in each partition).

4.Out of four partitions, MBR it allows one partition to use as an extended partition, with this extended partition we can create more logical partitions(It depends upon the operating system it allows to create more logical partitions), In Linux, we could create 15 partitions.

Note: The size of the extended partition and it’s all logical partitions should not exceed 2TiB

The below diagram explains you  the MBR partition scheme:

 

 

GPT Partition:

1.It supports a maximum of 128 partitions.

2.Here all partitions are equal(i.e, Primary, Extended and Logical partition method not used here)

3.It allows the maximum partition size is 8 ZiB(Zebibyte)

4.It uses the 64-bits standard to save the partition information

5.It has one main feature the information is saved in two locations, so if any one location is corrupted, the system will boot from the alternative one.

Note: In MBR all the information are saved in first sector of the hard disk, so in case if this sector corrupted, then booting process will get fail.

Linux file system types:

In order to use the disk to store your data, a filesystem must be created on the partition.We can also create a separate filesystem type in each partition or can create same filesystem type in all partitions.

File system types support in Red Hat Enterprise Linux:

EXT:(Extended file system): Early version of Linux, Now  EXT is not in use.

EXT2:( Extended file system2): It has very less features only, This was the default file system up to RHEL4.

EXT3:( Extended file system3): The default file system for RHEL5, It has so many features.

EXT3: (Extended file system3)

1.It supports the Journaling features

2.A directory can have 32,000 sub-directories

3.Supports filesystem up too 16TiB in size.

4.Up to 2TiB file size, it supports

EXT4: (Extended file system4) The default file system in RHEL6

1.A directory can have 62,000 subdirectories

2.Supports filesystem up too 1EiB in size.

3.Up to 16TiB file size, it supports

4.It also supports the Journaling features with an additional feature to enable and disable the journaling features.

Now, Let us see how to create a partition from the command line Before you start creating you should know the procedures to create the partition.

Procedure to create a partition:

1.Identify the correct hard disk from the server(coz in production servers you will see more than one hard disk connected)

2.Plan the layout(i.e How many partitions needed, size of the partition, where to mount that partition etc..)

3.Create the partition with the required size

4.Save the partition to the memory

5.Reboot the Linux system (so that that newly created partitions information will get saved in the kernel memory)

6.Make a new filesystem on the partition(i.e in Windows we call it as format a drive )

7.Mount the partition to some mount point directory

Ex:1 Create a 10GB Partition  and mount it to the directory   /sysbase

Let me demonstrate  by using oracle virtual box,  let me show you first how to add a new  hard disk to the server in virtual box

First Power off  the running virtual box,  we cannot add a disk when the  machine is in running state(In real production servers you can add and remove the disk while the server is in running state)

Step:1 Power off the virtual machine

Step:2 Now add a new hard disk to the server with the size 30GB(U can give the size as u wish, but I recommend  minimum 15 Gb you have to give)

Step:3  After choosing the new hard disk click the option .vdi disk and in the next screen it will ask you to choose the storage on the physical hard drive, here you have to choose “Dynamically allocated” after that the size of the hard disk screen will display, give the total size of the hard disk.

After assigning the size click create, you will see the newly attached disk under the controller

 

Then give ok and power on the virtual machine,thats it.. we have completed the initial steps up, now it’s time to create a partition on the newly attached hard disk

Step 4: Run the following command to check  how many harddisks attached and its partition layout information:
#fdisk  -l

From the above output we have confirmed two harddisk were attached on the server, The first one /dev/sda is a default bootable harddisk and the second one /dev/sdb is a newly attached disk to the server.

Note:/dev/sda indicates  either SCSI or SATA hard disk, The name of the first hard disk start with the letter “a” ,if the server has more hard disk, the next avaiable letter will be used for that one(ex:sdb,sdc,sde so on)

 

Step:5  To format the Hard Disk, run the following command
syntax:
#fdisk   <Logical name of the harddisk>
#fdisk   /dev/sdb

This will take you to the format menu ..

choose “m” to see all the available options  from the format menu

From this output u  will come to know which option to use to create a new partition, “n” to ccreate a new partition..

Now, choose “n” and enter, this will prompt you two options which partion you are going to create either primary or extended, choose primpary by giving “p”, As we know in MBR partition it allowed to create only four partions.If you want to create more partition then we have to use one primary partition as extended  one, In extended it allowed to create 15 logical partitions.

We are going to create the first partition on this disk, Since we haven’t created any partitions on this, so give the partition number as  “1”. Then after that it will ask you to give the starting cylinder value,don’t give any value here since system will take the default available cylinder, After this, it will prompt you to enter the total size of the parrtition(give the desired size at the end cylinder)

Step 6: Now to save this allocated partition information we have to press “w”

From the above output,  u can see a  Warning message, it says the fdisk program cannot update the inmemory kernel partiton table since the disk is mounted(busy), so we have to restart the system then after that the kernel reads the partion table.

Note: You can also use the command “partprobe” to force the kernel to read the partition table with out reboot.

#partprobe

From the above output if you see it didn’t show any warning or error messages because here we used the disk which doesn’t contain any mounted partition.

Step 7: Check the partiton details
#fdisk  -l

Now the partition created successfully, inorder to use this partition(i.e to store your data) we need to create a filesystem on this, if we dont create a filesystem on this partiton then it would become useless.

Step 8: Create a new file system

Syntax:

#mkfs   -t  <filesystem>  <Partition>

-t  =To mention the filesystem type

Now format the newly created partition with ext3 filesystem.

#mkfs   -t   ext3   /dev/sdb1

Step 9: Mount the filesystem
Mount: In order to make  use of this partition and visible to  all users you need to mount the filesystem to  some mount point directory
Note: Mounting and unmounting concepts I will explain in our next Tutorial

To mount a file system to a directory

Syntax: 

#mount   <filesystem>   <mount point directory>

Let me create a mount point directory

#mkdir  /ios.txt

Now mount  the newly created partition to this directory

#mount   /dev/sdb1   /Sybase

 

Step 10:  Now to check the currently mounted filesystem details,run the following command
#df  -h

df (Disk File System)- to display the disk space usage details

h- Human readable format(to display the size in (kb,mb.gb format)

From the above output, it’s  now confirmed the filesystem /dev/sb1 is mounted on the directory /Sybase

In our next tutorial, we will see how to create an extended partition.

If you found this article useful, Kindly Subscribe here 👉🏿👉🏿 Click this link to Subscribe