SEOClerks

Partition management in Linux(CentOS/Red Hat)



Write the reason you're deleting this FAQ

Partition management in Linux(CentOS/Red Hat)

In this post we’ll learn, how to manage partition in Linux.

Generally, Window File Systems are FAT32, NTFS.

And, Linux file systems are ext2, ext3, ext4, XFS (current), vfat, swap, ZFS, GlusterFS.

All device files location: /dev/*

* hdd, dvd, cdrom, usb, serial, swap, tty



Total Partition: (MBR – Master Boot Record)- (sata) – BIOS

Linux Partition = 15 (4 Primary + 11 Logical)

Windows Partition: 24 C-Z, A- Floppy, B-zip



Total Partition: (GPT – which is stands for Guid Partition Table)- UEFI (which is stands for United Extensibel Firmware Interface)

Total Partition: 128



SATA/SCSI HDD is marked as sda, sdb, sdc

USB devices is considered in Linux as sda1, sdb1

DVD drivers are markes in Linux (CentOS) as dvd/sr0

So we want to see all partition, just type these command in CLI.

[root@ns1 Desktop]# fdisk -l

sda = 1st sata

sdb = 2nd stata

sdc = 3rd sata

Command to see Linux mounted partition(s)

[root@ns1 Desktop]# df -HT



/dev/sda6 xfs 52G 7.0G 43G 15% /

/dev/sda5 xfs 204M 27M 167M 14% /boot



[root@desktop1 /]# du -ch home

Partition ID of Linux:

NTFS – 7

Extended – 5

ext3/ext4/xfs – 83

swap – 82

LVM – 8e

vfat – f

RAID – fd



Now we want to create a new Partition. So we just’ll just type the command

[root@ns1 dev]# fdisk /dev/sda



Command (m for help): m



d delete a partition

l list known partition types

m is for print this menu

n is for adding a new partition

p is to print the partition table

q is to quit without saving changes

t is for changing a partition’s system id

w is to write table to disk and exit



Command (m for help): n



[root@ns1 Desktop]# fdisk /dev/sda



Command (m for help): n

First sector (415141888-976773119, default 415141888): {press Enter}

Using default value 415141888

Last sector, +sectors or +size{K,M,G} (415141888-976773119, default 976773119): +350M



Command (m for help): p

Command (m for help): w



Now if you want to update the partition table, just follow this command.

[root@desktop1 ~]# partprobe /dev/sda



Want to format a partition? Just follow the command:

[root@ns1 Desktop]# mkfs.xfs /dev/sdaX



Want to mount a partition?? Follow this:

[root@ns1 Desktop]# mkdir /data

[root@ns1 Desktop]# df -HT

[root@ns1 Desktop]# mount /dev/sda9 /data



[root@ns1 Desktop]# df -HT

[root@ns1 Desktop]# cd /data

[root@ns1 data]# ls

[root@ns1 data]# df -HT

Filesystem Type Size Used Avail Use% Mounted on

/dev/sda6 xfs 16G 6.4G 8.4G 44% /

/dev/sda5 xfs 204M 27M 167M 14% /boot

/dev/sda9 xfs 508M 11M 471M 3% /data

[root@ns1 data]# cd .. ; This command is going to the previous directory.

[root@ns1 /]# umount /data

[root@ns1 /]# df -HT

Filesystem Type Size Used Avail Use% Mounted on

/dev/sda6 xfs 16G 6.4G 8.4G 44% /

tmpfs tmpfs 2.0G 267k 2.0G 1% /dev/shm

/dev/sda5 xfs 204M 27M 167M 14% /boot



Permanent Mount:

[root@localhost ~]# blkid /dev/sda8



[root@ns1 ~]# vi /etc/fstab



UUID=1b42c7df-717a-420d-b054-81d5a48594b5 /data xfs defaults 0 0



or

/dev/sda9 /data xfs defaults 0 0



1 2 3 4 5 6

1 – partition

2 – mountpoint

3 – filesystem

4 – options(quota,acl)

5-6 – file system check options



[root@ns1 ~]# mount -a ;fstab file update

[root@ns1 ~]# df-HT ; view



Now, want to delete a partition?? Follow this:

[root@ns1 ~]# fdisk /dev/sda



Command (m for help): d

Partition number , generally there is displayed (1-10).



Command (m for help): p

Command (m for help): w



Note: Before delete, you should unmount partition and delete fstab entry.



[root@ns1 ~]# fdisk -l



Mount USB pen drive:

[root@ns1 Desktop]# fdisk -l

Disk /dev/sdb: 32.2 GB, 32176472064 bytes

[root@ns1 Desktop]# mount /dev/sdb1 /mnt

[root@ns1 mnt]# cd /mnt

[root@ns1 mnt]# ls

[root@ns1 mnt]# cp cv.docx /root/Desktop

[root@ns1 mnt]# cp /etc/passwd /mnt

[root@ns1 mnt]# cd

[root@ns1 ~]# umount /mnt

[root@ns1 ~]# cd /mnt

[root@ns1 mnt]# ls



Mount DVD:

[root@ns1 Desktop]# mount /dev/sr0 /media

[root@ns1 Desktop]# cd /media

[root@ns1 media]# ls

[root@ns1 media]# cd Packages

[root@ns1 Packages]# ls

[root@ns1 Packages]# cd

[root@ns1 ~]# umount /media

[root@ns1 ~]#

Comments

Please login or sign up to leave a comment

Join
overcast
These are some of the nice command line option. For those who are not aware of the command line option of the Linux. For them the best option is to use GParted. Also one can use the system and disk partition on the installer. That is one thing you can do with any linux distro. And this way you can rescue your disk by pushing the content on another partition. That's what I have found out.



Are you sure you want to delete this post?

alornishan1
Yes, thanks you for your comment



Are you sure you want to delete this post?

Order Now
Process Time: 0.05727219581604

Possible Duplicate queries found!
MatchCountSQLScript
SELECT * FROM `questions` as q JOIN categories_faq as c ON q.catid=c.CATID WHERE (q.status=1 OR (q.status=2 AND userid='') ) AND q.quesid='13247'1SELECT q.*, c.seo as CatSEO, c.name as CatName, c.parentid FROM `questions` as q JOIN categories_faq as c ON q.catid=c.CATID WHERE (q.status=1 OR (q.status=2 AND userid='') ) AND q.quesid='13247'

/opt/clerks-staging/docroot/viewfaq.php 496 () ()

SELECT * FROM seoclerks.members WHERE USERID='69871'1SELECT * FROM seoclerks.members WHERE USERID='69871'

/opt/clerks-staging/docroot/include/functions/includes/member.php 445 GetAllUserDetails() ()

SELECT * FROM categories_faq WHERE CATID='42'1SELECT CATID, seo, name, metatitle, h2header, metakeywords, metadescription, metaheader, parentid, image_name FROM categories_faq WHERE CATID='42'

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() GetCategorySeoFromType()

SELECT * FROM seoclerks.members WHERE USERID=698711SELECT googleplus_profile FROM seoclerks.members WHERE USERID=69871

/opt/clerks-staging/docroot/include/functions/main.php 16914 GetGooglePlusProfileFromId() ()

SELECT * FROM ratings_faq as r, seoclerks.members as m WHERE r.USERID=m.USERID AND r.upvote=1 AND r.PID=13247 LIMIT 51SELECT m.username FROM ratings_faq as r, seoclerks.members as m WHERE r.USERID=m.USERID AND r.upvote=1 AND r.PID=13247 LIMIT 5

/opt/clerks-staging/docroot/include/functions/main.php 17159 GetVoters() ()

SELECT * FROM answers a, seoclerks.members b WHERE a.quesid='13247' AND a.userid=b.USERID and b.status='1' AND a.status=1 ORDER BY a.combined_votes DESC, a.date_answered asc1SELECT a.answer, a.USERID, a.upvotes, a.downvotes, a.ansid, a.parentid, a.combined_votes, a.date_answered, b.username, b.userlevel, b.profilepicture FROM answers a, seoclerks.members b WHERE a.quesid='13247' AND a.userid=b.USERID and b.status='1' AND a.status=1 ORDER BY a.combined_votes DESC, a.date_answered asc

/opt/clerks-staging/docroot/viewfaq.php 1245 () ()

SELECT * FROM ratings_faqanswers as r, seoclerks.members as m WHERE r.USERID=m.USERID AND r.upvote=1 AND r.PID=121224 LIMIT 51SELECT m.username FROM ratings_faqanswers as r, seoclerks.members as m WHERE r.USERID=m.USERID AND r.upvote=1 AND r.PID=121224 LIMIT 5

/opt/clerks-staging/docroot/include/functions/main.php 17159 GetVoters() ()

SELECT * FROM ratings_faqanswers as r, seoclerks.members as m WHERE r.USERID=m.USERID AND r.upvote=1 AND r.PID=121233 LIMIT 51SELECT m.username FROM ratings_faqanswers as r, seoclerks.members as m WHERE r.USERID=m.USERID AND r.upvote=1 AND r.PID=121233 LIMIT 5

/opt/clerks-staging/docroot/include/functions/main.php 17159 GetVoters() ()

UPDATE questions SET total_views = total_views + 1 WHERE quesid='13247'1UPDATE questions SET total_views = total_views + 1 WHERE quesid='13247'

/opt/clerks-staging/docroot/include/functions/main.php 1765 update_Faqviewcount() ()

SELECT * FROM questions WHERE quesid!='13247' AND status='1' AND (question like '%Partition management Linux(CentOS/Red Hat)%' OR question like '%Partition%' OR question like '%management%' OR question like '%Linux(CentOS/Red%' OR question like '%Hat)%') -- ORDER BY RAND() LIMIT 151SELECT quesid, question, seo, userid FROM questions WHERE quesid!='13247' AND status='1' AND (question like '%Partition management Linux(CentOS/Red Hat)%' OR question like '%Partition%' OR question like '%management%' OR question like '%Linux(CentOS/Red%' OR question like '%Hat)%') -- ORDER BY RAND() LIMIT 15

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() ()

SELECT * FROM seoclerks.members WHERE USERID='2470' limit 11SELECT profilepicture FROM seoclerks.members WHERE USERID='2470' limit 1

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() insert_get_member_profilepicture()

SELECT * FROM seoclerks.members WHERE USERID='134' limit 11SELECT profilepicture FROM seoclerks.members WHERE USERID='134' limit 1

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() insert_get_member_profilepicture()

SELECT * FROM seoclerks.members WHERE USERID='75857' limit 11SELECT profilepicture FROM seoclerks.members WHERE USERID='75857' limit 1

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() insert_get_member_profilepicture()

SELECT * FROM seoclerks.members WHERE USERID='9' limit 11SELECT profilepicture FROM seoclerks.members WHERE USERID='9' limit 1

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() insert_get_member_profilepicture()

SELECT * FROM seoclerks.members WHERE USERID='147' limit 11SELECT profilepicture FROM seoclerks.members WHERE USERID='147' limit 1

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() insert_get_member_profilepicture()

SELECT * FROM members_ledger WHERE script='/opt/clerks-staging/docroot/viewfaq.php' AND querystring LIKE '%id=13247%' AND added>=UNIX_TIMESTAMP(NOW())-1200 GROUP BY USERID 1SELECT USERID, username FROM members_ledger WHERE script='/opt/clerks-staging/docroot/viewfaq.php' AND querystring LIKE '%id=13247%' AND added>=UNIX_TIMESTAMP(NOW())-1200 GROUP BY USERID

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() ()

SELECT * FROM categories1SELECT * FROM categories

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() parseRedundantQueriesCache()

select * from categories_software order by name asc1select * from categories_software order by name asc

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() insert_GetSoftwareCategories()

select * from categories_wanttobuy order by name asc1select * from categories_wanttobuy order by name asc

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() insert_get_wantcategories()

select * from categories_wanttotrade order by name asc1select * from categories_wanttotrade order by name asc

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() insert_get_tradecategories()

SELECT * FROM seoclerks.members WHERE USERID='589438.jpg'1SELECT profilepicture FROM seoclerks.members WHERE USERID='589438.jpg'

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() getUserProfileImage()

select * from categories_faq order by name asc1select * from categories_faq order by name asc

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() insert_GetFaqCategories()

Invalid SQL

count(*)sql1error_msg

Expensive SQL

Tuning the following SQL could reduce the server load substantially
LoadCountSQLMaxMin

Suspicious SQL

The following SQL have high average execution times
Avg TimeCountSQLMaxMin