Sunday 20 May 2018

NFS Stale File Handle error and solution

In linux machine we have NFS mounted directories sometimes contain stale file handles. If you run command such as ls or vi you will see an error

# ls
.: Stale File Handle

Before moving to fix this issue first we need to understand the concept of Stale File Handle.

A filehandle becomes stale whenever the file or directory referenced by the handle is removed by another host.

while your client still holds an active reference to the object. A typical example occurs when the current directory of a process, running on your client, is removed on the server (either by a process running on the server or on another client).

So this can occur if the directory is modified on the NFS server, but the directories modification time is not updated.

To fixed this issue, the best solution is to remount directory from the NFS client using mount command.

# umount -f /test
# mount -t nfs nfsserver:/path/to/share /test

Tuesday 8 May 2018

How can I mount a read-only filesystem as read-write in redhat linux

This post is related to the below issue which you have faced in Red Hat Linux 5/6 operating system.

Issue :
 
➤ One of my partition has been mounted as read-only. How can I make it read-write without rebooting?

➤ How can I remount the root filesystem as read-write after it goes read-only?

➤ My filesystem went read-only, can I remount without rebooting? / filesystem suddenly became read only, unable to write to files.

➤ Also if you are trying to create any file or directory inside the file system you would get the message- "Read only file system"

 [root@localhost]# touch test
touch: cannot touch `test': Read-only file system

 [root@localhost]# cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / ext3 ro,data=ordered 0 0

Solution:

Mount an already mounted file system in read-write option, Please run the below command.

 [root@localhost]# mount -o remount,rw <filesystem_path>

Remounting as read-write may work, however, if the file system remounts as read-only again, a filesystem check and reboot of the system will be required.

Thursday 3 May 2018

How to configure Network Bonding on RHEL 7

Step by Step method to configure the network bonding on RHEL 7:
 
➤ Please log on to linux server and run the "ip a" command to check the available interfaces.

    [root@localhost]# ip a
    lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever

    eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:50:56:bd:c7:f9 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.2 brd 192.168.1.255 scope global eth0
       valid_lft forever preferred_lft forever

➤ Load the bonding driver called “bonding” in the kernel with the modprobe command if it is not already loaded, and verify with the modinfo command:

[root@localhost]# modprobe bonding
[root@localhost]# modinfo bonding
 
➤ In this step you need to generate UUIDs for interfaces using the below command.

[root@localhost]# uuidgen <interface-name>
 
➤ Now create a file called ifcfg-bond0 in the /etc/sysconfig/network-scripts directory for bond0 with the following settings. Please use vi editor to edit this file.

[root@localhost]# cd /etc/sysconfig/network-scripts
[root@localhost]# vi ifcfg-bond0

DEVICE=bond0
Name=bond0
TYPE=bond0
BONDING_MASTER=yes
BONDING_OPTS="mode=balance-rr"
ONBOOT=yes
IPADDR=192.168.1.23
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
 
➤ Now create ifcfg-eth2 and ifcfg-eth3 files in the /etc/sysconfig/network-scripts directory for eth2 and eth3 interfaces with the following settings. Set the MASTER directive to bond0. Both interfaces will act as slaves with no IP addresses assigned to them.

[root@localhost]# vi ifcfg-eth1

DEVICE=eth1
TYPE=Ethernet
NAME=eth1
UUID=23a32d65-343d-48a2-8rf7-d2jh2388f666
ONBOOT=yes
MASTER=bond0
SLAVE=yes

[root@localhost]# vi ifcfg-eth2

DEVICE=eth2
TYPE=Ethernet
NAME=eth2
UUID=22a32d65-443d-48d2-8rf7-d2jh222f666
ONBOOT=yes
MASTER=bond0
SLAVE=yes
 
➤ Now deactivate and reactivate bond0 with the ifdown and ifup commands:

[root@localhost]# ifdown bond0; ifup bond0
 
➤ Check the status of bond0 and the slaves with the ip command. It should also show the assigned IP.

[root@localhost]# ip addr
 
➤ Restart the system to ensure the configuration survives system reboots
[root@localhost]# reboot

Wednesday 2 May 2018

How to Create a Link Aggregation – Bonding on Solaris

A link aggregation consists of several interfaces on a system that are configured together as a single, logical unit. Link aggregation, also referred to as trunking

Basically link aggregation is like a bonding on server. Its work in active and passive mode. At a time one network device are up and other bonding device are in stand by mode.

Requirements for Link Aggregations:-

1. Your link aggregation configuration is bound by the following requirements:

2. You must use the dladm command to configure aggregations.

3. An interface that has been plumbed cannot become a member of an aggregation.

4. Interfaces must be of the GLDv3 type: xge, e1000g, and bge.

5. All interfaces in the aggregation must run at the same speed and in full-duplex mode.

If the solaris box matches these above requirement, after that we can only able to create a link aggregation.

How to create a link aggregation in Solaris operating system:-

1. As a root user please login on the solaris operating system so you have full administrative role to perform the action.

2. Determine which interfaces are currently installed on your system.

For this work you need to run the below command.

#dladm show-link

The above command show you the which interfaces are currently installed on your system.

#dladm show-link
ce0             type: legacy    mtu: 1500       device: ce0
ce1             type: legacy    mtu: 1500       device: ce1
bge0            type: non-vlan  mtu: 1500       device: bge0
bge1            type: non-vlan  mtu: 1500       device: bge1

As per link aggregation requirement, we can only use the interface which start from bge etc. here the device bge0, bge1 are currently installed on the server.

3. In this step now determine which interfaces have been plumbed. for this please run the below command.

#ifconfig -a

lo0: flags=2001000322 <UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000 
ce0: flags=1000420 <UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.1.43 netmask ffffff00 broadcast 192.168.1.255
        ether 0:4:7c:8:92:7d 

4. Now create a link aggregation using below command

#dladm create-aggr -d bge0 -d bge1 1

here 1 is the key number which identify the link aggreation , and it is lowest number.


5. now configure & plumb the newly created aggregation. Please use the below command to do this.

#ifconfig aggr1 plumb 192.168.1.56 up

6. To check the status of the aggregation you just created, please run the below command.

#dladm show-aggr

key: 1 (0x0001) policy: L4      address: 0:4:7c:8:92:7d (auto)
device   address           speed         duplex  link    state
bge0     0:4:7c:9:87:4e    1000  Mbps    full    up      attached
bge1     0:4:7c:9:32:9e    0     Mbps    unknown down    standby

7. For link aggregations with IPv4 addresses, create an /etc/hostname.aggrkey file.

#vi /etc/hostname.aggr1
92.168.1.56

8. perform a reboot.

#reboot -- -r