Posts Tagged RHEL

Backup Takanga… RHEL v5.5… Sounds like a dance?

Well what a surprise and well kind of an embarrassment I faced the last 2 days…  I guess I have gotten pretty lazy these days as I wouldn’t have expected to miss this one, but I did.  I was building a new system for a customer upgrade and they selected RHEL v5.5 as the platform… Cool.  So as usual I sent in my request to our Dell “Gold_Team” rep with specs of what I wanted for this build.  Nothing fancy, a nice PowerEdge T410, dual quadcore procs, 8GB RAM, RAID1 (Perc6i of course) and the infamous RD1000 internal tape drive.  Now I posed the question because I am, well lazy, inquiring to include Symantec’s 2010 Backup EXEC application if it in fact runs on a Linux server.  Well that’s all it took to screw things up a bit.  I guess this can go either way, but what they shipped was the remote Linux agent for Symantec backup EXEC due to the fact (which they failed in let us know) that Backup EXEC does NOT run natively on any Linux platform as a standalone master server.  Great… I guess I should have known and shame on me for wanting a commercial app to run on Linux, but hey… I also didn’t know that the tapes for the drive are NTFS formatted by default and of course Linux cannot play with that filesystem formatting, but nothing a little fdisk-ing couldn’t fix… I am waiting for a quote back from Dell on their NetBackup 7.0.1 product (Also from Symantec…LOL)

, but I think it will be overkill to say the least for 1 server.  So in the interim, I whipped up a temp fix in the event that we opt for nothing…

Here is what I came up with:

# A straight forward system backup script
#BACKUP_ROOT_DIR=”a boot var etc”                       ## Backup dirs; do not prefix /
BACKUP_ROOT_DIR=”a”                     ## Backup dirs; do not prefix /
NOW=$(date +”%a”)                                       ## Get todays day
TSTAMP=$(date +”%l:%M:%S”)                              ## Get time stamp H:M:S
TDATE=$(date -I)                                        ## Get todays date
TAPE=”/dev/sdb1″                                        ## Backup device name
TAR_ARGS=””                                             ## Exclude file
EXCLUDE_CONF=/root/.backup.exclude.conf                 ## Named file for file exclusion
LOGFILE=$LOGBASE/$TDATE.backup.log                      ## Backup Log file
FILELIST=$LOGBASE/$TDATE.backup.file-listing.log        ## Backup Log file list
# Path to binaries
local old=$(pwd)
cd /
cd $old
# Make sure all dirs exits
local s=0
if [ ! -d /$d ];
echo “Error : /$d directory does not exit!”
# if not; just die
[ $s -eq 1 ] && exit 1
# Make some kind of status report
touch $LOGBASE/$TDATE.backup.file-listing.log
echo ”                                                                         ”
echo ” ————————————————————————- ”
echo “|                                                                         |”
echo ”  Backup start time: $TSTAMP                                               ”
echo ”  Operating System: `cat /etc/redhat-release`                              ”
echo ”  Size of the complete archive: `tar -tvf /dev/sdb1|wc -c` Bytes           ”
echo ”  Size of the logged archive: `cat $FILELIST|wc -c` Bytes                  ”
echo ”  File count of the completed archive: `tar -tvf /dev/sdb1|wc -l` Files    ”
echo ”  File count of the logged archive: `cat $FILELIST|wc -l` Files            ”
echo “|                                                                         |”
echo ” ————————————————————————- ”
echo ”                                                                           ”
} > $LOGFILE 2>&1
#### MAIN ####
# Make sure log dir exits
[ ! -d $LOGBASE ] && $MKDIR -p $LOGBASE
# Verify dirs
# Okay let us start backup procedure
# If it is Monday-Friday make a full backup;
# Weekend no backups
case $NOW in
Mon|Tue|Wed|Thu|Fri)    full_backup;;
*) ;;
esac > $FILELIST 2>&1
# make the simple report

