Search This Blog

Saturday, August 30, 2014

vPars Monitor and partition database

vPars Monitor and partition database
With or without vPars, the firmware loads and launches ISL or EFI. In a server without vPars, from ISL or EFI, the loader hpux or hpux.efi loads the kernel /stand/vmunix:

PA-RISC
ISL> hpux /stand/vmunix
Integrity
HPUX> boot vmunix

However, in a server with vPars, from the loader (hpux or hpux.efi) loads the vPars Monitor (/stand/vpmon):
PA-RISC
ISL> hpux /stand/vpmon
Integrity
HPUX> boot vpmon

Single User Mode
On a vPars server, you can boot a virtual partition into single-user mode either at the monitor prompt or at the shell prompt of a running partition.

For example, if we wanted to boot node2 into single user mode:

From MON> From the monitor prompt, specify the -is option as an argument to vparload.

MON> vparload -p node2 -o "-is"

From the shell prompt of another virtual partition, specify the -o option with the vparboot command:

node1# vparboot -p node2 -o "-is"

NOTE: To boot a virtual partition, the partition must be in the down state. If the partition is in the hung state, perform the following before executing the vparboot:

Turn off autoboot for the target partition:

node1# vparmodify -p node2 -B manual

Attempt to reset the target partition with the -t option (soft reset):

node1# vparreset -p node2 -t


If it still appears to be hung, reset it with the -h option (hard reset):

node1# vparreset -p node2 -h

Continue verifying the state until vparstatus shows that node2 is in the down state:

node1# vparstatus -p node2 -v | grep -E "Name|State"
Name: node2
State: down

After you have entered into single-user mode and if you want to turn autoboot back on, the command is:

node1# vparmodify -p node2 -B auto

Maintenance Mode
When troubleshooting LVM, you may need to enter into maintenance mode using the -lm option. For more information on maintenance mode, see the book "Managing Systems and Workgroups."

On a vPars server, you specify the -lm option but as an argument to either the monitor vparload command or as a -o option to the shell vparboot command.

For example, if the partition node2 is down, to boot node2 into maintenance mode:

From MON> From the monitor prompt:

MON> vparload -p node2 -o "-lm"

From shell prompt From the running partition node1:

node1# vparboot -p node2 -o "-lm"

Overriding Quorum
In LVM, when the root disk is mirrored, the server can only activate the root volume group, which contains the OS instance, when the majority of the physical volumes in a root volume group are present at boot time. This is called establishing a quorum. Sometimes, you may want to boot an OS instance regardless of whether a quorum is established. You can override the quorum requirement by using the -lq option. For more information on quorums, see the book "Managing Systems and Workgroups."

On a vPars server, you can execute either of the following:
From MON> From the monitor prompt, to boot node2 overriding the quorum requirement:

MON> vparload -p node2 -o "-lq"

From shell prompt From the running virtual partition node1, to boot node2 overriding the quorum requirement:

node1# vparboot -p node2 -o "-lq"

From the running virtual partition node1, to modify node2 to override the quorum requirement when booting:

node1# vparmodify -p vpar1 -o "-lq" 

In a vpar server, the mkboot command is not useful as the quorum override is handled by the vPars Monitor database. The AUTO file is no read when a vpar is booting. The only time the AUTO file is read, is when the server or nPar is booting, just before loading the vPar Monitor.

NOTE: Specifying the boot options from the command line only affects the current boot. On a non-vPars server, to have a server permanently boot with the -lq option, you would put "hpux -lq" in the LIF AUTO file. On a vPars server, to have a partition boot with the -lq option, you would simulate the AUTO file usage by entering the -lq option into the partition database. See “Simulating the AUTO File on a Virtual Partition” in vPars Manual.


Thursday, August 28, 2014

Site Awareness

What are remote mirroring and site awareness? In a remote mirror configuration, SF hosts and the storage are distributed to two or more sites. These sites are typically connected via a redundant high-capacity network (Fiber Channel or Dense Wavelength Division Multiplexing) that provides access to storage. The disk groups include disks from all sites and volumes are created with a mirror at each site.

