Posts Tagged format

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
|                                                                                                                       |


, , , , , , , , ,


Solaris 10 disk extending

So I had a job recently that had an OS requirement for Solaris 10… Ya I am a UNIX guy, but all flavors are a little different, you know, but far be it from me to turn down an assignment just because I don’t know what I am doing, right? Well that is me… “do something, even if it’s wrong.”

Here are my notes on how I got through this one and keep in mind that everything worked out perfectly, until the customer decided to change their mind on the partitioning scheme… That presented some additional issues that I have outlined here… Unlike AIX, which compared to Solaris, is pretty straight forward… here is what I did…

Oh ya.. I forgot that they also ended up asking for an NFS mount… 2 actually, so I included that @ the end as a ‘BONUS’ as well… 🙂

Tar up and move all data on each partition as this process will wipe the partitions. That Means ALL DATA will be destroyed… Make a friggin’ back-up… LOL !!

Unmount the affected partitions and comment them out in /etc/vfstab <– This is more important than you think (LOL)
# umount /a
# umount /export/home

Now format the partition table <– This just takes you to the menu, it is not formatting the partition…
# format
Searching for disks…done

0. c1t0d0 <– You may have more than 1 selection here, pick the right one. This is a 4 disk RAID 10 array so the OS thinks it’s only 1 disk…
Specify disk (enter its number): 0
selecting c1t0d0
[disk formatted]
Warning: Current Disk has mounted partitions. <– Ignore this unless you are trying to do something with the listed mounted filesystems…
/dev/dsk/c1t0d0s0 is currently mounted on /. Please see umount(1M).
/dev/dsk/c1t0d0s1 is currently used by swap. Please see swap(1M).

disk – select a disk
type – select (define) a disk type
partition – select (define) a partition table
current – describe the current disk
format – format and analyze the disk
fdisk – run the fdisk program
repair – repair a defective sector
label – write label to the disk
analyze – surface analysis
defect – defect list management
backup – search for backup labels
verify – read and display labels
save – save new disk/partition definitions
inquiry – show vendor, product and revision
volname – set 8-character volume name
! – execute , then return
format> verify

Primary label contents:

Volume name = < >
ascii name =
pcyl = 35667
ncyl = 35665
acyl = 2
bcyl = 0
nhead = 255
nsect = 63

Here is where you make the actual changes to the sizes.  You need to review the Block allocations and adjust them properly or nothing works.  If it is not obvious or unless you have unpartitioned FREE space, you will need to REDUCE the larger filesystem FIRST to have FREE space to grow the other filesystem(s).  makes sense right? LOL … You will also have to employ a bit of mathematics as well as guess work (@ least I had to) as there is a variance in the block (or GB) allocation you give that do not exactly match perfectly by human standards… You will see what I mean, but don’t get frustrated, just reduce the count by 1 or 2 blocks and all will be fine, the percentages will remain perfect however.

I am reducing /export/home to grow /a… by their equivalent:

Part Tag Flag Cylinders Size Blocks
0 root wm 96 – 2900 21.49GB (2805/0/0) 45062325
1 swap wu 1 – 95 745.20MB (95/0/0) 1526175
2 backup wm 0 – 35664 273.21GB (35665/0/0) 572958225
3 unassigned wm 18837 – 35664 128.91GB (16828/0/0) 270341820
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 home wm 2901 – 18836 122.08GB (15936/0/0) 256011840
8 boot wu 0 – 0 7.84MB (1/0/0) 16065
9 unassigned wm 0 0 (0/0/0) 0

label, name (default is a fine name) and save the new partitons

Now create the new (or same filesystem(s)) You can get this info from the /etc/vfstab file, the
lines that you commented out before are used below.

