This article explain you how to recover the lost or deleted partition in linux. Losing of disk partition is occur due to sudden power off or some other problem like accidently deleting the hard disk partition by the users. In this cases, if you want to recover the losted disk partition their is so many recovering tools are availble on linux. In this article we will use the gpart to recover the disk partition.
The gpart is guess PC-type hard disk partitions, that tries to recover the hard disk partitions. This gpart have limitation, It can only detect the following type of partitions.
To add more filesystem for guessing, modules can be added at runtime
To recover the lost or deleted partition of your hard disk, first boot the system with a linux OS CD that what flavour you used in that crashed disk finally.
Then go to rescue mode with that Linux OS CD, that bring you to a rescue mode .
Now you put the following command for available disk partition checking
# fdisk -l
Disk /dev/sda: 160.0 GB, 160041885696 bytes
18 heads, 4 sectors/track, 4341414 cylinders
Units = cylinders of 72 * 512 = 36864 bytes
Device Boot Start End Blocks Id System
This show no partition on your disk, it means all the partiotions are losted.
Now run the below command
# gpart /dev/sda
The output of the above command will be like this
This command will show’s the all guessed partitions available on the hard disk. Now verify the result that showing the lost partition of your disk correctly or not.
After verifying the output write the the partition table by using the -W option on gpart command
# gpart -W /dev/sda /dev/sda
it can be written the guessed disk partition to the specified file or device on your hard disk. now you got back your deleted partition successfully .
Basics Of Network File Sharing Setup on Linux
Network File Sharing (NFS) is a protocol which used to share the local hard disk Between the Linux machines over the network, that act as a local disk to the clent user.
At present there are three versions of NFS
* NFSv2 – It is a older and is widely supported version
* NFSv3 – It supports safe asynchronous writes and a more robust error handling than NFSv2,it also supports 64-bit file sizes and offsets
* NFSv4 – It works through firewalls and on the Internet, no longer requires an rpcbind service, supports ACLs, and utilizes stateful operations
Port Number :
The Default Port Number of NFS is 2049
The Packages needed for NFS are
To run the NFS the following dameon or services is used
* portmap (rpcbind for RHEL 6)
portmap or RPC Program or otherwise called as rpcbind.NFS uses Remote Procedure Calls (RPC) to handle the requests between clients and servers.
It lock the files for remote and local nfs request .
service nfs start the NFS server and the appropriate RPC processes to service requests for shared NFS file systems.
Configuring NFS on the Server :
Both the NFS server and NFS client need the NFS package installed and running on the machine. The server needs rpcbind, nfs, and nfslock operational, as well as a correctly configured /etc/exports file.The /etc/exports file is the main NFS configuration file, and it consists of two columns. The first column lists the sharing directories over the network. The second column has two parts. The first part is for mentioning the networks or DNS domains that can get access to the directory, and the second part is for NFS options in brackets.
# vim /etc/exports
/home/example/share 192.168.1.2 (ro,sync)
Then Start the Required services
Configuring NFS on The Client :
NFS configuration on the client requires you to start the NFS application; create a directory on which to mount the NFS server’s directories that you exported via the /etc/exports file, and finally to mount the NFS server’s directory on your local directory, or mount point.
The /etc/fstab file lists all the partitions that need to be mounted automatically when the system boots. For this, we need to edit the /etc/fstab file if you need the NFS directory to be made permanently available to the users .
A valid /etc/fstab entry to mount an NFS export should contain the following information:
server:/remote-shaing-path/ /local-mounting-directory/ nfs options 0 0
# vim /etc/fstab
192.168.1.2:/home/example/sharing /home/example2/remote-files nfs soft,nfsvers=2 0 0
Possible NFS Mount Options
bg ==========> Retry mounting in the background if mounting initially fails
fg ==========> Mount in the foreground
soft ==========> Use soft mounting
hard ==========> Use hard mounting
rsize=n ==========> The amount of data NFS will attempt to access per read operation. The default is dependent on the kernel. For NFS version 2, set it to 8192 to assure maximum throughput.
wsize=n ==========> The amount of data NFS will attempt to access per write operation. The default is dependent on the kernel. For NFS version 2, set it to 8192 to assure maximum throughput.
nfsvers=n ==========> The version of NFS the mount command should attempt to use
tcp ==========> Attempt to mount the filesystem using TCP packets: the default is UDP.
intr ==========> If the filesystem is hard mounted and the mount times out, allow for the process to be aborted using the usual methods such as CTRL-C and the kill command.
Temprovary Mount of NFS :
mount -t nfs [SERVER:sharing-path] [mounting-directory]
Example : # mount -t nfs 192.168.1.2:/home/example/sharing /mnt/
( -t indicates the file system type )
Unix/Linux command prompt keyboard shortcut keys
Linux / Unix Command prompt supports huge number of shortcut keys. If you familiar with the shortcut keys you can utilizes the command prompt very faster. The more practice on the shortcut keys will give you more speed in the command prompt. Below are the shortcut keys.
To move cursor one word backword
To move cursor one word forward
To move cursor to the starting of the line
To move cursor one letter backword
Terminate foreground job
To Logout of the terminal
To move cursor to the end of the line
To move cursor forward
To delete one letter backward like backspace
To delete contents from where the pointer to left side end
To delete contents from where the pointer to Right side end.
To delete one word from where the pointer to one word on left side
To move cursor one letter forward
To display the previously executed Command
To display the next command when ctrl +p is used
To Clear the screen
To execute a command like hitting ENTER
To execute a command like hitting ENTER
To pastes text previously erased (with Ctl-U or Ctl-W)
Short cut key to reverse search in the command history
Few Linux Monitoring Tools
The following monitoring tools can be used to get information about system activities. use these tools to find the performance problem. some of basic monitoring commands.
1.top -Process Activity Command When you need to see the running processes on your Linux in real time, you have top as your tool for that. top also displays other info besides the running processes, like free memory both physical and swap and updates the list every five seconds.
2.vmstat – Report virtual memory statistics ,The command vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity.
3.w – Who Is Logged on And What They Are Doing w displays the information about users currently on machine, and their processes, the current time, how long the system running, how many users are currently logged on, and the system load average for the past 1, 5, and 15 minutes.
4.uptime – How Long The System is Running The uptime command can be used to check how long the server has been running.
5.ps – process status The command should be used to display the currently running processes on our systems.
6.free – Information about free and used memory on the system The command free displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel.
7.iostat – Average CPU Load, Disk Activity The command iostat report CPU statistics and input/output statistics for devices, partitions and network filesystems (NFS).
8.sar – Store Address Register The sar command is used to collect, report, and save system activity information it reports every 10min system activity.
9.mpstat – Multiprocessor Usage The mpstat command displays activities for each available processor, reports global and per-processor statistics.
10.pmap – Process Memory Usage pmap displays the memory map of a process for the specified pid.
11.netstat – network statistics The command netstat displays network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.
12.ss – Stack Segment ss command is used to dump socket statistics. It allows showing information similar to netstat.
13.iptraf -The following monitoring tools can be used to get information about system activities. use these tools to find the performance problem. some of basic monitoring commands.
Share and Enjoy
Windows3 months ago
System Tools to Maintain your PC
Windows2 months ago
How To Install Windows 7
Windows2 months ago
How to Fix Boot Problem in Windows 7
Linux1 month ago
Some Crazy Linux Commands
Home2 months ago
Some Specific Technical Terms Definitions
Linux2 months ago
Red Hat company Announced their new beta release of Red Hat Enterprise Linux 5.8
General1 month ago
How to run a script every second
General2 months ago
List of Computer Related Technical Abbreviations