Ahhh… The “Ghetto-scripts” live on… 🙂

This is the output that I guess I could send in an email blast:

|                                                                                                                       |
Backup start time:  9:27:36
Operating System: Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Size of the complete archive: 4295 Bytes
Size of the logged archive: 4295 Bytes
File count of the completed archive: 93 Files
File count of the logged archive: 93 Files
|                                                                                                                       |


, , , , , , , , ,


Zimbra anyone?

I used to work in an environment that required a great deal of attention to the maildrops within the infrastructure… Not a big deal aside from the fact that I knew nothing about Zimbra…. LOL (go figure right) or really anything about mail on this scale.  I think they had somewhere in the neighborhood of 3+ million users.  So in lieu of actually learning anything, (really it was a time issue, I just had to know what to do) I was able to compile a bunch of useful one-liners to tell me everything I needed to know, on demand.  So here it is, for anyone who uses Zimbra, I found this to be an invaluable asset, especially @ 3:00AM, being awakened from a dead sleep to solve space issues on maildrops in less than 15 minutes (the SLA, a-holes…). basically this loops though all the maildrops and prints the output on-screen showing the current new user creation MD (so that you don’t move more users there) and specifics about each MD that would allow you to best choose where to move users.  Possibly a space allocation in the contract would have resolved this issue (who the hell has unlimited space for emails?), but hey anything for the sale right? F’ing morons… Suffice it to say that I (well the entire team) spent a great deal of time deciding where to move users because there was no more disk space available… on a daily basis. LOL… I sure don’t miss those calls…


sortaroot = a created user account with elevated access and rsa keys for looping purposes.

Did you get the Wow… right…

# automate some preliminary maildrop checks before moving users
# Source the machines file
source /etc/inatech/machines
# Verify all maildrop file systems

DATE=`date +%Y-%m-%d`
created=”`sudo su – sortaroot -c “ssh md112.peter sudo ‘/opt/zimbra/bin/zmprov gc peter | grep -i mailhostpool|cut -c21-56′”`”
echo “”
echo “The following string will determine which mail drop”
echo “is currently defined for new user creation: $created”
# Formatting
echo “”
echo “Mail Drop                 Size  Used Avail Use% Mounted on          Number of users   Maildrop in which new users are being created ”
echo “————————————————————————————————————————————”

for i in $MD
do printf “$”
mail=`sudo su – sortaroot -c “ssh -o connectTimeout=5 $i.peter df -kh |grep ‘/opt/zimbra/store’| cut -c20-61″`
nuser=`sudo su – sortaroot -c “ssh -o connectTimeout=5 $i.peter zcat /var/tmp/$i.quota.$DATE | wc -l”`
crfind=`sudo su – sortaroot -c “ssh -o connectTimeout=5 $i.peter sudo ‘/opt/zimbra/bin/zmprov gs $ | grep “$created”‘”`
echo “$mail   $nuser            $crfind”

, , , , , , , , , ,

1 Comment

LVM Creation

Some basics on LVM creation for RHEL/centOS

[gconklin@ntl-dev7 ~]$ sudo cat /proc/partitions
major minor  #blocks  name

