Mount DVD in unix ?

Use the following procedure to mount a DVD-ROM on HP-UX 11i v2 (B.11.23):
  1. Log in as root
  2. Insert the DVD into the DVD-ROM drive and wait for the drive's busy light to stop blinking.
  3. Find the DVD-ROM device file name using the following command:
  4. ioscan -fn -C disk | more
    /dev/dsk/c1t2d0 is a typical device name.
  5. Create the mount point under root(/):
  6.  mkdir /dvdrom
  7. Mount the DVD onto the new directory as a file system. For example, the following command mounts the /dev/dsk/c1t2d0 device as the /dvdrom directory:
  8. mount /dev/dsk/c1t2d0 /dvdrom

Some Linux Tips

  • How to list all the open ports and programs:
    [linux]$ netstat -apne --inet
    [freebsd]$ sockstat
  • How to list all the open files and programs:
    [linux]$ lsof
    [freebsd]$ fstat
  • How to find information about an ip (i.e. 10.0.0.0):
    [unix]$ host 10.0.0.0
    [unix]$ dig -x 10.0.0.0
  • How to find information about an ip owner (i.e. 10.0.0.0):
    [unix]$ whois -h whois.arin.net 10.0.0.0
  • How to find out the mailserver for an ip:
    [unix]$ dig mx some.domain.name.net
  • How to generate a filename with yesterdays date (i.e. for logfiles/backups):
    [linux]$ touch logfile-`date -dyesterday '+%Y-%m-%d'`
    [freebsd]$ touch logfile-`date -v-1d '+%Y-%m-%d'`

Remove LUNS From Linux

Remove LUNS From Linux Safely

This post uses the QLogic Dynamic Target and LUN Discovery utilities. The steps below apply to SLES 10 and RHEL 5 servers using QLogic HBAs and PowerPath. This post also assumes that you have put the qlogic utilities into /tmp/ql_utils.

To remove a LUN and all associated PowerPath and Linux devices from the host environment follow these steps. 

Note: that it is critical to follow the procedures in exact order because deviating from the procedures can cause the host to panic

These steps were put together using steps from QLogic KB articles.

1. Stop any I/O to the device being removed. [Unmount the filesystem ] It is critical to stop all I/O on the device that is being removed.

2. Run the following command to determine which native SCSI devices are mapped to the pseudo device:

powermt display dev=all

Find the name of the LUN to be removed and match it up with the emcpower device name. This will need to be done on each server individually.

3. Run the command:

powermt remove dev=emcpower

Where corresponds to the LUN to be removed.

4. Run the command:

powermt release

Failing to run this command results in the pseudo device still being visible in /dev and /sys/block and may lead to some complications when the new devices are dynamically added.

5. In the /tmp/ql_utils directory, there should be a script to rescan the qlogic hbas. The script is called ql-dynamic-tgt-lun-disc.sh. Run the script:

/tmp/ql_utils/ql-dynamic-tgt-lun-disc.sh

6. You will now remove the device from the storage array using your array admin utilities. On the Linux server, run powermt display to verify that the device has been removed.

7. Now remove the LUN from the Storage Group (CLARiiON) or unmap it from the FA ports (DMX).

Moving VG to another server

Moving a VG to another server:

To do this we use the vgexport and vgimport commands.

vgexport and vgimport is not necessary to move disk drives from one server to another. It is an administrative policy tool to prevent access to volumes in the time it takes to move them.

1. Unmount the file system
First, make sure that no users are accessing files on the active volume, then unmount it

# unmount /appdata

2.Mark the volume group inactive
Marking the volume group inactive removes it from the kernel and prevents any further activity on it.

# vgchange -an appvg
vgchange -- volume group "appvg" successfully deactivate



3. Export the volume group

It is now must to export the volume group. This prevents it from being accessed on the old server and prepares it to be removed.

# vgexport appvg
vgexport -- volume group "appvg" successfully exported

Now, When the machine is next shut down, the disk can be unplugged and then connected to it's new machine

4. Import the volume group

When it plugged into the new server, it becomes /dev/sdc (depends).

so an initial pvscan shows:

# pvscan
pvscan -- reading all physical volumes (this may take a while...)
pvscan -- inactive PV "/dev/sdc1" is in EXPORTED VG "appvg" [996 MB / 996 MB free]
pvscan -- inactive PV "/dev/sdc2" is in EXPORTED VG "appvg" [996 MB / 244 MB free]
pvscan -- total: 2 [1.95 GB] / in use: 2 [1.95 GB] / in no VG: 0 [0]

We can now import the volume group (which also activates it) and mount the file system.

If you are importing on an LVM 2 system, run:

# vgimport appvg
Volume group "vg" successfully imported

5. Activate the volume group

You must activate the volume group before you can access it.

# vgchange -ay appvg

Mount the file system

# mkdir -p /appdata
# mount /dev/appvg/appdata /appdata

The file system is now available for use

LVM on Service Guard

LVM ON SERVICE GUARD CLUSTERS

To copy the mapping of the Volume group file
# vgexport -p -s -m <map_file_name> /dev/vg_name 
To import the VG using the map data
# mkdir /dev/vg_name  # mknod /dev/vg_name/group c 64 0xXX0000  # vgimport -s -m <map_file_name> /dev/vg_name 
To manually activate a VG under Service Guard control
# vgchange -c n <vg_name>  # vgchange -a y <vg_name> 
To Bring back the VG under Service Guard control
# vgchange -a n <vgname>  # vgchange -c y <vgname>

Tech Tips

Make your own
Blogger Tips and TricksLatest Tips And TricksBlogger Tricks