Linux

TOPICS:

1. Creating Logical Volumes Using LVM

2. Disk Quota Implementation in Linux

3. Linux Bonding

4. Swap Space Partition/Files Provisioning

5. Linux Boot Process

6. Implementing RAID on Linux

7. Kernel Upgrade

1. CREATING LOGICAL VOLUMES USING LVM

1. Create LVM  partitions via fdisk  or parted
A.’fdisk /dev/sda’ ‘fdisk /dev/sdb’, ‘fdisk /dev/sdc’
B. n
C. p
D. +10G
E. t – to change to type ’8e’ (LVM)
F. w
G. partprobe /dev/sda
2.  Create physical volumes using ‘pvcreate’
A. ‘pvcreate /dev/sda1′
B. ‘pvcreate /dev/sdb1′ ‘pvcreate /dev/sdb3′
C. ‘pvdisplay
3. Create Volume Groups using ‘vgcreate’
A. ‘vgcreate volgoup001 /dev/sda1 /dev/sdb1 /dev/sdc1′
4. Create one or more  logical volumes in that volume group
A.’ lvcreate -L 10GB -n logvar1 volgroup001′
5. Create filesystem on Logical Volumes
A. mke2fs -j /dev/volgroup001/logvar1′
6. Mount Logical Volumes
A. ‘mount /dev/volgroup001/logvar1 /dir1′

1. Create LVM  partitions via fdisk  or parted

‘fdisk /dev/sda’ ‘fdisk /dev/sdb’, ‘fdisk /dev/sdc’

Press ‘ n’

Press ‘p’

Specify the size – ‘+10G’

Press ‘t’ – to change to type ’8e’ (LVM)

Press ‘w’

$ partprobe /dev/sda    # Repeat for /dev/sdb & /dev/sdc

2.  Create physical volumes using ‘pvcreate’

$ pvcreate /dev/sda1

$ pvcreate /dev/sdb1

$ pvcreate /dev/sdc1

$ pvdisplay     # To  Display the Created physical Volumes

3. Create Volume Groups using ‘vgcreate’

$ vgcreate volgoup001 /dev/sda1 /dev/sdb1 /dev/sdc1

4. Create one or more  logical volumes in that volume group

$ lvcreate -L 10GB -n lvpartition1 volgroup001

5. Create ext3 filesystem on Logical Volumes

$ mke2fs -j /dev/volgroup001/lvpartition1

6. Mount Logical Volumes

$ mkdir /dir1

$ mount /dev/volgroup001/lvpartition1 /dir1

2. DISK QUOTA IMPLEMENTATION IN LINUX

Following are the features of Implemeting Quotas:

1. Limits disk usage (With respect to Blocks and/or Inodes).

2. Tied to a File System ( Set on a per filesystem basis).

3. It can be configured for users and groups.

Steps to enable Quota Support:

1. Enable Quota support for File system in  ’/etc/fstab’

/dev/sdb1            /home                 ext3                       defaults,usrquota,grpquota             1  1

2.  Remount the file system

$ mount -o remount /home   #To remount ‘/home’ filesystem

$ mount     # To verify and check

3. Create Quota database files and generate disk usage table

$ quotacheck  -cug /home   #Create Quota files

$ quotacheck -avug /home  # To verify

4. Assign Quota Policy

$ edquota username # Set Blocks/Inodes Soft_Limit Hard_limit   per User

$ edquota -g groupname # Set Quotas on groups

5. Check Quotas

$ quota username    # Quota Per User


3. LINUX BONDING

Step 1:

$ cat /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0

IPADDR=192.168.1.12

NETMASK=255.255.255.0

GATEWAY=192.168.1.1

USERCTL=no

BOOTPROTO=none

ONBOOT=yes

Step 2.

Modify eth0, eth1 and eth2 configuration as shown below. Comment out, or remove the ip address, netmask, gateway and hardware address from each one of these files, since settings should only come from the ifcfg-bond0 file above.

$ cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

BOOTPROTO=none

ONBOOT=yes

# Settings for Bond

MASTER=bond0

SLAVE=yes

$ cat /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

BOOTPROTO=none

ONBOOT=yes

# Settings for Bond

MASTER=bond0

SLAVE=yes

$ cat /etc/sysconfig/network-scripts/ifcfg-eth2

DEVICE=eth2

BOOTPROTO=none

ONBOOT=yes

# Settings for Bond

MASTER=bond0

SLAVE=yes

Step 3:

Set the parameters for bond0 bonding kernel module. Add the following lines to /etc/modprobe. conf

# bonding commands

alias bond0 bonding

options bond0 mode=balance-alb miimon=50

Step 4:

Load the bond driver module from the command prompt.

$ modprobe bonding

Step 5:

Restart the network, or restart the computer.

$ service network restart # Or restart computer

When the machine boots up check the proc settings.

$ cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.0.2 (March 23, 2006)

Bonding Mode: adaptive load balancing

Primary Slave: None

Currently Active Slave: eth2

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0

Slave Interface: eth2

MII Status: up

Link Failure Count: 0

Permanent HW addr: 00:13:72:80: 62:f0

Look at ifconfig -a and check that your bond0 interface is active. You are done

4. Swap Space (Partition/Files) Provisioning

STEP 1:

Check the current Swap  space using following commands:

$ free -m

$ swapon -s

STEP 2:

Select target drive and create Swap Partition with Parition ID ’82′

$ fdisk /dev/sdc

Press ‘n’

Press ’2′

# Enter the Size of the partition,

Type ‘ +1024M’

Press ‘t’   # To change the type of partition

type ’82′

Press ‘w’

$ Partprobe /dev/sdc

STEP 3:

Create a Swap Filesystem on newly created partition.

$ mkswap /dev/sdc1

STEP 4:

Enable swapping

$ swapon /dev/sdc1

STEP 5:

Update /etc/fstab to persist Swap space across reboots.

/dev/sdc1                             swap                       swap      defaults        1  1

Creating Swap space based on File

1. $ dd if=swap of=/home/swapfilespace1 bs=1024 count=524288

2. $ mkswap /home/swapfilespace1

3. $ swapon /home/swapfilespace1

5. LINUX BOOT PROCESS

####################################

Title: LINUX BOOT PROCESS

####################################

5 STEP PROCESS:

1. BIOS loads & checks peripherals & checks for the boot device.

- Loads boot sector from one of the following:

- CDROM
- HARD DISK
- FLOPPY

- Executes first 512 bytes of the disk.

2. MBR will:

- look for primary partition marked bootable.

- loads and executes first 512 bytes of this partition, Which calls the stage 2 boot loader (GRUB/LILO).

3. GRUB:

- Is loaded into Memory.

- Locates kernel (vmlinuz) from /boot partition.

- Creates RAMDISK for initrd.

- Hands-off to kernel.

4. Kernel:

- Initializes devices.

- Mounts root file system.

- Excutes init process.

5. Init Process:

- Reads /etc/inittab

- Executres initialization scripts /etc/rc.d/rc/sysinit

- Loads deamons and mounts partitions (/etc/fstab)

User recieves login screen.

  • Twitter
  • Facebook
  • Google Bookmarks
  • Share/Bookmark

Leave a Reply