To verify that you have the Site Awareness feature enabled, use the following command:
root@desap2ia:/root# vxlicrep |grep -i site
   Site License                        = YES
   Site License                        = YES
   Site License                        = YES
   Site Awareness                      = Enabled
   Site License                        = YES
   Site License                        = YES

Configuring Site Awareness              
1)       Assign the physical resources (hosts and disks) to a site.
2)       Configure site-based allocation on a diskgroup
3)       Configure site consistency on the diskgroup and the volumes
4)       Set mirrored volumes read policy to site-based (if necessary)
5)       Use site-based storage allocation when creating new volumes.

Assigning disk to a site:

To assign a disk to a site:

#vxdisk [-g diskgroup] settag site=sitename [disk|e:enclosure] [disk|e:enclosure]…

#vxdisk –g datadg settag site=siteA emc0_1 emc0_2
#vxdisk settag apevmx09_111d site=site09

Or

# vxdisk –g datadg settag site=siteA e:emc0


To list the site tags on a disk:

# vxdisk [-g diskgroup] listtag


root@desap2ia:/root# vxdisk -g sapz42_dg listtag
DEVICE          NAME                            VALUE                             
apevmx09_07fe   site                            site09
apevmx09_07ff   site                            site09
apevmx09_08f1   site                            site09
apevmx09_11a2   site                            site09
apevmx09_11a3   site                            site09
apevmx09_111d   site                            site09
apevmx09_111e   site                            site09
apevmx09_0262   site                            site09
apevmx09_0800   site                            site09
apevmx09_0802   site                            site09
apevmx10_01ca   site                            site10
apevmx10_07e3   site                            site10
apevmx10_07e4   site                            site10
apevmx10_10d4   site                            site10
apevmx10_0701   site                            site10
apevmx10_0702   site                            site10
apevmx10_1047   site                            site10
apevmx10_1048   site                            site10
apevmx10_1059   site                            site10
apevmx10_1070   site                            site10
apevmx10_1071   site                            site10



To remove the site tag from a disk:

#vxdisk [-g diskgroup] rmtag site=sitename [disk|e:enclosure]


Assigning host to a site


To assign a host to a site
# vxdctl set site=sitename
# vxdctl set site=siteA


To observe the site assignment of a host:
# vxdctl list|grep siteid
Siteid: siteA


To more the site name from a host:
#vxdctl [-F] unset site

-F Use the force option if imported disk groups are registered to the site.

Configuring site-based allocation on a disk group

To add site definition to a disk group configuration:
#vxdg –g diskgroup addsite sitename

For Example:
#vxdg –g datadg addsite siteA
#vxdg –g datadg addsite siteB

·          A new volume is automatically mirrored across all sites
·          The volume’s read policy is automatically set to siteread
·          Use allsites=off with vxassist make for non-default configuraiton

To remove a site from the disk group configuration:
#vxdg –g diskgroup rmsite sitename

·          No change is made to the physical resources that are assigned to that site.
·          You must use the force option (-f) if the site is detached.


Enabling site consistency in a disk group Site consistency in a disk group means that the data at each site is guaranteed to be consistent. Therefore, any disk failure in a site-consistent disk group that causes one of the volumes to be left without a complete plex causes the site to be detached. To enable fast resynchronization of volumes when the site is reattached, the volumes are created with the FastResync feature enabled and an instant snap DCO volume by default.

When you turn on site consistency in a disk group:
·          By Default, new volumes are created as site-consistent.
·          Existing volumes are not impacted.
·          Disk group configuration copy is placed across sites

To Set site consistency in a disk group:
#vxdg –g diskgroup set siteconsistent=on


To set site consistency on an existing volume:
#vxsnap –g diskgroup prepare volume
#vxvol –g diskgroup set siteconsistent=on volume

To turn off site consistency:
#vxvol –g diskgroup set siteconsistent=off volume
#vxdg –g diskgroup set siteconsistent=off

Read policy in a site-consistent setup
The siteread policy:
·          Is available with SF5.0 and later
·          Instructs each host to read data only from local plexes, provided that local plexes are available.
·          Is the default policy if site-based allocation is enabled.

To manually set the read policy to siteread, run the following command:
#vxvol –g diskgroup rdpol siteread volume



