Sunday, March 24, 2019

A guide for partitioning and mounting disk drive in Linux

Suppose you have 2 hard drive .
One is already pre-partitioned (sda) and the new one (sdb) is unpartitioned.
Now i am going to show you how to partition the new drive  'sdb' and auto-mount in startup.

Nevigate to your System Terminal or putty.

To see your existing disk drives/partitions, enter the following command  :


 lsblk  
press the Enter  Key.
You wiill see that the new disk drive sdb is unpartitioned, as it is named only as sdb and so sub name such as sdb1 [disk drive name sdX (e.g. sda or sdb) may differ in your case.]

Now we will partition, format & mout the sdb drive.
To do so.. enter the following command :
 fdisk /dev/sdb  
press the Enter  Key.
Enter n for new partition.

Enter 
p for primary partition.

Partition number will be (
default) 1 , as we are partitioning the disk for the first time.
To do so,

Enter
 1 

First Sector will be 
defaultso just press the
 Enter  Key.
If you want to use the whole free space in your new disk partition, then you have set the Last Sector as default. To do so, just press the Enter  Key.
Also you could define a custom partition size for your new disk. Size should be given as +sizeK / +sizeM / +sizeG  [e.g. +9437184K  / +9216M / +9G] 

To do so,  type  +9G and 
press the Enter  Key.

Now we have to save the partition table change.

To do so,
type
w 
and press the  Enter  Key.

Now we will check if the partition has been created or not. So, type:
 lsblk  
and press the  Enter  Key.
Now, we can see that new partition sdb1 has been created.
Now we have to format the partition. So, type :
 mkfs.ext4 /dev/sdb1  
and press the  Enter  Key.
Now.. sdb1 successfully formatted.

After this we have to create a mount directory to mount the sdb1 partition.
Type :
 mkdir /drive2  
and press the  Enter  Key.
Now we will manually mount the partition to  /drive2.Type :                                                                            
mount /dev/sdb1 /drive2  
and press the  Enter  Key.
We can see that our newly created partition is successfully mounted at /drive2.
Now, we have to find out the UUID of the newly created partition for auto-mounting the partition, when the system boots up.
Type :
 blkid /dev/sdb1   
and press the  Enter  Key.
Now we have to create a new entry in the fstab file for automount of the partition sdb1 using vim.
 vim /etc/fstab +  
and press the  Enter  Key.



We have to copy an existing line,
To do so, point your cursor to an existing line to copy (using mouse / keyboard).
Now to copy the line press 'y' key twice from the keyboard.
Point your cursor where you want to paste the line (using mouse / keyboard).
To paste the line, press 'p' key from the keyboard.
Then press the 'i' key to enter the insert mode of vim.
Now edit the lines and input the UUID of the sdb1 partition, then its mount point, its partition type, defaults and the 0 0 bits.















For saving the changes in the fstab file and exit, press the ESC key type :wq key and hit [Enter].
Now just reboot your linux server by typing the following command :
 reboot  

Press the[Enter]Key.

Thats It!!!!!
You have successfully partitioned and auto-mounted your disk drive successfully in your linux server.





Tuesday, May 27, 2014

Configure PPPoE connection in linux

Now I am going to discuss how to configure PPPoE connection in linux in a very simple way.

Process to configure PPPoE connection in linux :

First of all, make sure that you have connect the internet cable into the port of Enhernet card.
Now,
Run the Terminal simply by pressing Ctrl+Alt+T  Keys of keyboard.
Terminal will appear.Type the following command :
sudo pppoeconf

Press Enter Key then input the password of your ubuntu/linux pc and press Enter Key again. 

SCANNING DEVICE dialog box will appear
Configure PPPoE connection in linux
then

OKAY TO MODIFY dialog box will appear
Configure PPPoE connection in linux

Press  the Tab or Down Arrow Key from the keyboard and select <Yes> then press Enter Key.


POPULAR OPTIONS dialog box will appear.
 select <Yes> and then press Enter Key  as previously described.

ENTER USERNAME dialog box will appear .
It will ask to enter a username. Type the username which provided by your ISP
select <ok> and then press Enter Key.
Configure PPPoE connection in linux 



ENTER PASSWORD dialog box will appear .
It will ask to enter a password. Type the password which provided by your ISP
select <ok> and then press Enter Key.
Configure PPPoE connection in linux

USE PEER DNS dialog box will appear .
 select <Yes> and then press Enter Key.
Configure PPPoE connection in linux


LIMITED MSS PROBLEM dialog box will appear.
select <Yes> and then press Enter Key.
Configure PPPoE connection in linux
DONE dialog box will appear.
select <Yes> and then press Enter Key.
Configure PPPoE connection in linux

ESTABLISH A CONNECTION dialog box will appear.
select <Yes> and then press Enter Key.
Configure PPPoE connection in linux

CONNECTION INITIATED dialog box will appear.
select <ok> and then press Enter Key.
Configure PPPoE connection in linux
If everything alright, then CONNECTION INITIATED dialog box will be vanish.
Then the terminal will appear as following :
Configure PPPoE connection in linux

Thats It!!!!!
You have successfully configure PPPoE connection in linux.