top of page
Writer's pictureMukesh Chanderia

Linux Commands Part 17 - PARTITION PART 2

Updated: Aug 21, 2021

Friends,


Just like Windows OS we have to format the partition in order to use it.


To format partition use following command


mkfs -t ext2 /dev/partitionname

[root@RedHat ~]# mkfs -t ext2 /dev/sdc1

mke2fs 1.45.4 (23-Sep-2019)

Discarding device blocks: done

Creating filesystem with 262144 4k blocks and 65536 inodes

Filesystem UUID: 1c737ddb-f8a0-411b-9b4b-7e943afdd408

Superblock backups stored on blocks:

32768, 98304, 163840, 229376


Allocating group tables: done

Writing inode tables: done

Writing superblocks and filesystem accounting information: done

mkfs -- Make file system


To use partition we need to mount it on some directory.


[root@RedHat ~]# df -h | grep sdc1


We can see /dev/sdc1 isn't listed . Now after mounting it will be listed.


Let's create directory "thisisnewpartition" & mount it there.


[root@RedHat adminji]# mkdir thisisnewpartition

[root@RedHat ~]# mount /dev/sdc1 thisisnewpart


[root@RedHat ~]# df -h | grep sdc1

/dev/sdc1 1008M 1.3M 956M 1% /root/thisisnewpart

Some do for rest all the partition


[root@RedHat ~]# df -h | grep thisisnewpar

/dev/sdc1 1008M 1.3M 956M 1% /root/thisisnewpart

/dev/sdc2 2.0G 3.0M 1.9G 1% /root/thisisnewpart2

/dev/sdc3 3.0G 4.5M 2.8G 1% /root/thisisnewpart3

/dev/sdc5 6.0G 12M 5.6G 1% /root/thisisnewpart5

/dev/sdc6 8.9G 21M 8.4G 1% /root/thisisnewpart6

/dev/sdc7 12G 30M 12G 1% /root/thisisnewpart7


Now go to thisisnewpart6 and copy directory /etc

cd / thisisnewpart6

[root@RedHat thisisnewpart6]# cp -rvf /etc *.


Note : Period "." means in current pwd


[root@RedHat thisisnewpart6]# du -sh *

25M etc

Now we can see 25 M of /etc

4 views0 comments

Recent Posts

See All

Comments


bottom of page