File System Size Before Extension:

root@desap2ia:/usr/sap/Z42/sapdata999# df -k .
Filesystem    1024-blocks      Free %Used    Iused %Iused Mounted on
/dev/vx/dsk/sapz42_dg/usrsapTMP    20971520  16315608   23%     5230     1% /usr/sap/Z42/sapdata999

We need to observe the following things:
1) The READPOL should be SITEREAD
2) Three Plex Should there
3) Check the length of Log Plex

root@desap2ia:/usr/sap/Z42/sapdata999# vxprint -htg sapz42_dg usrsapTMP
V  NAME         RVG/VSET/CO  KSTATE   STATE    LENGTH   READPOL   PREFPLEX UTYPE
PL NAME         VOLUME       KSTATE   STATE    LENGTH   LAYOUT    NCOL/WID MODE
SD NAME         PLEX         DISK     DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
SV NAME         PLEX         VOLNAME  NVOLLAYR LENGTH   [COL/]OFF AM/NM    MODE
SC NAME         PLEX         CACHE    DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
DC NAME         PARENTVOL    LOGVOL
SP NAME         SNAPVOL      DCO
EX NAME         ASSOC        VC                       PERMS    MODE     STATE
SR NAME         KSTATE

v  usrsapTMP    -            ENABLED  ACTIVE   41943040 SITEREAD  -        fsgen
pl usrsapTMP-01 usrsapTMP    ENABLED  ACTIVE   41943040 CONCAT    -        RW
sd sapz42_05-01 usrsapTMP-01 sapz42_05 0       41943040 0         apevmx09_08f1 ENA
pl usrsapTMP-02 usrsapTMP    ENABLED  ACTIVE   41943040 CONCAT    -        RW
sd sapz42_05m-01 usrsapTMP-02 sapz42_05m 0     41943040 0         apevmx10_1059 ENA
pl usrsapTMP-03 usrsapTMP    ENABLED  ACTIVE   LOGONLY  CONCAT    -        RW
sd sapz42_drl1-19 usrsapTMP-03 sapz42_drl1 26000 1040   LOG       apevmx10_10d4 ENA

Before Extending volume Remove Log Plex:

root@desap2ia:/usr/sap/Z42/sapdata999# vxassist -g sapz42_dg remove log usrsapTMP

root@desap2ia:/usr/sap/Z42/sapdata999# vxprint -htg sapz42_dg usrsapTMP         
V  NAME         RVG/VSET/CO  KSTATE   STATE    LENGTH   READPOL   PREFPLEX UTYPE
PL NAME         VOLUME       KSTATE   STATE    LENGTH   LAYOUT    NCOL/WID MODE
SD NAME         PLEX         DISK     DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
SV NAME         PLEX         VOLNAME  NVOLLAYR LENGTH   [COL/]OFF AM/NM    MODE
SC NAME         PLEX         CACHE    DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
DC NAME         PARENTVOL    LOGVOL
SP NAME         SNAPVOL      DCO
EX NAME         ASSOC        VC                       PERMS    MODE     STATE
SR NAME         KSTATE

v  usrsapTMP    -            ENABLED  ACTIVE   41943040 SITEREAD  -        fsgen
pl usrsapTMP-01 usrsapTMP    ENABLED  ACTIVE   41943040 CONCAT    -        RW
sd sapz42_05-01 usrsapTMP-01 sapz42_05 0       41943040 0         apevmx09_08f1 ENA
pl usrsapTMP-02 usrsapTMP    ENABLED  ACTIVE   41943040 CONCAT    -        RW
sd sapz42_05m-01 usrsapTMP-02 sapz42_05m 0     41943040 0         apevmx10_1059 ENA
          

Storage Team has provided the below Disk


apevmx09_111d auto:none -          -          online invalid
apevmx09_111e auto:none -          -          online invalid
apevmx10_1070 auto:none -          -          online invalid
apevmx10_1071 auto:none -          -          online invalid  

# vxdisksetup -i apevmx09_111d
# vxdisksetup -i apevmx09_111e
# vxdisksetup -i apevmx10_1070
# vxdisksetup -i apevmx10_1071

