Skip to main content

Posts

Showing posts from December, 2012

Lofiadm

lofiadm is command you need to use mounting an existing CD-ROM image under Sun Solaris UNIX. This is useful when the file contains an image of some flesystem (such as a floppy or CD-ROM image), because the block device can then be used with the normal system utilities for mounting, checking or repairing filesystem Mounting an Existing ISO CD-ROM Image under Solaris UNIX If your image name is cd.iso, you can type command: # lofiadm -a /path/to/cd.iso Output: /dev/lofi/1 Please note that the file name argument on lofiadm must be fully qualified and the path must be absolute not relative (thanks to mike for tip). /dev/lofi/1 is the device, use the same to mount iso image with mount command: # mount -o ro -F hsfs /dev/lofi/1 /mnt # cd /mnt # ls -l # df -k /mnt Mount the loopback device as a randomly accessible file system with mount -F hsfs -o ro /dev/lofi/X /mnt. Alternatively, use this combined format: mount -F hsfs -o ro `lofiadm -a /path/to/image.iso`

Memory usage by process

The Solaris pmap command will provide the total memory usage of each process. The following shell script prints the memory usage of each process, sorted by ascending memory usage. #!/bin/sh /usr/bin/printf "%-6s %-9s %s\n" "PID" "Total" "Command" /usr/bin/printf "%-6s %-9s %s\n" "---" "-----" "-------" for PID in `/usr/bin/ps -e | /usr/bin/awk '$1 ~ /[0-9]+/ { print $1 }'` do    CMD=`/usr/bin/ps -o comm -p $PID | /usr/bin/tail -1`    # Avoid "pmap: cannot examine 0: system process"-type errors    # by redirecting STDERR to /dev/null    TOTAL=`/usr/bin/pmap $PID 2>/dev/null | /usr/bin/tail -1 | \ /usr/bin/awk '{ print $2 }'`    [ -n "$TOTAL" ] && /usr/bin/printf "%-6s %-9s %s\n" "$PID" "$TOTAL" "$CMD" done | /usr/bin/sort -n -k2 Example output: PID    Total