8     0   76546048 sda
8     1    1020096 sda1
8     2   25599577 sda2
8     3    2096482 sda3
8     4          1 sda4
8     5    2048256 sda5
8     6   40789003 sda6
8    16   52428800 sdb
[gconklin@ntl-dev7 ~]$ sudo /usr/sbin/pvcreate /dev/sdb
Physical volume “/dev/sdb” successfully created
[gconklin@ntl-dev7 ~]$ sudo /usr/sbin/vgcreate vg_usr_local /dev/sdb
Volume group “vg_usr_local” successfully created
[gconklin@ntl-dev7 ~]$ sudo /usr/sbin/vgdisplay
— Volume group —
VG Name               vg_usr_local
System ID
Format                lvm2
Metadata Areas        1
Metadata Sequence No  1
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                0
Open LV               0
Max PV                0
Cur PV                1
Act PV                1
VG Size               50.00 GB
PE Size               4.00 MB
Total PE              12799 <—————— always leave 1 free PE
Alloc PE / Size       0 / 0
Free  PE / Size       12799 / 50.00 GB
VG UUID               sRxR6p-WxGd-4RI9-giHK-vyKa-rTn7-85CE2O
[gconklin@ntl-dev7 ~]$ sudo /usr/sbin/lvcreate -l 12798 vg_usr_local -n lv_usr_local
Logical volume “lv_usr_local” created
[gconklin@ntl-dev7 ~]$ sudo /sbin/mkfs.ext3 /dev/vg_usr_local/lv_usr_local
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
6553600 inodes, 13105152 blocks
655257 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=16777216
400 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[gconklin@ntl-dev7 ~]$ sudo /sbin/tune2fs -c 0 -i 0 -O dir_index -L /usr/local /dev/vg_usr_local/lv_usr_local
tune2fs 1.35 (28-Feb-2004)
Setting maximal mount count to -1
Setting interval between check 0 seconds
[gconklin@ntl-dev7 ~]$ sudo /sbin/tune2fs -l /dev/vg_usr_local/lv_usr_local
tune2fs 1.35 (28-Feb-2004)
Filesystem volume name:   /usr/local
Last mounted on:          <not available>
Filesystem UUID:          e2ec42ed-5961-46f9-80a8-114027743b9e
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal resize_inode dir_index filetype sparse_super large_file
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              6553600
Block count:              13105152
Reserved block count:     655257
Free blocks:              12877967
Free inodes:              6553589
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      1024
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         16384
Inode blocks per group:   512
Filesystem created:       Mon Feb 16 16:26:49 2009
Last mount time:          n/a
Last write time:          Mon Feb 16 16:29:40 2009
Mount count:              0
Maximum mount count:      -1
Last checked:             Mon Feb 16 16:26:49 2009
Check interval:           0 (<none>)
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128
Journal inode:            8
Default directory hash:   tea
Directory Hash Seed:      c4355538-c7a7-4bb9-8fac-eefdabb4d46d
Journal backup:           inode blocks
[gconklin@ntl-dev7 ~]$ sudo vi /etc/fstab
[gconklin@ntl-dev7 ~]$ sudo cat /etc/fstab
# This file is edited by fstab-sync – see ‘man fstab-sync’ for details
LABEL=/                 /                       ext3    defaults        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
LABEL=/usr              /usr                    ext3    defaults        1 2
LABEL=/usr/local        /usr/local              ext3    defaults        1 2
/dev/vg_usr_local/lv_usr_local        /new              ext3    defaults        1 2
LABEL=/var              /var                    ext3    defaults        1 2
LABEL=SWAP-sda3         swap                    swap    defaults        0 0
# Beginning of the block added by the VMware software                 /mnt/hgfs               vmhgfs  defaults,ttl=5     0 0
# End of the block added by the VMware software
/dev/hda                /media/cdrom            auto    pamconsole,exec,noauto,managed 0 0
/dev/fd0                /media/floppy           auto    pamconsole,exec,noauto,managed 0 0
[gconklin@ntl-dev7 ~]$ sudo mount -a
[gconklin@ntl-dev7 ~]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             981M  776M  156M  84% /
none                  125M  6.0M  119M   5% /dev/shm
/dev/sda5             2.0G  1.1G  784M  59% /usr
/dev/sda2              25G   23G     0 100% /usr/local
/dev/sda6              39G   20G   17G  55% /var
50G   85M   47G   1% /new

I left this on the end because I thik it is funny how inconsistant my notes are?  This is a totally different system… LOL 🙂
[root@clarkconnect /]# vgextend VolGroup00 /dev/hdb
Volume group “VolGroup00” successfully extended

, , , , , , , , , , , ,

Leave a comment