Saturday, September 21, 2013

how to do linux partitions

how to do linux partitions  

Linux Partitions

Step 1 ) To Create the partitions

[root@client1 ~]# fdisk -l

[root@client1 ~]# fdisk /dev/hda

Command (m for help): m
d   delete a partition
      m   print this menu
    n   add a new partition
p   print the partition table
    q   quit without saving changes
    w   write table to disk and exit

Command (m for help):

Command (m for help): n
First cylinder (1098-2434, default 1098):
Using default value 1098
Last cylinder or +size or +sizeM or +sizeK (1098-2434, default 2434): +100M
Command (m for help): p
Command (m for help): n
Command (m for help): p
Command (m for help): n
Command (m for help): p
Command (m for help): d
Command (m for help): 10 #write the number of partition
Command (m for help): w

[root@client1 ~]#

To update the kernel without restarting

[root@client1 ~]# partprobe /dev/hda

[root@client1 ~]# fdisk -l


Step 2 ) Make the filesystem ( i.e format the partition) ext2, ext3, vfat

[root@client1 ~]# mkfs.ext2 /dev/hda8

[root@client1 ~]# mkfs.ext3 /dev/hda9

[root@client1 ~]# mkfs.vfat /dev/hda10









Step 3 ) Create a folder & Mount the partition to use

[root@client1 ~]# mkdir /mnt/song /mnt/video /mnt/music

[root@client1 ~]# mount /dev/hda8 /mnt/song

[root@client1 ~]# mount /dev/hda9 /mnt/video
[root@client1 ~]# mount /dev/hda10 /mnt/music

[root@client1 ~]# mount

Step 4 ) Write the data inside the partition

[root@client1 ~]# cd /mnt/song

[root@client1 song]#

[root@client1 song]# touch myfile1 myfile2 myfile3

[root@client1 song]# mkdir hyd sec bhills ameerpet

[root@client1 song]# ls

*****************  This is the output  ********************

ameerpet  bhills  hyd  lost+found  myfile1  myfile2  myfile3  sec
[root@client1 myfolder]#

Converting from ext3 to ext2

[root@client1 ~]# umount /dev/hda8

[root@client1 ~]# tune2fs -O ^has_journal /dev/hda8

[root@client1 ~]# mount /dev/hda8 /myfolder/

[root@client1 ~]# mount

Convert from ext2 to ext3

[root@client1 ~]# umount /dev/hda8

[root@client1 ~]# tune2fs -j /dev/hda8

[root@client1 ~]# mount /dev/hda8 /myfolder

[root@client1 ~]# mount



Looking forward for your suggestions.. please feel free to write to me.. Your help would definitely help to improve our blog. Chetan Yadav

No comments:

Post a Comment