All changed partitons must be ‘newfs’ this is a completely destructive process !!! All data will be lost.
# newfs -v /dev/rdsk/c1t0d0s3
newfs: construct a new file system /dev/rdsk/c1t0d0s3: (y/n)? y
pfexec mkfs -F ufs /dev/rdsk/c1t0d0s3 400516515 63 -1 8192 1024 264 1 166 8192 t 0 -1 8 128 n
Warning: 4702 sector(s) in last cylinder unallocated
/dev/rdsk/c1t0d0s3: 400516514 sectors in 65189 cylinders of 48 tracks, 128 sectors
195564.7MB in 4075 cyl groups (16 c/g, 48.00MB/g, 5824 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
Initializing cylinder groups:
super-block backups for last 10 cylinder groups at:
399610016, 399708448, 399806880, 399905312, 400003744, 400102176, 400200608,
400299040, 400397472, 400495904

# newfs -v /dev/rdsk/c1t0d0s7 <– What psycho @ SUN came up with this disk naming scheme???
newfs: /dev/rdsk/c1t0d0s7 last mounted as /export/home
newfs: construct a new file system /dev/rdsk/c1t0d0s7: (y/n)? y
pfexec mkfs -F ufs /dev/rdsk/c1t0d0s7 125837145 63 -1 8192 1024 264 1 166 8192 t 0 -1 8 128 n
Warning: 4264 sector(s) in last cylinder unallocated
/dev/rdsk/c1t0d0s7: 125837144 sectors in 20482 cylinders of 48 tracks, 128 sectors
61443.9MB in 1281 cyl groups (16 c/g, 48.00MB/g, 5824 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
Initializing cylinder groups:
super-block backups for last 10 cylinder groups at:
124951456, 125049888, 125148320, 125246752, 125345184, 125443616, 125542048,
125640480, 125738912, 125829152

Now uncomment the /etc/vfstab entries for these partitions and execute mount -a to remount
all partitions.

# df -hk
Filesystem size used avail capacity Mounted on
/dev/dsk/c1t0d0s0 21G 4.0G 17G 19% /
/devices 0K 0K 0K 0% /devices
ctfs 0K 0K 0K 0% /system/contract
proc 0K 0K 0K 0% /proc
mnttab 0K 0K 0K 0% /etc/mnttab
swap 7.0G 964K 7.0G 1% /etc/svc/volatile
objfs 0K 0K 0K 0% /system/object
sharefs 0K 0K 0K 0% /etc/dfs/sharetab
21G 4.0G 17G 19% /lib/
fd 0K 0K 0K 0% /dev/fd
swap 7.0G 63M 7.0G 1% /tmp
swap 7.0G 28K 7.0G 1% /var/run
/dev/dsk/c1t0d0s3 188G 146M 186G 1% /a
/dev/dsk/c1t0d0s7 59G 60M 58G 1% /export/home

SFX4140T: <– This is what the original partitioning scheme was for these 2 filesystems:
/dev/dsk/c1t0d0s3 127G 64M 126G 1% /a
/dev/dsk/c1t0d0s7 120G 64M 119G 1% /export/home


NFS mounting:
Ensure NFS is running:
# ps -ef |grep nfs
daemon 386 1 0 Feb 23 ? 0:00 /usr/lib/nfs/lockd
root 1299 1224 0 11:24:15 pts/2 0:00 grep nfs
daemon 378 1 0 Feb 23 ? 0:00 /usr/lib/nfs/nfs4cbd
daemon 379 1 0 Feb 23 ? 0:00 /usr/lib/nfs/statd
daemon 380 1 0 Feb 23 ? 0:04 /usr/lib/nfs/nfsmapid

On server you want to mount disks from:
sunblade # cat /etc/dfs/dfstab
# Place share(1M) commands here for automatic execution
# on entering init state 3.
# Issue the command ‘/etc/init.d/nfs.server start’ to run the NFS
# daemon processes and the share commands, after adding the very
# first entry to this file.
# share [-F fstype] [ -o options] [-d “”]
# .e.g,
# share -F nfs -o rw=engineering -d “home dirs” /export/home2
share -F nfs -o rw -d “home dirs” /export/home
share -F nfs -o rw -d “FACTS” /a <– this was added
share -F nfs -o rw -d “FACTS_TEST” /usr6 <– this was added
#share -F nfs -o rw -d “home dirs” /usr4/export
#share -F nfs -o rw -d “home dirs” /usr4/sfa
#share -F nfs -o rw -d “home dirs” /usr4/ups
#share -F nfs -o rw -d “home dirs” /usr4/neoforma/in
#share -F nfs -o rw -d “home dirs” /usr4/neoforma/out
#share -F nfs -o rw -d “home dirs” /usr4/medibuy/in
#share -F nfs -o rw -d “home dirs” /usr4/medibuy/out
#share -F nfs -o rw -d “home dirs” /usr4/import

Add the new filesystems you want to share:
sunblade # cat /etc/dfs/sharetab
/a – nfs rw FACTS
/export/home – nfs rw FACTS
/usr6 – nfs rw FACTS_TEST

execute “shareall” @ the command line:
execute /etc/init.d/nfs.server start <– ensure changes are taken

On the server you want to mount on:
create the mount points on / :

drwxrwxrwx 14 root root 512 Sep 1 16:12 a_sunblade
drwxr-xr-x 44 root root 1024 Feb 10 16:22 usr6_sunblade

then mount the filesystems you want:
# mount sunblade:/a /a_sunblade
# mount sunblade:/usr6 /usr6_sunblade
# df -h |grep sunblade
sunblade:/a 17G 10G 7.0G 60% /a_sunblade
sunblade:/usr6 33G 17G 16G 52% /usr6_sunblade

fstab entry for NFS mount:
[root@centOS54 /]# cat /etc/fstab
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
SFX4140P:/export/home /SFX4140P nfs rsize=8192,wsize=8192,timeo=14,intr <– this one

, , , , , , , , , ,

1 Comment