NO1 Top Vashikaran Specialist in Uk Black Magic Specialist in Uk Black Magic ...
EXP_2(20BCA1066 Internet).docx
1. Experiment No.2
Student Name: JHA AMIT SUMAN UID:20BCA1066
Branch: BCA Section/Group:20BCA3/B
Semester:4th
DateofPerformance:23/02/2022
SubjectName:LINUXADMINISTRATIONLAB SubjectCode:22E-20CAP-256
1. Aim/Overviewofthepractical:
1) Write a command used to display existing partitions and sizes using 2
differentcommands. After than compare the outputs of both. After this create a new
400MBprimary partition and 2 extended partition under that primary partition and check
whetherboth partitionsarecreatedornot.
2) WriteaCommandthatcan(possibly)beusedtoformatapartition.Writeacommandtoadd
aswappartitionof size200MBand showthepurpose ofusingPartprobe.
3) Createafilesystempartitionof60GBandmount thepartition on thedatadirectory.
4) Createaswappartitionof4.5Gbandturnonthenewlycreatedswappartitiontempor
arily.
2. Tasktobedone: AddingDisk,Partitionsand filesystemto aLinux System
3. Conceptused:
Answer 1: Concept Used while displaying existing partitions and sizes are
fdiskcommand or lsblkcommand
Furtherwecancreateprimaryandextendedpartitionsusingfdiskcommandand
/dev/sda/directoryandcreatingpartitionbyputtingappropriatevalues.
Answer2:Wecanformatapartitionusingmkfscommandinlinuxforaddingaswappartition of
any size we use the swapoff command in the terminal and partprobe is aprogram that
informs the operating system kernel of partition table changes, byrequesting
thattheoperatingsystemre-readthe partitiontable.
Answer3:Wewillcreatefile systempartitionusingfdiskandthenusingmountcommand we
will mounttheypartitionon the datadictionary
2. Answer 4: Creating Swap partition we will use the command swap and by using
swaponcommandwewould theswap filewecanalso viewthecreatedswap partitionusing
/swapfile
4. Steps/Commandsinvolvedtoperformpractical:=
=
>
Stepsof Answer1
1. OpenLinuxTerminal
2. Writefdisk–Itoviewthepartitions
3. Selectthepartitionusingfdisk/dev/sdal
4. DiskPartitionsdisplayedwithdetails
WecanalsoviewDiskpartitionsusingIsblk. Itdisplaysblockdevices,whenusedwiththe–
foptionitprints file systemtypeonpartitionsas well
NowCreatingprimarypartitionand2extendedpartitions
1. VerifythePartitionsavailable ontheserver:fdisk–I
2. Choosewhichdeviceyouwishto use(suchas/dev/sdaor/dev/sdb)
3. Runfdisk/dev/sdX(WhereXisthedeviceyouwouldliketoaddthepartitionto)
4. Typentocreateanewpartition
5. Specify where you would like the partition to end and start. You can set
thenumberofMBofthepartitioninsteadoftheendcylinderforexample:400M
6. Typeptoviewthepartition,and type‘w’tosavethepartition
==>StepsofAnswer2
Thelsblkcommandwithoutadditionaloptionsdoesnotdisplayinformationaboutthedevices
file systems.
FormattingDiskPartitioninLinux
There are three ways to format disk partitions using the mkfs command, depending on
thefilesystemtype:
ext4
FAT32
NTFS
1. Format a disk partition with the ext4 file system using the follow command: sudo mkfs –
text4/dev/sdbl
2. Next,verifythefilesystemchangeusing thecommand:
3. 3. Lsblk–f
Theterminalprintsoutalistofblockdevices.
4. Locatethepreferredpartitionandconfirmthatitusestheext4filesystem.
Partprobeisprogramthatinformstheoperatingsystemkernelofpartitiontablechanges,by
requesting that the operating system re-read the partition table changes,by requestingthat
theoperatingsystemre-readthepartitiontable.
==>Steps formadding aswapspace
Createafilethat willbeused forswap:
sudofallocate-l200M/swapfile
sudoddif=/dev/zeroof=/swapfilebs=1024count=1048576
Onlytheroot usershould beableto writeandreadtheswap file.
Sudochmod600/swapfile
Usethemkswaputilityto setupthefileasLinuxswaparea:
Sudomkswap/swapfile
Enabletheswapwiththefollowingcommand:
Sudoswapon/swapfile
Toverifythat theswap is activeuseeithertheswapon
==>Steps for Answer3
1. CreateaPartition
Youcancheckdiskspaceusingfdisk–l
2. SetDiskLabelonthepartition
You can use e2label command to set or change disk labels.The e2label command must
berunasrootuser.
3. Createafilesystem
In a Linux you can create file system using mkfs, mkfs.ext2, njfs,ext3,
mkfs.ext4,mje4fs,xfscommands.OnRHELandCentOSsystemyou
mayinstallanadditionalpackagecalled e4fsprogs which canmanageext4 filesystem.
4. MountingaFileSystem
The most commonly used method for mounting the filesystem is either manually
usingmount command or by adding entries in /etc/fstab files, so that file system gets
mountedduringboottime.
5. DisplayMountInformation
You can run df –h or lsblk command to get mounted device information such as
mountpoint.
4. ==>Steps for Answer4
1. We will create a swap file of size 2GB using dd command as follows.Note that
bs=1024mean read and write up to 1024 bytes at a time and count=(1024*2048)MB
size of thefile.
2. Nowsetupthefileforswapspacewiththemkwapcommand.
3. Next,enabletheswap fileand add itto thesystemasaswapfile.
4. Afterwards, enable the swap file to be mounted at boot time.Edit the /etc/fstab file
andadd the followingline init.
5. Tosethowoftentheswapfilecanbeusedbythekernel,openthe/etc/sysctl.conffileandthebelow.
6. Nowverifytheswapfilewas createdusingtheswaponcommand.
5. Result/Output/Writing
Summary:Outputof Answer1
ViewingDiskpartitionusingfdiskcommand
9. Learningoutcomes(WhatIhavelearnt):
1. Formattingdisk
2. SwappingCommand
3. Partitioningofdisk
4. Primary partition of the disk
5. Extended partition of the disk
EvaluationGrid:
Sr.No. Parameters MarksObtained MaximumMarks
1. Worksheet 10
2. Demonstration/Performance/Pre
Lab Quiz
5
3. PostLabQuiz 5
Thank you so much mam !!