Checking how the site read is configured

root@desap2ia:/tmp# vxdisk -g sapz42_dg listtag
DEVICE          NAME                            VALUE                             
apevmx09_07fe   site                            site09
apevmx09_07ff   site                            site09
apevmx09_08f1   site                            site09
apevmx09_0800   site                            site09
apevmx09_0802   site                            site09
apevmx10_07e3   site                            site10
apevmx10_07e4   site                            site10
apevmx10_10d4   site                            site10
apevmx10_0701   site                            site10
apevmx10_0702   site                            site10
apevmx10_1059   site                            site10

Disk from Enclousre apevmx09 is configured for site09
Disk from Enclousre apevmx10 is configured for site10

so we need to tag the disk as per site

cb20cpsdbpre# vxdisk settag apevmx09_111d site=site09
cb20cpsdbpre# vxdisk settag apevmx09_111e site=site09
cb20cpsdbpre# vxdisk settag apevmx10_1070 site=site10
cb20cpsdbpre# vxdisk settag apevmx10_1071 site=site10

# vxdg -g usrsapTMP adddisk sapz42_06=apevmx09_111d
# vxdg -g usrsapTMP adddisk sapz42_07=apevmx09_111e
# vxdg -g usrsapTMP adddisk sapz42_06m=apevmx10_1070
# vxdg -g usrsapTMP adddisk sapz42_07m=apevmx10_1071


Calculating the space upto which we could extend the volume using the disk

# vxassist -g sapz42_dg maxgrow usrsapTMP layout=mirror-concat alloc=sapz42_06 sapz42_06m

Extending the Volume

root@desap2ia:/tmp# /etc/vx/bin/vxresize -g sapz42_dg -F vxfs usrsapTMP +40g alloc=sapz42_06 sapz42_06m
root@desap2ia:/tmp#  vxprint -htg sapz42_dg usrsapTMP
V  NAME         RVG/VSET/CO  KSTATE   STATE    LENGTH   READPOL   PREFPLEX UTYPE
PL NAME         VOLUME       KSTATE   STATE    LENGTH   LAYOUT    NCOL/WID MODE
SD NAME         PLEX         DISK     DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
SV NAME         PLEX         VOLNAME  NVOLLAYR LENGTH   [COL/]OFF AM/NM    MODE
SC NAME         PLEX         CACHE    DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
DC NAME         PARENTVOL    LOGVOL
SP NAME         SNAPVOL      DCO
EX NAME         ASSOC        VC                       PERMS    MODE     STATE
SR NAME         KSTATE

v  usrsapTMP    -            ENABLED  ACTIVE   125829120 SITEREAD -        fsgen
pl usrsapTMP-01 usrsapTMP    ENABLED  ACTIVE   125829120 CONCAT   -        RW
sd sapz42_05-01 usrsapTMP-01 sapz42_05 0       41943040 0         apevmx09_08f1 ENA
sd sapz42_06-01 usrsapTMP-01 sapz42_06 0       83886080 41943040  apevmx09_111d ENA
pl usrsapTMP-02 usrsapTMP    ENABLED  ACTIVE   125829120 CONCAT   -        RW
sd sapz42_05m-01 usrsapTMP-02 sapz42_05m 0     41943040 0         apevmx10_1059 ENA
sd sapz42_06m-01 usrsapTMP-02 sapz42_06m 0     83886080 41943040  apevmx10_1070 ENA
root@desap2ia:/tmp#

Adding Drl Logs Back:

To add DRL logs to an existing volume, use the following command:
# vxassist [-b] [-g diskgroup] addlog volume logtype=drl \   [nlog=n] [loglen=size]

# vxassist -b -g sapz42_dg addlog usrsapTMP logtype=drl nlog=1 loglen=1040 alloc=sapz42_drl1

