Linux LVM: Reduce Filesystem and Logical Volume
March 14, 2012 – 5:07 pm | No Comment

The following example shows how to reduce the size of a filesystem mounted on an LVM logical volume. The instructions below are only for non-root filesystems. No reboot is required, but the filesystem will need to be unmounted. So, if there are any user applications using this filesystem, they will need to be stopped and the users will need to log out.

Read the full story »
Networking

Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.

Applications

Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.

Data

Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.

Monitoring

Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Archive by Category

Articles in SysAdmin

Unix Commands Summary
November 19, 2005 – 11:24 pm | No Comment
Unix Commands Summary

awk/nawk [options] file scan for patterns in a file and process the results
cat [options] file concatenate (list) a file
cd [directory] change directory
chgrp [options] group file change the group of the file
chmod [options] file change file …

Moving filesystems with ufsdump
November 19, 2005 – 11:22 pm | No Comment
Moving filesystems with ufsdump

to move /opt on new partition (disk or file system)
1) from system prompt: format –> partition –> label
2) newfs -v /dev/dsk/c0t1d0s1 (target location)
3) mkdir /new_dir
4) mount /dev/dsk/c0t1d0s1 /new_dir
5) cd /new_dir
6) ufsdump 0f – /opt | …

Copying directories using tar and rsync
November 19, 2005 – 11:20 pm | No Comment
Copying directories using tar and rsync

In this example we use the tar command to copy the contents of the /export/home directory to /temphome. This particular syntax forgoes the creation of an actual tarball file. This can be useful if you …

Using more on multiple outputs
November 19, 2005 – 11:19 pm | No Comment
Using more on multiple outputs

Here’s the correct way to page four commands so they’re all controlled by “more”:

?View Code BASH(date; netstat -i; whodo; ps -ef) | more

Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit …

Find largest files
November 19, 2005 – 11:17 pm | One Comment

?View Code BASHcd to start point (is acceptable) and as super user run: ls -ailR | sort -rn +5 | more

Sample output under SuSE Linux:

?View Code BASHdeathstar:/opt # ls -ailR | sort -rn +5 | …

Increase swap space
November 19, 2005 – 11:15 pm | No Comment
Increase swap space

Instructions for adding swap space on the fly for a Solaris system. Adding swap space via a swap file degrades system perfomance. However, this is a useful method for quickly adding swap space without interrupting …

Count users with “last”
November 19, 2005 – 11:15 pm | No Comment
Count users with “last”

Here is a quick example showing how to count users logged in on a particular date using the “last” command on Linux.

To display file’s modification, last access, etc
November 19, 2005 – 11:14 pm | No Comment
To display file’s modification, last access, etc

?View Code BASHtruss -vlstat -tlstat ls -l [file name]

Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers Tweet about it Subscribe to the comments on this post

Using NetBackup to restore boot disk
November 19, 2005 – 11:13 pm | No Comment
Using NetBackup to restore boot disk

enable “Rename hard links”
disable “Rename soft links”
if root of destination drive is mounted as /destination/ then select “Restore to alternate path: from / to /destination/ , Restore search path
This is the alternate path for everything: …

Create tarball
November 19, 2005 – 10:42 pm | No Comment
Create tarball

The Unix tar command creates an archive of files and directories while preserving directory structure, file permissions and ownership information. This command is ideally suited for creating backups of most types of data. Many open-source …

Move USER to new primary group
November 19, 2005 – 10:41 pm | No Comment

1. in old user’s home dir.

?View Code BASHoldgroup=<oldgroup>
newgroup=<newgroup>
username=<username>
tar cvf – `find . -print` > backup.tar
mkdir /home/users/${newgroup}/${username}
mv backup.tar /home/users/${newgroup}/${username}/
cd /home/users/${newgroup}/${username}/
tar -xvf backup.tar
find . -group ${oldgroup} -exec chgrp ${newgroup}{} \;
find . -type l -group ${oldgroup} -exec chgrp …

Check if Solaris supports 64-bit applications
November 19, 2005 – 10:41 pm | No Comment
Check if Solaris supports 64-bit applications

isainfo -v
Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers Tweet about it Subscribe to the comments on this post

Unix Files Transferred To CD
November 19, 2005 – 10:40 pm | No Comment
Unix Files Transferred To CD

In our example we were requested to archive a 741 mb directory to CD. The source data resided on a Unix data server.
1. we copied the source data to a …

Remotely mount cdrom
November 19, 2005 – 10:39 pm | No Comment
Remotely mount cdrom

share -F nfs -o ro,anon=0 /cdrom/cdrom0
mount -o ro server:/cdrom/cdrom0 /cdrom
if target server responds: RPC: Program not registered
do
/etc/init.d/nfs.server start
Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers Tweet about …

Useful awk one-liners
November 19, 2005 – 10:38 pm | One Comment
Useful awk one-liners

?View Code BASH<em>pattern matching and processing </em>
 
<strong>awk ‘pattern {action}’ filename </strong>
 
reads one line at a time from file, checks for pattern match, performs action if pattern matched <em>pattern</em>
 
NR is a special awk variable meaning the …

Copy directory structure and files with cpio
November 19, 2005 – 10:38 pm | No Comment
Copy directory structure and files with cpio

find /full_source_path -depth -print | cpio -pudm /full_target_path
Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers Tweet about it Subscribe to the comments on this post

Using FTP with pipes
November 19, 2005 – 10:37 pm | No Comment
Using FTP with pipes

Pipe in Unix is a method of passing information from one command to another. The pipe take the output of the first command and sends it as input for the second command. The a second …

Create TAR and pipe through gzip
November 19, 2005 – 10:36 pm | 2 Comments
Create TAR and pipe through gzip

tar cvf – . | gzip > target.tar.gz
Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers Tweet about it Subscribe to the comments on this post

Fsck operations
November 19, 2005 – 10:36 pm | No Comment
Fsck operations

The following is a collection of examples using fsck command. It is important to unmount VXFS before running fsck on Veritas filesystem.
to fsck a Veritas FS:

?View Code BASHfsck -F vxfs /dev/dsk/c2t2d0s0

to do a full fsck …

RSync remote copy
November 19, 2005 – 10:35 pm | No Comment

1) rsync needs to be installed on source and destination nodes
2) both nodes need to be each other’s /etc/hosts
3) rsync needs to be in the basic PATH for default user’s (root’s shell); create a soft …

Oracle reinstallation
November 19, 2005 – 10:35 pm | No Comment

Before beginning Oracle REinstall, make sure to remove the /var/opt/oracle/oraInst.loc file created by /tmp/orainstRoot.sh script during prior installation
Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers Tweet about …

Create and mount ISO image under Solaris
November 19, 2005 – 10:33 pm | One Comment
Create and mount ISO image under Solaris

1. Disable volume management:
/etc/init.d/volmgt stop
2. Insert CD and create ISO:
dd if=/dev/rdsk/c0t6d0s2 of=/destination_path/image_name.iso bs=1024k
3. After ISO is created, make mountpoint …