How do I update a Linux user’s home directory?

For more information on the new home directory format, please see this advisory.
Before making changes to your system, please review the general system administration best practices.

To migrate existing Linux users’ home directories to the new format:

Verify that /u2/eclipse/.profile has been updated:

vi /u2/eclipse/.profile

The following block of code must appear before “Setup the Eclipse environment.” If it doesn’t, add it:

# Move to the Eclipse account home directory
export ECLIPSEHOME=/u2/eclipse
cd $ECLIPSEHOME

After the .profile has been updated, backup the existing /etc/passwd file containing user information:

TIMESTAMP=`date +%Y%m%d.%H%M%S`
echo "`date`: backing up /etc/passwd to /etc/passwd.$TIMESTAMP"
cp /etc/passwd /etc/passwd.$TIMESTAMP

Run the following script to update the existing user’s home directories:

ECLIPSEHOME=/u2/eclipse
echo "`date`: started user migration"
awk -F":" '{ print $1 " " $6 }' /etc/passwd | egrep "$ECLIPSEHOME$" | sort | {
    while read LINE; do
        USERNAME=$(echo $LINE | awk '{print $1}')
        ECLIPSEHOME=$(echo $LINE | awk '{print $2}')
        echo "`date`: Setting $USERNAME's home directory to /home/$USERNAME with a link to $ECLIPSEHOME/.profile"
        mkdir -p /home/$USERNAME
        chown $USERNAME /home/$USERNAME
        usermod -d /home/$USERNAME $USERNAME
        ln -sf $ECLIPSEHOME/.profile /home/$USERNAME/.profile
        ln -sf $ECLIPSEHOME/.profile /home/$USERNAME/.bash_profile
    done
}

Log in as an Eterm user to verify that the steps been completed properly. If you encounter any issues, please open a support request.

Review the updated user maintenance procedures.

 

Can I safely ignore I/O errors on dm devices?

The root user of a system using may occasionally receive a message similar to the following in the daily logwatch email:

--------------------- Kernel Begin ------------------------

WARNING:  Kernel Errors Present
    Buffer I/O error on device dm-7,  ...:  11 Time(s)
    EXT3-fs error (device dm-7): e ...:  90 Time(s)
    lost page write due to I/O error on dm-7 ...:  11 Time(s)

Likewise, you may notice similar error messages in the /var/log/messages file:

May 16 04:04:52 eclipse kernel: lost page write due to I/O error on dm-20       
May 16 04:04:52 eclipse kernel: Buffer I/O error on device dm-20, logical block 0
May 16 04:04:52 eclipse kernel: lost page write due to I/O error on dm-20       
May 16 04:04:52 eclipse kernel: Buffer I/O error on device dm-20, logical block 0
May 16 04:04:52 eclipse kernel: lost page write due to I/O error on dm-20       
May 16 04:04:52 eclipse kernel: Buffer I/O error on device dm-20, logical block 0
May 16 04:04:52 eclipse kernel: lost page write due to I/O error on dm-20       
 

If the device mapper (dm-n) device(s) mentioned in the messages refer to a snapshot logical volume (LV), these messages can be ignored. By their definition, snapshot LVs are temporal in nature; they are created, destroyed and expire when changes written to them exceed their predefined capacity.

To determine if the dm device points to a snapshot LV:

First, locate the “dm” device number in the logs (in our example, 20):

[root@eclipse ~]# grep "I/O error" /var/log/messages
May 16 04:04:52 eclipse kernel: Buffer I/O error on device dm-20, logical block 1545
May 16 04:04:52 eclipse kernel: lost page write due to I/O error on dm-20

Next, list the /dev/mapper/* devices, noting the minor device numbers of each, which correspond with the “dm” device number (in our example, 20):

[root@eclipse ~]# ls -l /dev/mapper/ | grep 20
brw-rw---- 1 root disk 253, 20 May 16 14:00 datavg-lvol1

Finally, list the LVs in the noted volume group to determine whether or not it’s a snapshot, signified by the “s” in Attr column and presence of Origin and Snap% values:

[root@eclipse ~]# lvs datavg
  LV       VG     Attr   LSize   Origin   Snap%  Move Log Copy%  Convert
  eclipse  datavg owi-ao 395.00G                                        
  ereports datavg owi-ao   1.00G                                        
  lvol0    datavg swi-ao   1.00G u2         0.41                        
  lvol1    datavg swi-ao  34.82G eclipse    0.74                        
  lvol2    datavg swi-ao   1.00G ereports   0.00                        
  lvol3    datavg swi-ao   3.61G pdw        0.01                        
  pdw      datavg owi-ao  45.00G                                        
  u2       datavg owi-ao   4.00G                                        
  uvtmp    datavg -wi-ao   4.00G

In our example, the Origin LV is /dev/datavg/eclipse, and the dm-20 device referenced in the error messages is indeed a snapshot LV.

If the dm-n device(s) mentioned in the messages do not refer to a snapshot logical volume (LV), you may have a filesystem, software or hardware issue, and you should contact your Red Hat support provider.

Can I safely ignore any mismatch_cnt errors on my Fusion-io array?

The root user of a system using Linux software RAID-1 or RAID-10 of Fusion-io ioDrives (aka IBM High IOPS SSD Adapters) may occasionally receive a message similar to the following:

/etc/cron.weekly/99-raid-check:

WARNING: mismatch_cnt is not 0 on /dev/md0

For RAID-1 and RAID-10 arrays using Linux software RAID, these messages are normal and considered a known bug in Red Hat Enterprise Linux 5. These messages will be removed in a future release of the operating system.

Reference:

How do I increase the maximum email size in postfix?

The postfix MTA is configured by default with resource limits that safeguard the stability of the server. One such parameter is the maximum email size, which is configured to approximately 10 MB by default. If you need to send emails larger than 10 MB:

  • Backup the /etc/postfix/main.cf configuration file
  • Edit the /etc/postfix/main.cf configuration file
  • Add a line to the bottom of the file with the desired new size. For example, if you wish to increase the size to approximately 25 MB:
message_size_limit = 25000000
  • Save the file
  • Reload sendmail
service postfix reload

For more information, please refer to the postfix documentation.

How do I shrink a Linux filesystem?

WARNING: storage maintenance, especially reducing filesystems, can potentially result in errors or data loss. Plan and act accordingly. Always create backups and follow best practices.

For this example, we’ll be using the standard /dev/datavg/eclipse LV that’s mounted at /u2/eclipse. We’ll be shrinking the filesystem to 50GB.

Begin by unmounting the file system:

umount /u2/eclipse

Force a filesystem check:

e2fsck -f /dev/datavg/eclipse

Reduce the file system. The number specified here is the final, target size of the filesystem, not the amount by which it is reduced.

resize2fs /dev/datavg/eclipse 50G

The logical volume must also be reduced by the same amount:

lvreduce -L 50G /dev/datavg/eclipse

Mount the filesystem and run df to verify the change was made:

mount /u2/eclipse
df -h /u2/eclipse

Resources:

  • https://access.redhat.com/kb/docs/DOC-5531
  • http://blog.shadypixel.com/how-to-shrink-an-lvm-volume-safely/