root@desap2ia:/etc/vx/bin# vxassist -b -g sapz42_dg addlog usrsapTMP logtype=drl nlog=1 loglen=1040 alloc=sapz42_drl1
root@desap2ia:/etc/vx/bin# vxprint -htg sapz42_dg usrsapTMP
V  NAME         RVG/VSET/CO  KSTATE   STATE    LENGTH   READPOL   PREFPLEX UTYPE
PL NAME         VOLUME       KSTATE   STATE    LENGTH   LAYOUT    NCOL/WID MODE
SD NAME         PLEX         DISK     DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
SV NAME         PLEX         VOLNAME  NVOLLAYR LENGTH   [COL/]OFF AM/NM    MODE
SC NAME         PLEX         CACHE    DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
DC NAME         PARENTVOL    LOGVOL
SP NAME         SNAPVOL      DCO
EX NAME         ASSOC        VC                       PERMS    MODE     STATE
SR NAME         KSTATE

v  usrsapTMP    -            ENABLED  ACTIVE   125829120 SITEREAD -        fsgen
pl usrsapTMP-01 usrsapTMP    ENABLED  ACTIVE   125829120 CONCAT   -        RW
sd sapz42_05-01 usrsapTMP-01 sapz42_05 0       41943040 0         apevmx09_08f1 ENA
sd sapz42_06-01 usrsapTMP-01 sapz42_06 0       83886080 41943040  apevmx09_111d ENA
pl usrsapTMP-02 usrsapTMP    ENABLED  ACTIVE   125829120 CONCAT   -        RW
sd sapz42_05m-01 usrsapTMP-02 sapz42_05m 0     41943040 0         apevmx10_1059 ENA
sd sapz42_06m-01 usrsapTMP-02 sapz42_06m 0     83886080 41943040  apevmx10_1070 ENA
pl usrsapTMP-03 usrsapTMP    ENABLED  ACTIVE   LOGONLY  CONCAT    -        RW
sd sapz42_drl1-09 usrsapTMP-03 sapz42_drl1 9360 1040    LOG       apevmx10_10d4 ENA


FS Size before Extension
root@desap2ia:/usr/sap/Z42/sapdata999# df -k .
Filesystem    1024-blocks      Free %Used    Iused %Iused Mounted on
/dev/vx/dsk/sapz42_dg/usrsapTMP    20971520  16315608   23%     5230     1% /usr/sap/Z42/sapdata999

FS Size After Exetension
root@desap2ia:/tmp# df -k /usr/sap/Z42/sapdata999
Filesystem    1024-blocks      Free %Used    Iused %Iused Mounted on
/dev/vx/dsk/sapz42_dg/usrsapTMP    62914560  55627570   12%     5231     1% /usr/sap/Z42/sapdata999




What could be the issue, if we are not tagging the disk with respect to site:
Disk used without SITEREAD
root@desap2ia:/etc/vx/bin# vxassist -g sapz42_dg maxsize usrsapz42_ext_vol layout=mirror-concat alloc="sapz42_08 sapz42_08m"
VxVM vxassist INFO V-5-1-13775 Site consistent volumes use new dco log types (dcoversion=20). Creating it by default.
VxVM vxassist ERROR V-5-1-325 dm:usrsapz42_ext_vol: No disks match specification

Disk with tag SITEREAD
root@desap2ia:/etc/vx/bin# vxdg -g sapz42_dg adddisk sapz42_09m=apevmx10_1048
root@desap2ia:/etc/vx/bin# vxassist -g sapz42_dg maxgrow usrsapz42_ext_vol layout=mirror-concat alloc="sapz42_08 sapz42_08m"
Volume usrsapz42_ext_vol can be extended by 251582464 to: 725389312 (354194Mb)



Saturday, August 16, 2014

Unix Command: screen

I guess you all know this: you are connected to your server with SSH and in the middle of compiling some software (e.g. a new kernel) or doing some other task, which takes lots of time, and suddenly your connection drops for some reason, and you lose your labour. This can be very annoying, but fortunately there is a small utility called screen which lets you reattach to a previous session so that you can finish your task. This short tutorial shows how to use screen for just this purpose.

Benefits of Screen Command:

1)  Remote terminal session management (detaching or sharing terminal sessions)
2)  unlimited windows
3)  scroll back buffer
4)  copy/paste between windows
5)  notification of either activity or inactivity in a window
6)  split terminal (horizontally and vertically) into multiple regions
7)  locking other users out of terminal


