linux administration and os file systems management

21
Linux Administration and OS File systems Management Prepared by Nanjappa S Nagarajashetty

Upload: sreenathonweb

Post on 07-Jul-2016

12 views

Category:

Documents


2 download

DESCRIPTION

Linux Administration and OS File Systems Management

TRANSCRIPT

Page 1: Linux Administration and OS File Systems Management

Linux Administration and OS File systems

ManagementPrepared by Nanjappa S Nagarajashetty

Page 2: Linux Administration and OS File Systems Management

Linux

Developed in 1991 by Linus Torvalds Used in most of the computers, ranging from

super computers to embedded system Multi user Multi tasking Time sharing Monolithic kernel Latest stable version of linux kernel – 2.6.28,

released on 24-Dec-2008

Page 3: Linux Administration and OS File Systems Management

Kernel types Monolithic

All OS related code are stuffed in a single moduleAvailable as a single fileAdvantage : Faster functioning

MicroOS components are isolated and run in their own address spaceDevice drivers, programs and system services run outside kernel memory spaceSupports modularityLesser in size

Page 4: Linux Administration and OS File Systems Management

Linux Distributions

Linux distributions

Debian, Ubuntu, Linux Mint, Fedora, CentOS, openSUSE, Arch Linux and Gentoo,

Linux Enterprise Server distributions

Red Hat Enterprise Linux and SUSE

Page 5: Linux Administration and OS File Systems Management

Applications smartphones, Android, which is built on top of the Linux kernel, Largest installed base of all general-purpose operating systems mainframe computers and virtually all fastest supercomputers network routers, facility automation controls, televisions (Smart TV) video game consoles, smartwatches. Home theater PC Digital security System rescue In space Education Mail Servers File Servers

etc...

Page 6: Linux Administration and OS File Systems Management
Page 7: Linux Administration and OS File Systems Management

Linux file system and directory structure

Page 8: Linux Administration and OS File Systems Management

File Management Commands mkdir - creating directory

mkdir dirname rmdir – removing directory and its contents rmdir dirname cd – Change directory cd dirpath cp – Copying files cp file1 file2 mv – Moving or renaming files mv oldfile newfile

Page 9: Linux Administration and OS File Systems Management

Commands Help about commands

man, pinfo, info (man <<cmd name>>)

Viewing file’s content cat <<filename>>

Viewing users, processes who – List all Users who am I – List the current user pstree – displays all processes running in the system in tree format ps – displays processes owned by the current user

Changing file permission/owner chmod – changes file permission chown – changes file owner

Page 10: Linux Administration and OS File Systems Management

Commands

Checking CPU and Memory utilizationtop

Viewing the IP-Address Ifconfig

Listing files in a directory ls – Lists all files in a directory ls –a – Lists all files (including hidden files) ls –l – Lists files in a directory along with owner information, permission etc

Page 11: Linux Administration and OS File Systems Management

Commandshalt

This command shuts down the operating system, but can only be run by the root user.

rebootThis command shuts down and restarts the operating system. It also can only be run by root.#reboot [will perform simple reboot]#reboot -f [will perform fast reboot ]

init 0This command also shuts down the operating system, and can only be run by root.

init 6This command restart the operating system. It also can only be run by root.

Page 12: Linux Administration and OS File Systems Management

Commandsman

This command opens the manual page for the command or utility specified. The man utility is a very useful tool. If you are unsure how to use any command, use man to access its manual page. For example, you could enter man ls at the shell prompt to learn how to use the ls utility.

#man ls

whoami

This command displays the username of the currently logged-in user.

netstat

This command displays the status of the network, including current connections, routing tables, etc.

Page 13: Linux Administration and OS File Systems Management

VI EditorPopular text editorJust type vi <<filename>> at the prompt and hit the enter key. A new file will be openedType the contents needed and save

To save, press the Esc Key and then press : (colon) w q and then enterTo quit with out saving Esc + : + q and then enterNavigationLeft - hDown - jUp - kRight - lTop of the screen – H (shift + h) //caps lock will not workMiddle of the screen – M (shift + m)Bottom of the screen – L (shift + l)$ - End Key, 0 – Home KeyEdit CommandsCut – X, xCopy – yy, ywPaste – P, p

Page 14: Linux Administration and OS File Systems Management

Redirection and Pipes Redirection - Input redirection wc < file1 – Content of file 1 is given as input for wc command that counts the no of lines, words and characters in a file

- Output redirection cat file > newfile – Copies file’s content to newfile. Over writes the existing content cat file >> newfile – Appends the new content to the existing content Pipes Output of first command is input for the second and so on who | wc –l – Number of lines in the output of who command will be displayed

Page 15: Linux Administration and OS File Systems Management

File systems

Linux -

Extended Filesystem - ext2, ext3, ext4

Windows -

FAT16/32 --> File Allocation TableNTFS -> New Technology File System

AIX -

JFS --> Journaled File System or JFS is a 64-bit journaling file system created by IBM.

VMWARE -vmfs --> Virtual Machine File System

Page 16: Linux Administration and OS File Systems Management

How to Create, configure and mount a new Linux file system

1) Create one or more partitions using fdisk:

fdisk /dev/sdb N (new partition) p (primary partition)

Accept default initial and end blocks if you want to create a single partiton with the whole disk

w (write the information and quit)

2) check the new partition

[root@vmractest3 root]# fdisk -l Disk /dev/sdb: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System /dev/sdb1 1 2610 20964793+ 83 Linux

Page 17: Linux Administration and OS File Systems Management

3) Format the new partition as an ext3 file system type:

/sbin/mkfs -t ext3 /dev/sdb1

4)Assigning a Label with e2label

Once you have created and formated a partition, you should assign it a label using the e2label command. This allows you to add the partition to /etc/fstab using a label instead of using a device path, thereby making the system more robust.

To add a label to a partition, type the following command as root:

/sbin/e2label /dev/s db1 /oradisk

5) Then add the new partition to /etc/fstab, this way it will be mounted at reboot:

To check the label use this command:

[root@vmractest3 root]# /sbin/tune2fs -l /dev/sdb1 |grep volume

Filesystem volume name: /oradisk

vi /etc/fstab and add the following line:

LABEL=/oradisk /oradisk ext3 defaults 1 2

Page 18: Linux Administration and OS File Systems Management

6) Mount the new file system:

First create the base directory and assign it to the user that will own it

[root@vmractest3 root]# mkdir /oradisk

[root@vmractest3 root]#chown oracle:dba /oradisk

Then mount it

[root@vmractest3 root]# mount /dev/sdb1 /oradisk

And check it

[root@vmractest3 root]# df -k

Filesystem 1K-blocks Used Available Use% Mounted on

/dev/sda2 8064304 2181296 5473352 29% /

/dev/sda1 101089 9272 86598 10% /boot

none 513748 0 513748 0% /dev/shm

/dev/sdb1 20635700 32828 19554636 1% /oradisk

Page 19: Linux Administration and OS File Systems Management

How to Create, configure and mount a new Window file system

Page 20: Linux Administration and OS File Systems Management
Page 21: Linux Administration and OS File Systems Management