Starting Screen
Screen is started from the command line just like any other command:

[root@office ~]# screen
You are now inside of a window within screen. This functions just like a normal shell except for a few special characters.

Command: “Ctrl-a”
Screen uses the command “Ctrl-a” that is the control key and a lowercase “a” as a signal to send commands to screen instead of the shell.
For example, “Ctrl-a” then “?”. You should now have the screen help page.

  Screen key bindings, page 1 of 1.

                         Command key:  ^A   Literal ^A:  a

break       ^B b       fit         F          lastmsg     ^M m       number      N          redisplay   ^L l       suspend     ^Z z       writebuf    >        
clear       C          flow        ^F f       license     ,          only        Q          remove      X          time        ^T t       xoff        ^S s     
colon       :          focus       ^I         lockscreen  ^X x       other       ^A         removebuf   =          title       A          xon         ^Q q     
copy        ^[ [       hardcopy    h          log         H          pow_break   B          reset       Z          vbell       ^G       
detach      ^D d       help        ?          login       L          pow_detach  D          screen      ^C c       version     v        
digraph     ^V         history     { }        meta        a          prev        ^H ^P p ^? select      '          width       W        
displays    *          info        i          monitor     M          quit        \          silence     _          windows     ^W w     
dumptermcap .          kill        K k        next        ^@ ^N sp n readbuf     <          split       S          wrap        ^R r     

^]  paste .
"   windowlist -b
-   select -
0   select 0
1   select 1
2   select 2
3   select 3
4   select 4
5   select 5
6   select 6
7   select 7
8   select 8
9   select 9
I   login on
O   login off
]   paste .


Key bindings are the commands the screen accepts after you hit “Ctrl-a”. You can reconfigure these keys to your liking using a .screenrc file, but I just use the defaults.

Creating Windows

Command: “Ctrl-a” “c”.
To create a new window, you just use “Ctrl-a” “c”.
This will create a new window for you with your default prompt.  Your old window is still active.
For example, I can be running “top” or “sleep 1000” and then open a new window to do other things. Top stays running! It is still there. To try this for yourself, start-up screen and then run top. (Note: I have truncated some screens to save space.)
Start top
Load averages: 0.04, 0.04, 0.05
273 processes: 203 sleeping, 70 running
Cpu states:
CPU   LOAD   USER   NICE    SYS   IDLE  BLOCK  SWAIT   INTR   SSYS
 0    0.04   0.4%   0.0%   0.2%  99.4%   0.0%   0.0%   0.0%   0.0%
 1    0.03   0.0%   0.0%   1.2%  98.8%   0.0%   0.0%   0.0%   0.0%
 2    0.05   0.0%   0.0%   0.0% 100.0%   0.0%   0.0%   0.0%   0.0%
 3    0.03   0.6%   0.0%   2.7%  96.7%   0.0%   0.0%   0.0%   0.0%
---   ----  -----  -----  -----  -----  -----  -----  -----  -----
avg   0.04   0.2%   0.0%   1.0%  98.8%   0.0%   0.0%   0.0%   0.0%

Now open a new window with "Ctrl-a” “c”
Your top window is still running you just have to switch back to it.

Switching Between Windows

Command: “Ctrl-a” “n”
Screen allows you to move forward and back. In the example above, you could use “Ctrl-a “n” to get back to top. This command switches you to the next window.
The windows work like a roundabout and will loop back around to your first window.
You can create several windows and toggle through them with “Ctrl-a” “n” for the next window or “Ctrl-a” “p” for the previous window.
Each process will keep running until you kill that window.
You could also use:
# “Ctrl-a” “Ctrl-a”   # Toggle / switch between the current and previous window
# “Ctrl-a” “0-9”      #Go to a window numbered 0 9, “Ctrl-a” “w” to see number
# “Ctrl-a” “Spacebar” #Go to next Terminal
# “Ctrl-a” “Backspace”      #Come back to previous terminal

 

 

Detaching From Screen

Command: "Ctrl-a" "d"
Detaching is the most powerful part of screen.  Screen allows you to detach from a window and reattach later.
If your network connection fails, screen will automatically detach your session!
You can detach from the window using “Ctrl-a” “d”.
This will drop you into your shell.
All screen windows are still there and you can re-attach to them later.
This is great when you are using rsync for server migration or during something, which you forget to keep in nohup.

bash-4.1$
[detached]

Reattach to Screen

If your connection drops or you have detached from a screen, you can re-attach by just running:

[jeffh@office ~]$ screen -r



This will re-attach to your screen.
However, if you have multiple screens you may get this:

ibhagat@office#screen -r
There are several suitable screens on:
        16076.pts-26.office   (Attached)
        2917.pts-142.office   (Detached)
        16873.pts-16.office   (Detached)
        4945.pts-13.office    (Attached)
Type "screen [-d] -r [pid.]tty.host" to resume one of them.

If you get this, just specify the screen you want.

[jeffh@office ~]$ screen -r  16873.pts-16.office

Logging Your Screen Output

I find it important to keep track of what I do to someone’s server. Fortunately, screen makes this easy.
Using “Ctrl-a” “H”, creates a running log of the session.
A file named “screenlog.0” will be created in your home directory.
Screen will keep appending data to the file through multiple sessions. Using the log function is very useful for capturing what you have done, especially if you are making many changes. If something goes awry, you can look back through your logs.

Getting Alerts

Screen can monitor a window for activity or inactivity. This is great if you are downloading large files, compiling, or waiting for output.
If you are waiting for output from a long running program, you can use “Ctrl-a” “M” to look for activity. Screen will then flash an alert at the bottom of the page when output is registered on that screen.

I use this when running a command that takes a long time to return data. I can just fire up the command, switch to another window and not have to keep switching back to check the status.

You can also monitor for inactivity. Why use this?

If you are downloading a large file or compiling a program, you can be notified when there is no more output. This is a great signal to when that job is done. To monitor for silence or no output use “Ctrl-A” “_”.

Locking Your Screen Session

If you need to step away from your computer for a minute, you can lock your screen session using "Ctrl-a" "x".  This will require a password to access the session again.

bash-4.1$            
Screen used by Indrajit Bhagat <ibhagat>.
Password:

Stopping Screen

When you are done with your work, I recommend you stop the session instead of saving it for later.  To stop screen you can usually just type exit from your shell. This will close that screen window.  You have to close all screen windows to terminate the session.
You should get a message about screen being terminated once you close all windows.

[screen is terminating]

Alternatively, you can use "Ctrl-a" "k".  You should get a message if you want to kill the screen.

Quit Screen:

Used “Ctrl-a Ctrl+\”

Setting the title of the Screen:
To start a new screen with a specific name, you could provide the name as below:

# screen –t foo
Num Name                                      Flags

  0 bash                                      $
  1 bash                                      $
  2 bash                                      $
  3 foo                                       $

To rename or to give name to existing screen, use the below command:

# “Ctrl-a :title foo”

Listing Screen Window:
# “Ctrl-a” “w”  #List all windows (the current window is marked with "*")

0$bash  1$ bash  2-$ bash  3*$ foo

Also
#”Ctrl+a” “ ” ” #List all window


Num Name                                      Flags

  0 bash                                      $
  1 bash                                      $
  2 bash                                      $
  3 foo                                       $
Using the screen as terminal multiplexer
# “Ctrl-a” “i”  #To Split the svreen vertically
# “Ctrl-a” “S”   #To Split the screen horizontally
# “Ctrl-a” “Q”   #To unsplit
Note: After splitting, you need to go into the new region and start a new session via ctrla then cbefore you can use that area.

To copy a block

To get into copy mode, press Ctrl-a [ .
To move the cursor, press the h, j, k, and l (the letter l) keys. The 0 (the number 0) or ^ (the caret) moves to the start of the line and $ (the dollar sign) moves to the end of the line. Ctrl-b scrolls the cursor back one page and Ctrl-f scrolls forward one page. To set the left and right margins of copy, press c and C (Shift-c). The Spacebar starts selecting the text and ends selecting the text. To abort copy mode, press Ctrl-g.

To paste a block

To paste the copied text to the current window (as many times as you want), press Ctrl-a ].