Monday, April 25, 2016

Solaris10 - LDOM - unable to login

LDOM_interface_not-working-ssh-not-responding

User complain, they can't login,
I tried to login, but I could not login. Ping not responding. Login through the console, and server was on up state. Checked ssh service, ok and running. interface up.
ping gateway, good. tried to ssh to outside, I can ssh to control domain and other server on the same subnet.

Checked the subnetmask and it was different. Nothing has ever been changed. Server is up for 66 days, nothing changed.
Surprise... I assigned the ip with correct mask and I am able to ping, and ssh to it. But it keep timeout after login into in less than 30 second. no message says what
really happened.
restart network and ssh, it start disconnecting in between 1-2 minutes. Interesting. Checked configuration on Control domain, interface and other virtual server on the
same interface are working just fine.
Requested to reboot the server.
server came up fine with correct ip and subnetmask but issue still the same. keep disconnecting within 2 minutes.
Went to control domain and assign a new interface from different physical interface. Pointed out the ip to new interface and started network services. It simply start
working fine since then. Interesting ....

1. Verify netmask info
# cat /etc/netmask
#
#
192.168.102.0    255.255.255.128
2. You have wrong netmask of ff000000
[root@sdmr-mw-v02]# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
vnet0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.102.104 netmask ff000000 broadcast 10.255.255.255
        ether 0:14:4f:fa:c2:63
3. Reassign ip address Using correct mask
[root@my-ldm-v02]#  ifconfig vnet0 192.168.102.104 netmask 255.255.255.128 up
[root@my-ldm-v02]#
[root@my-ldm-v02]# ssh 192.168.102.105
ssh: connect to host 192.168.102.105 port 22: Connection refused
[root@my-ldm-v02]# svcs -a | grep ssh
online         Feb_18   svc:/network/ssh:default
[root@my-ldm-v02]# svcadm refresh  svc:/network/ssh:default
[root@my-ldm-v02]#  svcs -a | grep ssh
online          9:29:50 svc:/network/ssh:default
[root@my-ldm-v02]#
4. Now, shows the correct subnet mask.
[root@my-ldm-v02]# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
vnet0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.102.104 netmask ffffff80 broadcast 192.168.102.127
        ether 0:14:4f:fa:c2:63
[root@my-ldm-v02]# Apr 25 09:31:55 my-ldm-v02 sshd[29729]: fatal: Read from socket failed: Connection re                                                                  
                                                                set by peer
[root@my-ldm-v02]# ls -l /etc/netmasks
lrwxrwxrwx   1 root     root          15 May 17  2013 /etc/netmasks -> ./inet/netmasks
[root@my-ldm-v02]# Apr 25 09:34:54 my-ldm-v02 sshd[29597]: monitor fatal: Timeout before authentication
Apr 25 09:39:18 my-ldm-v02 sshd[29693]: monitor fatal: Timeout before authentication for 172.16.250.223
[root@my-ldm-v02]#
[root@my-ldm-v02]# svcs -a | grep -i physical
online         Feb_18   svc:/network/physical:default
[root@my-ldm-v02]# svcadm restart  svc:/network/physical:default
[root@my-ldm-v02]# Apr 25 09:42:21 my-ldm-v02 sudo:  kbhusal : TTY=pts/4 ; PWD=/export/home/kbhusal ; US                                                                  
                                                                ER=root ; COMMAND=/usr/bin/su -
Apr 25 09:42:21 my-ldm-v02 su: 'su root' succeeded for kbhusal on /dev/pts/4
[root@my-ldm-v02]#
[root@my-ldm-v02]# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
vnet0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.102.104 netmask ffffff80 broadcast 192.168.102.127
        ether 0:14:4f:fa:c2:63
6. Still problem to ssh to the host. rebooting
[root@my-ldm-v02]# init 6
[root@my-ldm-v02]# svc.startd: The system is coming down.  Please wait.
svc.startd: 85 system services are now being stopped.
syncing file systems... done
rebooting...
Resetting...

7. After reboot, verify ip/mask.
[root@my-ldm-v02]# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
vnet0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.102.104 netmask ffffff80 broadcast 192.168.102.127
        ether 0:14:4f:fa:c2:63
[root@my-ldm-v02]#

[root@my-ldm-v02]# netstat -in
Name  Mtu  Net/Dest      Address        Ipkts  Ierrs Opkts  Oerrs Collis Queue
lo0   8232 127.0.0.0     127.0.0.1      1894   0     1894   0     0      0
vnet0 1500 192.168.102.0  192.168.102.104 18369  0     4788   0     0      0


8. Still problem, Now decided to add new vnet to the LDOM from different interface card.
Login to control domain add a vnet - NIC
Added new interface from different interface
[root@physical_serv-p01]# ldm add-vnet vnet2 primary-vsw3 my-ldm-v02
[root@physical_serv-p01]# ldm rm-vnet vnet2 my-ldm-v02
[root@physical_serv-p01]# ldm add-vnet vnet1 primary-vsw3 my-ldm-v02
[root@physical_serv-p01]#

9. Now, Login to LDOM and bring down the old interface and bring up the new one.
[root@my-ldm-v02]# ifconfig vnet1 plumb

[root@my-ldm-v02]# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
vnet0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.102.104 netmask ffffff80 broadcast 192.168.102.127
        ether 0:14:4f:fa:c2:63
[root@my-ldm-v02]# ifconfig vnet1 plumb
[root@my-ldm-v02]# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
vnet0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.102.104 netmask ffffff80 broadcast 192.168.102.127
        ether 0:14:4f:fa:c2:63
vnet1: flags=1000842<BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3
        inet 0.0.0.0 netmask 0
        ether 0:14:4f:f9:92:70
[root@my-ldm-v02]# svcs -a | grep physical
[root@my-ldm-v02]# svcadm restart svc:/network/physical:default
[root@my-ldm-v02]# ifconfig vnet0 down
[root@my-ldm-v02]# ifconfig vnet1 up
[root@my-ldm-v02]# mv /etc/hostname.vnet0 /etc/hostname.vnet1
[root@my-ldm-v02]# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
vnet0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.102.104 netmask ffffff80 broadcast 192.168.102.127
        ether 0:14:4f:fa:c2:63
vnet1: flags=1000842<BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3
        inet 0.0.0.0 netmask 0
        ether 0:14:4f:f9:92:70
[root@my-ldm-v02]# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
vnet0: flags=1000842<BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.102.104 netmask ffffff80 broadcast 192.168.102.127
        ether 0:14:4f:fa:c2:63
vnet1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3
        inet 192.168.102.104 netmask ffffff80 broadcast 192.168.102.127
        ether 0:14:4f:f9:92:70
[root@my-ldm-v02]#
[root@my-ldm-v02]#
[root@my-ldm-v02]#  ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
vnet0: flags=1000842<BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.102.104 netmask ffffff80 broadcast 192.168.102.127
        ether 0:14:4f:fa:c2:63
vnet1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3
        inet 192.168.102.104 netmask ffffff80 broadcast 192.168.102.127
        ether 0:14:4f:f9:92:70
[root@my-ldm-v02]#


LOGINFROM=`who am i | cut -f2 -d"(" | cut -f1 -d")"`
# ifconfig vnet0 192.168.102.104 netmask 255.255.255.128 up

Binary Numbers Representation

Binary Numbers

Representation

Binary numbers and arithmetic let you represent any amount you want using just two digits: 0 and 1. Here are some examples:
Decimal 1 is binary 0001
Decimal 3 is binary 0011
Decimal 6 is binary 0110
Decimal 9 is binary 1001

Each digit "1" in a binary number represents a power of two, and each "0" represents zero:
0001 is 2 to the zero power, or 1
0010 is 2 to the 1st power, or 2
0100 is 2 to the 2nd power, or 4
1000 is 2 to the 3rd power, or 8.
When you see a number like "0101" you can figure out what it means by adding the powers of 2:
0101 = 0 + 4 + 0 + 1 = 5
1010 = 8 + 0 + 2 + 0 = 10
0111 = 0 + 4 + 2 + 1 = 7
Addition

Adding two binary numbers together is like adding decimal numbers, except 1 + 1 = 10 (in binary, that is), so you have to carry the one to the next column:
  0001
+ 0100
  ----
  0101 (no carries to get this)
  0001
+ 0001
  ----
  0010 (1 plus 1 is 10, carry the 1 to the next column)
  0011
+ 0011
  ----
  0110 (1 + 1 = 10, so carry; then 1 + 1 + 1 = 11, so carry again)
  0011
+ 0101
  ----
  1000 (carry in every column here)
Subtraction is harder. Don't worry about it.
Larger Numbers

Here are the numbers from 0 to 15, in binary:
0000 = 0
0001 = 1
0010 = 2
0011 = 3
0100 = 4
0101 = 5
0110 = 6
0111 = 7
1000 = 8
1001 = 9
1010 = 10
1011 = 11
1100 = 12
1101 = 13
1110 = 14
1111 = 15
To represent bigger whole numbers (integers), you need more bits -- more places in the binary number:
10000101 = 128 + 0 + 0 + 0 + 0 + 4 + 0 + 1 = 133.
That was 8 bits:
8 bits is usually called a "byte", and it's the size usually used to represent an alphabetic character -- "A" is 65, or 01000001
a "nybble" (a term seldom used) is 4 bits;
a "word" depends on the computer but is often 16 or 32 bits.

Some other terms you'll hear are:
kilobyte, which is 1024 bytes (1024 is 2 to the 10th power)
megabyte, which is roughly a million bytes.
Typical sizes for personal computer RAM (random access memory) are 4 to 16 megabytes, while hard disks now start around 150 megabytes. Since each byte can represent one character of the alphabet, that means a hard disk might hold something like 150 million characters, or 25 million words of "raw" text. Documents formatted in a word processor take up a lot more space, though, and the operating system and software usually fill at least 100 megabytes.
To represent real numbers, fractions, or very large numbers, binary systems use "floating point arithmetic." That's another topic.
Why Use 'Em?

For computers, binary numbers are great stuff because:
They are simple to work with -- no big addition tables and multiplication tables to learn, just do the same things over and over, very fast.
They just use two values of voltage, magnetism, or other signal, which makes the hardware easier to design and more noise resistant.

source:- http://binary-net.blogspot.com/

Saturday, April 23, 2016

LogFile - 04232016


Disk /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdc: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdd: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sde: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-root: 13.0 GB, 13002342400 bytes, 25395200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-swap: 4001 MB, 4001366016 bytes, 7815168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@sudhir log]# clear
[root@sudhir log]# fdisk -l | more

Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0009660b

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      976895      487424   83  Linux
/dev/sda2          976896    34203647    16613376   8e  Linux LVM

Disk /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdc: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdd: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sde: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-root: 13.0 GB, 13002342400 bytes, 25395200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-swap: 4001 MB, 4001366016 bytes, 7815168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@sudhir log]# echo "- - -" >/sys/
block/      bus/        class/      dev/        devices/    firmware/   fs/         hypervisor/ kernel/     module/    

power/
[root@sudhir log]# echo "- - -" >/sys/class/
ata_device/    block/         dmi/           input/         misc/          powercap/      rtc/           sound/         vc/
ata_link/      bluetooth/     graphics/      iommu/         msr/           power_supply/  scsi_device/   thermal/      

vtconsole/
ata_port/      bsg/           hidraw/        leds/          net/           ppdev/         scsi_disk/     tpm/          

watchdog/
backlight/     cpuid/         hwmon/         mdio_bus/      pci_bus/       raw/           scsi_generic/  tty/
bdi/           dma/           i2c-adapter/   mem/           pcmcia_socket/ rfkill/        scsi_host/     usbmon/
[root@sudhir log]# echo "- - -" >/sys/class/scsi_host/host
host0/ host1/ host2/ host3/ host4/ host5/ host6/
[root@sudhir log]# echo "- - -" >/sys/class/scsi_host/host0/scan
[root@sudhir log]# echo "- - -" >/sys/class/scsi_host/host1/scan
[root@sudhir log]# echo "- - -" >/sys/class/scsi_host/host[0-6]/scan
-bash: /sys/class/scsi_host/host[0-6]/scan: ambiguous redirect
[root@sudhir log]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0009660b

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      976895      487424   83  Linux
/dev/sda2          976896    34203647    16613376   8e  Linux LVM

Disk /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdc: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdd: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sde: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-root: 13.0 GB, 13002342400 bytes, 25395200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-swap: 4001 MB, 4001366016 bytes, 7815168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@sudhir log]# man fdisk
[root@sudhir log]# fdisk -cu /dev/sdb
Usage:
 fdisk [options] <disk>    change partition table
 fdisk [options] -l <disk> list partition table(s)
 fdisk -s <partition>      give partition size(s) in blocks

Options:
 -b <size>             sector size (512, 1024, 2048 or 4096)
 -c[=<mode>]           compatible mode: 'dos' or 'nondos' (default)
 -h                    print this help text
 -u[=<unit>]           display units: 'cylinders' or 'sectors' (default)
 -v                    print program version
 -C <number>           specify the number of cylinders
 -H <number>           specify the number of heads
 -S <number>           specify the number of sectors per track

[root@sudhir log]# fdisk -c /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x165fd3f0.

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-4194303, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-4194303, default 4194303): +500M
Partition 1 of type Linux and of size 500 MiB is set

Command (m for help): p

Disk /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x165fd3f0

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     1026047      512000   83  Linux

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p):
Using default response p
Partition number (2-4, default 2):
First sector (1026048-4194303, default 1026048): +500M
Value out of range.
First sector (1026048-4194303, default 1026048):
Using default value 1026048
Last sector, +sectors or +size{K,M,G} (1026048-4194303, default 4194303): +500M
Partition 2 of type Linux and of size 500 MiB is set

Command (m for help): p

Disk /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x165fd3f0

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     1026047      512000   83  Linux
/dev/sdb2         1026048     2050047      512000   83  Linux

Command (m for help): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p):
Using default response p
Partition number (3,4, default 3):
First sector (2050048-4194303, default 2050048):
Using default value 2050048
Last sector, +sectors or +size{K,M,G} (2050048-4194303, default 4194303): +500M
Partition 3 of type Linux and of size 500 MiB is set

Command (m for help): p

Disk /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x165fd3f0

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     1026047      512000   83  Linux
/dev/sdb2         1026048     2050047      512000   83  Linux
/dev/sdb3         2050048     3074047      512000   83  Linux

Command (m for help): n
Partition type:
   p   primary (3 primary, 0 extended, 1 free)
   e   extended
Select (default e): p
Selected partition 4
First sector (3074048-4194303, default 3074048):
Using default value 3074048
Last sector, +sectors or +size{K,M,G} (3074048-4194303, default 4194303):
Using default value 4194303
Partition 4 of type Linux and of size 547 MiB is set

Command (m for help): p

Disk /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x165fd3f0

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     1026047      512000   83  Linux
/dev/sdb2         1026048     2050047      512000   83  Linux
/dev/sdb3         2050048     3074047      512000   83  Linux
/dev/sdb4         3074048     4194303      560128   83  Linux

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@sudhir log]# fdisk -l /dev/sdb

Disk /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x165fd3f0

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     1026047      512000   83  Linux
/dev/sdb2         1026048     2050047      512000   83  Linux
/dev/sdb3         2050048     3074047      512000   83  Linux
/dev/sdb4         3074048     4194303      560128   83  Linux
[root@sudhir log]# mkf
mkfifo       mkfontscale  mkfs.btrfs   mkfs.ext2    mkfs.ext4    mkfs.minix   mkfs.vfat
mkfontdir    mkfs         mkfs.cramfs  mkfs.ext3    mkfs.fat     mkfs.msdos   mkfs.xfs
[root@sudhir log]# mkfs.ext4 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
128016 inodes, 512000 blocks
25600 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=34078720
63 block groups
8192 blocks per group, 8192 fragments per group
2032 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409

Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

[root@sudhir log]# blkid /dev/sdb1
/dev/sdb1: UUID="7402cab0-0779-4a86-a296-03bc11f516ec" TYPE="ext4"
[root@sudhir log]# mkfs.ext4 /dev/sdb2
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
128016 inodes, 512000 blocks
25600 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=34078720
63 block groups
8192 blocks per group, 8192 fragments per group
2032 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409

Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

[root@sudhir log]# mkfs.xfs /dev/sdb3
meta-data=/dev/sdb3              isize=256    agcount=4, agsize=32000 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=128000, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=853, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@sudhir log]# blkid /dev/sdb1
/dev/sdb1: UUID="7402cab0-0779-4a86-a296-03bc11f516ec" TYPE="ext4"
[root@sudhir log]# blkid /dev/sdb2
/dev/sdb2: UUID="a321821b-8679-482f-99bd-95065ab0f3b3" TYPE="ext4"
[root@sudhir log]# blkid /dev/sdb3
/dev/sdb3: UUID="e26bb181-1823-42b8-a860-f08bf2e93fc7" TYPE="xfs"
[root@sudhir log]# pwd
/var/log
[root@sudhir log]# mkdir /dir1 /dir2 /dir3
[root@sudhir log]# mv /dir3 /opt
[root@sudhir log]# pwd
/var/log
[root@sudhir log]# mount /dev/sdb1 /dir1
[root@sudhir log]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   13G  6.5G  5.7G  54% /
devtmpfs                 906M     0  906M   0% /dev
tmpfs                    921M  100K  920M   1% /dev/shm
tmpfs                    921M  8.8M  912M   1% /run
tmpfs                    921M     0  921M   0% /sys/fs/cgroup
/dev/sda1                473M  156M  318M  33% /boot
tmpfs                    185M   12K  184M   1% /run/user/1000
tmpfs                    185M     0  185M   0% /run/user/0
/dev/sdb1                477M  2.3M  445M   1% /dir1
[root@sudhir log]# cd /dir1
[root@sudhir dir1]# ls
lost+found
[root@sudhir dir1]# pwd
/dir1
[root@sudhir dir1]# df -h .
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       477M  2.3M  445M   1% /dir1
[root@sudhir dir1]# cd ../dir2
[root@sudhir dir2]# ls
[root@sudhir dir2]# ls -l
total 0
[root@sudhir dir2]# df -h .
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   13G  6.5G  5.7G  54% /
[root@sudhir dir2]# pwd
/dir2
[root@sudhir dir2]# cd /dir1
[root@sudhir dir1]# pwd
/dir1
[root@sudhir dir1]# touch this is a file system
[root@sudhir dir1]# ls -l
total 17
-rw-r--r--. 1 root root     0 Apr 23 10:26 a
-rw-r--r--. 1 root root     0 Apr 23 10:26 file
-rw-r--r--. 1 root root     0 Apr 23 10:26 is
drwx------. 2 root root 12288 Apr 23 10:19 lost+found
-rw-r--r--. 1 root root     0 Apr 23 10:26 system
-rw-r--r--. 1 root root     0 Apr 23 10:26 this
[root@sudhir dir1]# pwd
/dir1
[root@sudhir dir1]# cd ..
[root@sudhir /]# df -h /dir1
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       477M  2.3M  445M   1% /dir1
[root@sudhir /]# umount /dir1
[root@sudhir /]# df -h /dir1
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   13G  6.5G  5.7G  54% /
[root@sudhir /]# cd dir1
[root@sudhir dir1]# ls -l
total 0
[root@sudhir dir1]# mount /dev/sdb1 /dir2
[root@sudhir dir1]# cd dir2
-bash: cd: dir2: No such file or directory
[root@sudhir dir1]# cd /dir2
[root@sudhir dir2]# ls
a  file  is  lost+found  system  this
[root@sudhir dir2]# ls -l
total 17
-rw-r--r--. 1 root root     0 Apr 23 10:26 a
-rw-r--r--. 1 root root     0 Apr 23 10:26 file
-rw-r--r--. 1 root root     0 Apr 23 10:26 is
drwx------. 2 root root 12288 Apr 23 10:19 lost+found
-rw-r--r--. 1 root root     0 Apr 23 10:26 system
-rw-r--r--. 1 root root     0 Apr 23 10:26 this
[root@sudhir dir2]# df -h .
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       477M  2.3M  445M   1% /dir2
[root@sudhir dir2]# cd /dir1
[root@sudhir dir1]# ls
[root@sudhir dir1]# ls -l /etc/fstab
-rw-r--r--. 1 root root 465 Feb  3 19:24 /etc/fstab
[root@sudhir dir1]# vi /etc/fstab
[root@sudhir dir1]# cp -p /etc/fstab /etc/fstab.04232016
[root@sudhir dir1]# vi /etc/fstab
[root@sudhir dir1]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   13G  6.5G  5.7G  54% /
devtmpfs                 906M     0  906M   0% /dev
tmpfs                    921M  100K  920M   1% /dev/shm
tmpfs                    921M  8.8M  912M   1% /run
tmpfs                    921M     0  921M   0% /sys/fs/cgroup
/dev/sda1                473M  156M  318M  33% /boot
tmpfs                    185M   12K  184M   1% /run/user/1000
tmpfs                    185M     0  185M   0% /run/user/0
/dev/sdb1                477M  2.3M  445M   1% /dir2
[root@sudhir dir1]# ls -ld /opt/dir3
drwxr-xr-x. 2 root root 6 Apr 23 10:22 /opt/dir3
[root@sudhir dir1]# ls -l /opt/dir3
total 0
[root@sudhir dir1]# mount -a
[root@sudhir dir1]# echo $?
0
[root@sudhir dir1]# ls -l /opt/dir3
total 12
drwx------. 2 root root 12288 Apr 23 10:20 lost+found
[root@sudhir dir1]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   13G  6.5G  5.7G  54% /
devtmpfs                 906M     0  906M   0% /dev
tmpfs                    921M  100K  920M   1% /dev/shm
tmpfs                    921M  8.8M  912M   1% /run
tmpfs                    921M     0  921M   0% /sys/fs/cgroup
/dev/sda1                473M  156M  318M  33% /boot
tmpfs                    185M   12K  184M   1% /run/user/1000
tmpfs                    185M     0  185M   0% /run/user/0
/dev/sdb1                477M  2.3M  445M   1% /dir2
/dev/sdb2                477M  2.3M  445M   1% /opt/dir3
[root@sudhir dir1]# mount /dev/sdb1 /dir1
[root@sudhir dir1]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   13G  6.5G  5.7G  54% /
devtmpfs                 906M     0  906M   0% /dev
tmpfs                    921M  100K  920M   1% /dev/shm
tmpfs                    921M  8.8M  912M   1% /run
tmpfs                    921M     0  921M   0% /sys/fs/cgroup
/dev/sda1                473M  156M  318M  33% /boot
tmpfs                    185M   12K  184M   1% /run/user/1000
tmpfs                    185M     0  185M   0% /run/user/0
/dev/sdb1                477M  2.3M  445M   1% /dir2
/dev/sdb2                477M  2.3M  445M   1% /opt/dir3
[root@sudhir dir1]# cd /dir1
[root@sudhir dir1]# ls
a  file  is  lost+found  system  this
[root@sudhir dir1]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   13G  6.5G  5.7G  54% /
devtmpfs                 906M     0  906M   0% /dev
tmpfs                    921M  100K  920M   1% /dev/shm
tmpfs                    921M  8.8M  912M   1% /run
tmpfs                    921M     0  921M   0% /sys/fs/cgroup
/dev/sda1                473M  156M  318M  33% /boot
tmpfs                    185M   12K  184M   1% /run/user/1000
tmpfs                    185M     0  185M   0% /run/user/0
/dev/sdb1                477M  2.3M  445M   1% /dir2
/dev/sdb2                477M  2.3M  445M   1% /opt/dir3
[root@sudhir dir1]# umount /dir2
[root@sudhir dir1]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   13G  6.5G  5.7G  54% /
devtmpfs                 906M     0  906M   0% /dev
tmpfs                    921M  100K  920M   1% /dev/shm
tmpfs                    921M  8.8M  912M   1% /run
tmpfs                    921M     0  921M   0% /sys/fs/cgroup
/dev/sda1                473M  156M  318M  33% /boot
tmpfs                    185M   12K  184M   1% /run/user/1000
tmpfs                    185M     0  185M   0% /run/user/0
/dev/sdb2                477M  2.3M  445M   1% /opt/dir3
/dev/sdb1                477M  2.3M  445M   1% /dir1
[root@sudhir dir1]# vi /etc/fstab
[root@sudhir dir1]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   13G  6.5G  5.7G  54% /
devtmpfs                 906M     0  906M   0% /dev
tmpfs                    921M  100K  920M   1% /dev/shm
tmpfs                    921M  8.8M  912M   1% /run
tmpfs                    921M     0  921M   0% /sys/fs/cgroup
/dev/sda1                473M  156M  318M  33% /boot
tmpfs                    185M   12K  184M   1% /run/user/1000
tmpfs                    185M     0  185M   0% /run/user/0
/dev/sdb2                477M  2.3M  445M   1% /opt/dir3
/dev/sdb1                477M  2.3M  445M   1% /dir1
[root@sudhir dir1]# mount -a
[root@sudhir dir1]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   13G  6.5G  5.7G  54% /
devtmpfs                 906M     0  906M   0% /dev
tmpfs                    921M  100K  920M   1% /dev/shm
tmpfs                    921M  8.8M  912M   1% /run
tmpfs                    921M     0  921M   0% /sys/fs/cgroup
/dev/sda1                473M  156M  318M  33% /boot
tmpfs                    185M   12K  184M   1% /run/user/1000
tmpfs                    185M     0  185M   0% /run/user/0
/dev/sdb2                477M  2.3M  445M   1% /dir2
/dev/sdb1                477M  2.3M  445M   1% /dir1
[root@sudhir dir1]# vi /etc/fstab
[root@sudhir dir1]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   13G  6.5G  5.7G  54% /
devtmpfs                 906M     0  906M   0% /dev
tmpfs                    921M  100K  920M   1% /dev/shm
tmpfs                    921M  8.8M  912M   1% /run
tmpfs                    921M     0  921M   0% /sys/fs/cgroup
/dev/sda1                473M  156M  318M  33% /boot
tmpfs                    185M   12K  184M   1% /run/user/1000
tmpfs                    185M     0  185M   0% /run/user/0
/dev/sdb2                477M  2.3M  445M   1% /dir2
/dev/sdb1                477M  2.3M  445M   1% /dir1
[root@sudhir dir1]# mount -a
[root@sudhir dir1]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   13G  6.5G  5.7G  54% /
devtmpfs                 906M     0  906M   0% /dev
tmpfs                    921M  100K  920M   1% /dev/shm
tmpfs                    921M  8.8M  912M   1% /run
tmpfs                    921M     0  921M   0% /sys/fs/cgroup
/dev/sda1                473M  156M  318M  33% /boot
tmpfs                    185M   12K  184M   1% /run/user/1000
tmpfs                    185M     0  185M   0% /run/user/0
/dev/sdb3                497M   26M  472M   6% /opt/dir3
/dev/sdb1                477M  2.3M  445M   1% /dir1
/dev/sdb2                477M  2.3M  445M   1% /dir2
[root@sudhir dir1]# reboot

Friday, April 22, 2016

copy file

# more copy.sh
#!/bin/sh
# Solaris 10
cd /data1/oracle
/usr/sbin/tar cfE - GLD | ( cd /data/oracle; tar xfBp - )
echo "Copy Completed" >> /var/tmp/status.txt

Wednesday, April 20, 2016

Console Login to Sun T-series server

Console login to Sun T-series server

The procedure tested on T-5120 and works like same on most T-series servers.

Connect through serial first and once you have ILOM access, get the ip address and use ssh to login.

Login: root/changeme

Setting the System Clock using the Hardware Clock as reference...
System Clock set. Local time: Wed Apr 20 19:21:38 GMT 2016
Setting up networking...done.
Running ldconfig...done
Setting up IP spoofing protection: rp_filter.
Configuring network interfaces...Internet Systems Consortium DHCP Client V3.0.1
Copyright 2004 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/products/DHCP
eth0: config: auto-negotiation on, 100FDX, 100HDX, 10FDX, 10HDX.
Listening on LPF/eth0/00:21:28:25:54:bb
Sending on   LPF/eth0/00:21:28:25:54:bb
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
done.
Hostname: sun-con-p02-ilo.
Starting portmap daemon: portmap.
Initializing random number generator...done.
INIT: Entering runlevel: 3
Starting system log daemon: syslogd and klogd.
Starting periodic command scheduler: cron.
Starting IPMI Stack...... Done.
Starting portmap daemon: portmap.
Starting OpenBSD Secure Shell server: sshd.
Starting Servicetags discoverer: stdiscoverer.
Starting Servicetags listener: stlistener.
Starting FRU update program: frutool.
sun-con-p02-ilo login: root
Password:
Waiting for daemons to initialize...
....
Daemons ready
Sun(TM) Integrated Lights Out Manager
Version 2.0.4.26.i

Copyright 2008 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
Third-party software, including font technology, is copyrighted and licensed
from Sun suppliers.
Portions may be derived from Berkeley BSD systems, licensed from U. of CA.
Sun, Sun Microsystems, and the Sun Logo are trademarks or registered trademarks
of Sun Microsystems, Inc. in the U.S. and other countries.
Federal Acquisitions: Commercial Software -- Government Users Subject to
Standard License Terms and Conditions.

Copyright 2008 Sun Microsystems, Inc. Tous droits réservés.
Distribué par des licences qui en restreignent l'utilisation.
Le logiciel détenu par des tiers, et qui comprend la technologie relative
aux polices de caractères, est protégé par un copyright et licencié par
des fournisseurs de Sun.
Des parties de ce produit pourront être dérivées des systèmes Berkeley BSD
licenciés par l'Université de Californie.
Sun, Sun Microsystems, et le logo Sun sont des marques de fabrique ou des
marques déposées de Sun Microsystems, Inc. aux Etats-Unis et dans d'autres pay          s.

Warning: password is set to factory default.

-> show /SP/network/
 /SP/network
    Targets:
    Properties:
        commitpending = (Cannot show property)
        dhcp_server_ip = 192.168.10.1
        ipaddress = 192.168.10.14
        ipdiscovery = dhcp
        ipgateway = 192.168.10.1
        ipnetmask = 255.255.255.0
        macaddress = 00:21:28:25:54:BB
        pendingipaddress = 192.168.10.14
        pendingipdiscovery = dhcp
        pendingipgateway = 192.168.10.1
        pendingipnetmask = 255.255.255.0
        state = enabled
    Commands:
        cd
        set
        show
-> start /SYS
Are you sure you want to start /SYS (y/n)? y
Starting /SYS
-> set /HOST send_break_action=break
Set 'send_break_action' to 'break'
-> start /SP/console
Are you sure you want to start /SP/console (y/n)? y
Serial console started.  To stop, type #.

{0} ok boot -F failsafe

# echo | format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c1t0d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>
          /pci@0/pci@0/pci@2/scsi@0/sd@0,0
Specify disk (enter its number): Specify disk (enter its number):
# mount /dev/dsk/c1t0d0s0 /mnt
# ksh
# TERM=vt100; EDITOR=vi; export TERM EDITOR
# cp -p /mnt/etc/shadow /mnt/etc/shadow.04202016
# set -o vi
# cd /mnt/etc
#
# grep root shadow
root:ove9HybeQmA4Y:6445::::::

Edit shadow file and remove the encrypted password.

# vi shadow
root:ove9HybeQmA4Y:6445::::::
root::6445::::::
# grep root shadow
root::6445::::::
# init 6

At login prompt, use root and at password prompt, just press enter to login.

Once you login, create your account and reset root password.


 

SCP to remote host on quiet mode

Like ssh -q, scp -q doesn't work on quiet mode to transfer files between two hosts
To make it work,
On your source host, have the following configuration,

$ cat  ~/.ssh/config
Host remote_host
hostname 192.168.10.20
user=sam
IdentityFile ~/.ssh/id_rsa.pub
LogLevel=QUIET
or

$ scp -q -o  LogLevel=QUIET myfile.testing remote_server:/var/tmp
-q only works with ssh client connection

Saturday, April 16, 2016

RHEL7 - Creating virtual interface

 Creating virtual interface

[root@sam network-scripts]# cd /etc/sysconfig/network-scripts
[root@sam network-scripts]# cp -p cfg-enp0s25 ifcfg-enp0s25:0
[root@sam network-scripts]# vi ifcfg-enp0s25:0
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s25:0
UUID=2a0b8f3c-e991-4a09-88a8-6fdefe273193
DEVICE=enp0s25:0
ONBOOT=yes
IPADDR=192.168.10.9
PREFIX=24
GATEWAY=192.168.10.1
DNS1=192.168.10.110
DOMAIN=expanor.local
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_PRIVACY=no
~
~
~

[root@sam network-scripts]# systemctl restart network

[root@sam network-scripts]# ifconfig -a
enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.10.8  netmask 255.255.255.0  broadcast 192.168.10.255
        inet6 fe80::223:aeff:feb0:320c  prefixlen 64  scopeid 0x20<link>
        ether 00:23:ae:b0:32:0c  txqueuelen 1000  (Ethernet)
        RX packets 4428211  bytes 6120463158 (5.7 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1943017  bytes 140766095 (134.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 21  memory 0xf7ae0000-f7b00000

enp0s25:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.10.9  netmask 255.255.255.0  broadcast 192.168.10.255
        ether 00:23:ae:b0:32:0c  txqueuelen 1000  (Ethernet)
        device interrupt 21  memory 0xf7ae0000-f7b00000

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 9668  bytes 985822 (962.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 9668  bytes 985822 (962.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@sam network-scripts]# ping  -c 3 192.168.10.9
PING 192.168.10.9 (192.168.10.9) 56(84) bytes of data.
64 bytes from 192.168.10.9: icmp_seq=1 ttl=64 time=0.077 ms
64 bytes from 192.168.10.9: icmp_seq=2 ttl=64 time=0.032 ms



[root@sam network-scripts]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:23:ae:b0:32:0c brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.8/24 brd 192.168.10.255 scope global enp0s25
       valid_lft forever preferred_lft forever
    inet 192.168.10.9/24 brd 192.168.10.255 scope global secondary enp0s25:0
       valid_lft forever preferred_lft forever
    inet6 fe80::223:aeff:feb0:320c/64 scope link
       valid_lft forever preferred_lft forever
[root@sam network-scripts]#


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


 1031  cd /etc/sysconfig/network-scripts/
 1032  pwd
 1033  ls
 1034  cp ifcfg-enp0s3 ifcfg-enp0s3:0
 1035  vi ifcfg-enp0s3:0
 1036  more ifcfg-enp0s3:0
 1037  systemctl restart network
 1038  ifconfig
 1039  ifcofig -a
 1040  ifconfig -a
 1041  vi ifcfg-enp0s3:0
 1042  ls
 1043  ifconfig ifcfg-enp0s3:0 plumb
 1044  ifconfig enp0s3:0 plumb
 1045  ifconfig -a
 1046  systemctl restart network
 1047  ifconfig -a
 1048  ip addr show
 1049  ls
 1050  more ifcfg-enp0s3:0
 1051  ifconfig enp0s3:0 plumb
 1052  ip addr show
 1053  ifconfig enp0s3:0 192.168.10.19 up
 1054  ifconfig -a
 1055  history
[root@sudhir network-scripts]#

Tuesday, April 12, 2016

RHEL7 - How to mount RHEL7 OS ISO Image file

How to mount RHEL7 OS image file

1. Create a mountpoint
# mkdir /rhel7

2. For temporarily mounting
# mount -o loop /opt/OS_Image/rhel-server-7.2-x86_64-dvd.iso /rhel7
mount: /dev/loop0 is write-protected, mounting read-only

3. Verify your mount
# df -h /rhel7
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0      3.8G  3.8G     0 100% /rhel7

4. Unmount
# umount /rhel7

5. To survive reboots, add entry to fstab
# cp -p /etc/fstab /etc/fstab.bk-up
# cat >>/etc/fstab
/opt/OS_Image/rhel-server-7.2-x86_64-dvd.iso    /rhel7  iso9660 defaults,loop   0 0

6. Mount the mountpoint. Since you have entry to fstab, you can just mount with mountpoint.
# mount /rhel7
mount: /dev/loop0 is write-protected, mounting read-only

7. Verify the mount
# df -h /rhel7
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0      3.8G  3.8G     0 100% /rhel7



Thursday, April 7, 2016

Solaris - basic SPARC M7 server login setup info

basic SPARC M7 server login setup info


Connect terminals or a terminal emulators (PC or workstation) to the two serial
connections.

Configure the terminal or terminal emulator with these settings:

Parameter Setting
-----------------
Connector: SER MGT
Rate: 9600 baud
Parity: None
Stop bits:  1
Data bits: 8



Determine which terminal or terminal emulator is connected to the Active SP.
While both terminals display Oracle ILOM login prompts, the terminal connected to the Active
SP displays system status messages while the Oracle ILOM firmware initializes.


Log in to the Active SP as root user with the changeme password.

ORACLE-SPX-SPMX-XXXXXXXXXX login: root
Password: changeme



Confirm that you are connected to the Active SP.
-> show /SP/redundancy status
status = Active



 If the command displays status = Active, you are logged in to the Active SP.

 If the command displays status = Standby, you are logged in to the Standby SP.
Type exit to log out of the Standby SP, and then log in to the Active SP using the other
terminal or terminal emulator.

 If the command displays status = Standalone, you are logged in to the Active SP, but the
Standby SP has failed to respond or has failed to join the network.


The SPs do not support DHCP. Assign static network addresses to SP0, SP1, and Active_SP so that you can access the Oracle ILOM firmware over a network connection, either using the web interface or the command line interface.


SP Component Description
SP0 The NET MGT 0 port on SP0.
SP1 The NET MGT 0 port on SP1.
Active_SP The IP address for the Active SP. If the Active SP fails, the Standby SP will be assigned this
address.
HOST0 The IP address for the PDomain0-SPM host.
HOST1 The IP address for the PDomain1-SPM host (if your SPARC M7-8 or SPARC M7-16 server
configuration includes two or more PDomains).
HOST2 The IP address for the PDomain2-SPM host (if your SPARC M7-16 server configuration includes three or more PDomains).
HOST3 The IP address for the PDomai


Set Oracle ILOM Network Addresses (IPv4)


1. Confirm that you are logged in to the Active SP.

2. Set the gateway IP address for all SP addresses.
-> set /SP/network pendingipgateway=xxx.xxx.xxx.xxx
Set "pendingipgateway" to "xxx.xxx.xxx.xxx"


3. Set the netmask IP address for all SP addresses.
-> set /SP/network pendingipnetmask=255.255.255.0
Set "pendingipnetmask" to "255.255.255.0"



This example uses 255.255.255.0 to set the netmask. Your network environment subnet might
require a different netmask. Use a netmask number most appropriate to your environment.




4. Assign the required IP addresses for the SP components.
* SP0:
-> set /SP/network/SP0/ pendingipaddress=xxx.xxx.xxx.xxx
Set "pendingipaddress" to "xxx.xxx.xxx.xxx"
* SP1:
-> set /SP/network/SP1/ pendingipaddress=xxx.xxx.xxx.xxx
Set "pendingipaddress" to "xxx.xxx.xxx.xxx"
* Active SP:
-> set /SP/network/ACTIVE_SP/ pendingipaddress=xxx.xxx.xxx.xxx
Set "pendingipaddress" to "xxx.xxx.xxx.xxx"
* Assign one address for each PDomain SPM:
-> set /SP/network/HOSTx/ pendingipaddress=xxx.xxx.xxx.xxx
Set "pendingipaddress" to "xxx.xxx.xxx.xxx"



Verify that you have set the network addresses correctly.
For brevity, this SPARC M7-16 server example shows only the output for the IP address
properties.
-> show /SP/network -level 2 -output table pendingipaddress pendingipnetmask
 pendingipgateway


6. Type the following command to make the new addresses take affect.
-> set /SP/network commitpending=true


7. Display the IP addresses to confirm that they have been updated.
-> show /SP/network -level 2 -output table ipaddress ipnetmask ipgateway



Power On a Server PDomain for the First Time



1. Confirm that you are logged in to the Active SP through a serial connection.


2. Log in to the Active SP as a root user through a network connection.
$ ssh root@Active-SP-IP-address


3. Using the network connection, connect to the PDomain console to view the
messages.
-> start /Servers/PDomains/PDomain_x/HOST/console
Are you sure you want to start /Servers/PDomains/PDomain_x/HOST/console (y/n) y



4. Using the serial connection, power on the PDomain.
-> start /Servers/PDomains/PDomain_x/HOST


Replace x with the PDomain number.
The PDomain initialization can take time to complete


5. (Optional) To display the status of the initialization, type the following command.
-> show /Servers/PDomains/PDomain_x/HOST status

6. Wait until the console displays the OpenBoot ok prompt after the PDomain has
completed the POST diagnostics.




To set boot-device
{ok} setenv boot-device /pci@301/pci@1/nvme@0/disk@1:a


4. List the network devices in the PDomain.

ok show-nets


Set the primary network device.

ok nvalias net /pci@306/pci@1/network@0


Boot the PDomain to start the Oracle Solaris OS configuration.
ok boot


Solaris 10 - Hard Partitioning With Oracle VM Server for SPARC


Hard Partitioning With Oracle VM Server for SPARC


Introduction
This document describes hard partitioning with Oracle VM Server for SPARC, and how to use it to conform to the Oracle licensing policies for partitioned environments.


CPU Cores and CPU Threads


Oracle VM Server for SPARC software runs on SPARC servers. Each SPARC processor has multiple CPU cores, and each CPU core has multiple CPU threads (virtual CPUs). By default, domains created with Oracle VM Server for SPARC are configured in units of CPU threads. Oracle VM Server for SPARC uses CPU affinity to try to assign each domain’s virtual CPUs on its own cores for optimal performance. This can be made mandatory by using the “whole core constraint” to require that CPUs are assigned in units of entire CPU cores. When binding such a domain, the system provisions the specified number of CPU cores and all their CPU threads to the domain.
For a list of supported SPARC systems and more information about CPU whole-core configurations, see the Release Notes and Administration Guide of Oracle VM Server for SPARC Documentation.
Hard Partitioning and CPU Whole Cores
Beginning with the Oracle VM Server for SPARC 2.0 release, hard partitioning is enforced by using CPU whole-core configurations and specifying the maximum number of cores that can be assigned to the domain. In this case, domains are configured with CPU whole cores, instead of the default of individual CPU threads. Using a whole-core configuration and setting a maximum CPU cap limits the number of CPU cores that can be dynamically assigned to a bound or active domain.
Hard Partitioning With Oracle VM Server for SPARC

Oracle Hard Partition Licensing
To conform to the Oracle hard partition licensing requirement, you must use at least Oracle VM Server for SPARC 2.0 release and must use CPU whole cores as follows:
 If a domain runs applications using Oracle hard partition licensing, that domain must be configured with CPU whole cores, and the CPU cap (maximum number of CPU cores) must be set for the domain. The CPU cap must be the number of CPU cores that is specified by the Oracle software license.
 If a domain does not run applications that use Oracle hard partition licensing, that domain does not need to be configured with CPU whole cores or a CPU cap. For example, if you do not run any Oracle applications in a domain, that domain does not need to be configured with CPU whole cores or a CPU cap.
Hard Partitioning With Oracle VM Server for SPARC


Checking the Configuration of a Domain
To Check Whether a Domain is Configured With CPU Whole Cores and a CPU Cap
1. Obtain the resources management information for the domain.
# ldm list -o resmgmt domain
Verify that the whole-core constraint appears in the output and that the max-cores keyword specifies the maximum number of CPU cores configured for the domain.
For more information, see the ldm(1M) man page of the Reference Manual in the Oracle VM Server for SPARC Documentation.
EXAMPLE – Checking Whether a Domain Is Configured With CPU Whole Cores and a CPU Cap
The following command shows that ldg1 domain is configured with CPU whole cores and a maximum of five cores:
# ldm list -o resmgmt ldg1
NAME ldg1
 CONSTRAINT
     whole-core
     max-cores=5
To List the CPU Cores That Are Assigned to a Domain
CPU cores are assigned to a domain when a domain is bound.
1. Obtain the list of CPU cores that are assigned to a domain.
# ldm list -o core domain
EXAMPLE – Listing the CPU Cores That Are Assigned to a Domain
The following command shows the cores that are assigned to domain ldg1:
# ldm list -o core ldg1
NAME ldg1
CORE
CID PCPUSET
1 (8, 9, 10, 11, 12, 13, 14, 15)
2 (16, 17, 18, 19, 20, 21, 22, 23)


Configuring a Domain With CPU Whole Cores and a CPU Cap
Use the following commands to configure a domain to use CPU whole cores and set the maximum number of CPU cores (CPU cap) for the domain:
ldm set-core number-of-cpu-cores domain
ldm set-domain max-cores=max-number-of-cpu-cores domain
If you are using version 2.0 or 2.1 of the Logical Domains Manager to assign whole cores to domains, the ldm add-core, ldm set-core, ldm remove-core, and ldm set-domain max-core commands are not available. Instead, you must use the ldm add-vcpu –c, ldm set-vcpu –c, and ldm remove-vcpu –c commands. These commands also set the CPU cap for the domain. See the ldm(1M) man page of the Reference Manual in the Oracle VM Server for SPARC Documentation.
To Create a New Domain With CPU Whole Cores and a CPU Cap
When creating a new domain, you can configure it to use CPU whole cores.
1. Create the domain.
# ldm create domain
2. Set the number of CPU whole cores and the CPU cap for the domain.
# ldm set-core number-of-cpu-cores domain
# ldm set-domain max-cores=max-number-of-cpu-cores domain
3. Configure the domain.
Caution –During this configuration, do not use the ldm add-vcpu, ldm set-vcpu or ldm rm-vcpu command. If you do so, the domain is reconfigured with individual CPU threads instead of CPU whole cores. Ensure that you use the ldm add-core, ldm set-core, or ldm remove-core command, or the –c option of the ldm add-vcpu, ldm set-vcpu or ldm rm-vcpu command if you use version 2.0 or 2.1 of Logical Domains Manager.
4. Bind and start the domain.
# ldm bind domain
# ldm start domain

EXAMPLE – Creating a New Domain With Two CPU Whole Cores and a CPU Cap of Two Cores
This example shows how to create a domain, ldg1, with two CPU whole cores. The following command creates the ldg1 domain:
# ldm create ldg1
The following commands configure the ldg1 domain with two CPU whole cores and set the CPU cap to two cores:
# ldm set-core 2 ldg1
# ldm set-domain max-cores=2 ldg1
At this point, you can perform further configuration of the domain subject to the restrictions described in Step 3 of the previous procedure. Before you use the ldg1 domain, you must bind and start it, which is done by the following commands:
# ldm bind ldg1
# ldm start ldg1
To Configure an Existing Domain With CPU Whole Cores and a CPU Cap
If a domain already exists and is configured to use CPU threads, you can change its configuration to use CPU whole cores and a CPU cap.
1. Stop and unbind the domain. This step is not needed to configure the domain to use CPU whole cores; it is only needed to set the CPU cap.
# ldm stop domain
# ldm unbind domain
2. Set the number of CPU whole cores for the domain and set the CPU cap.
# ldm set-core number-of-cpu-cores domain
# ldm set-domain max-cores=max-number-of-cpu-cores domain
3. Rebind and restart the domain if it was stopped in step 1.
# ldm bind domain
# ldm start domain
EXAMPLE – Configuring an Existing Domain With Four Whole Cores and a CPU Cap of Eight Cores
This example shows how to update the configuration of an existing domain, ldg1. Four CPU whole cores are configured for the domain and the CPU cap is set to eight cores. This enables you to add up to four more whole cores to the domain, if needed.

The following commands stop and unbind the ldg1 domain:
# ldm stop ldg1
# ldm unbind ldg1
The following commands configure the ldg1 domain with four CPU whole cores and set the CPU cap to eight. Note that the ldm set-core command can be done while the domain is active.
# ldm set-core 4 ldg1
# ldm set-domain max-cores=8 ldg1
The following commands bind and restart the ldg1 command:
# ldm bind ldg1
# ldm start ldg1
To Configure the Primary Domain With CPU Whole Cores and a CPU Cap
If the primary domain is configured to use CPU threads, you can change its configuration to use CPU whole cores and a CPU cap.
1. Set the number of CPU whole cores for the primary domain.
# ldm set-core number-of-cpu-cores primary
2. Put the primary domain in delayed reconfiguration mode. This step is not needed to change the domain to use whole cores, but it is needed in order to set a CPU cap.
# ldm start-reconf primary
3. Set the CPU cap for the primary domain.
# ldm set-domain max-cores=max-number-of-cpu-cores primary
4. Reboot the primary domain.
Use the appropriate procedure to reboot the primary domain, which depends on the system configuration. See “Rebooting the primary Domain” in the Administration Guide of the Oracle VM Server for SPARC Documentation.
EXAMPLE – Configuring the Primary Domain With Two Whole Cores and a CPU Cap of Two Cores
This example shows how to configure CPU whole cores on the primary domain. First, the following command specifies the number of CPU whole cores to assign to the primary domain:
# ldm set-core 2 primary
The following command initiates delayed reconfiguration mode on the primary domain:
# ldm start-reconf primary
The following command configures the CPU cap for the primary domain to two:

# ldm set-domain max-cores=2 primary
The following command reboots the primary domain:
# shutdown -i 6

Interaction With Other Features
CPU Dynamic Reconfiguration
You can use CPU dynamic reconfiguration with domains that are configured with CPU whole cores. However, you can only add or remove entire CPU cores, not individual CPU threads. Using CPU dynamic reconfiguration in this way maintains the hard partitioning of the system. In addition, when you dynamically add CPU cores to a domain, the command fails if it exceeds the maximum number of CPU cores for the domain.
Use the following commands to dynamically add, set, or remove CPU whole cores to a bound or active domain:
ldm add-core number-of-cpu-cores domain
ldm set-core number-of-cpu-cores domain
ldm remove-core number-of-cpu-cores domain
To conform to the Oracle licensing policy requirements, you must set the CPU cap by using the following command:
ldm set-domain max-cores=max-number-of-cpu-cores domain
Or, if you use version 2.0 or 2.1 of Logical Domains Manager, use the ldm add-vcpu –c, ldm set-vcpu –c, and ldm remove-vcpu –c commands for dynamic reconfiguration. These commands also set the CPU cap.
EXAMPLE – Dynamically Adding Two CPU Whole Cores to a Domain
This example shows how to dynamically add two CPU whole cores to domain ldg1, which is an active domain configured with CPU whole cores. The first command shows that the ldg1 domain is active. The second command shows that the ldg1 domain is configured with CPU whole cores, and a maximum of four CPU cores.
# ldm list ldg1
NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME
ldg1 active -n---- 5000 16 2G 0.4% 5d 17h 49m
# ldm list -o resmgmt ldg1
NAME
ldg1
 CONSTRAINT
     whole-core
     max-cores=4

The following command shows the CPU cores assigned to the domain before adding two CPU whole cores:
# ldm list -o core ldg1
NAME
ldg1
CORE
CID PCPUSET
1 (8, 9, 10, 11, 12, 13, 14, 15)
2 (16, 17, 18, 19, 20, 21, 22, 23)
The following command dynamically adds two CPU whole cores to the ldg1 domain. This is permitted because the total number of cores does not exceed the maximum of four:
# ldm add-core 2 ldg1
The following command shows the CPU cores assigned to the domain after adding two CPU whole cores:
# ldm list -o core ldg1
NAME ldg1
CORE
CID PCPUSET
1 (8, 9, 10, 11, 12, 13, 14, 15)
2 (16, 17, 18, 19, 20, 21, 22, 23)
3 (24, 25, 26, 27, 28, 29, 30, 31)
4 (32, 33, 34, 35, 36, 37, 38, 39)


CPU Dynamic Resource Management
If Dynamic Resource Management (DRM) is used to automatically manage CPU resources on some domains, DRM policies do not apply to those domains that are configured with CPU whole cores.
A DRM policy can include a domain that is configured with CPU whole cores. However, when such a policy is activated, the DRM policy is automatically disabled for that domain, which remains configured with CPU whole cores. If the domain is later reconfigured with CPU threads instead of CPU whole cores, the DRM policy is automatically re-enabled for that domain.
CPU Power Management
You can use CPU power management on domains that have either the performance or elastic policy set and configure the domains with CPU whole cores. Using CPU power management maintains the hard partitioning of the system.

Domain Reboot or Rebind
A domain that is configured with CPU whole cores remains configured with CPU whole cores when it is restarted, or if the entire platform is restarted. A domain uses the same physical CPU cores for the entire time it remains bound. For example, if a domain is rebooted, it uses the exact same physical CPU cores both before and after the reboot. Or, if the entire platform is powered off while a domain is bound, that domain will be configured with the exact same physical CPU cores when the platform is powered on again. If you unbind a domain and then rebind it, or if the entire platform is restarted with a new configuration, the domain might use different physical CPU cores.


Domain Migration
Starting with Oracle VM Server for SPARC 3.0, CPU whole-core configuration is compatible with domain migration. You can migrate a domain that is configured with CPU whole cores, and whole core allocation is enforced on the target system. Maximum CPU cores, if set, are also enforced on the target system. In prior releases, the whole-core configuration and the maximum number of CPU cores are not preserved by the migration to the target system.
Live migration of guest domains with whole cores and a CPU cap does not conform to the terms of the hard partitioning license.


Conclusion
With the Oracle VM Server for SPARC software, you must use the whole-core constraint and the CPU cap constraint to conform to the Oracle hard partition licensing requirement. In such a case, domains are configured with CPU whole cores, instead of the default of individual CPU threads. Using a CPU whole-core configuration with the CPU cap set also adds some restrictions to features, such as CPU dynamic reconfiguration beyond the CPU cap, CPU dynamic resource management, and domain migration.
For more information about Oracle's virtualization solutions, visit oracle.com/virtualization.


Source: http://www.oracle.com/technetwork/server-storage/vm/ovm-sparc-hard-partitioning-1403135.pdf

Wednesday, April 6, 2016

Solaris - Problem with Oracle database


 
If you have Oracle database problems:

1. Login to the server and check database and listener running.

# ps -ef|grep pmon|grep -v grep ## Verify Oracle database process
# ps -ef|grep tnslsnr|grep -v grep ## Verify Oracle listener process


2. On Oracle Enterprise Manager Grid Control check and verify no target or database down.

3. On Oracle Enterprise Manager Grid Control, select tab Targets and verify the target is in good status.

Note the server shows status up   .

4. In Oracle Enterprise Manager Grid Control select tab Databases and verify the target is in good status:

Note the database status shows up   .


Monday, April 4, 2016

SHUTTING DOWN, SUSPENDING, AND HIBERNATING THE SYSTEM

source: - https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Power.html

8.4. SHUTTING DOWN, SUSPENDING, AND HIBERNATING THE SYSTEM

In Red Hat Enterprise Linux 7, the systemctl utility replaces a number of power management commands used in previous versions of the Red Hat Enterprise Linux system. The commands listed in Table 8.8, “Comparison of Power Management Commands with systemctl” are still available in the system for compatibility reasons, but it is advised that you use systemctl when possible.
Table 8.8. Comparison of Power Management Commands with systemctl
Old CommandNew CommandDescription
haltsystemctl haltHalts the system.
poweroffsystemctl poweroffPowers off the system.
rebootsystemctl rebootRestarts the system.
pm-suspendsystemctl suspendSuspends the system.
pm-hibernatesystemctl hibernateHibernates the system.
pm-suspend-hybridsystemctl hybrid-sleepHibernates and suspends the system.

8.4.1. Shutting Down the System

The systemctl utility provides commands for shutting down the system, however the traditional shutdown command is also supported. Although the shutdown command will call the systemctl utility to perform the shutdown, it has an advantage in that it also supports a time argument. This is particularly useful for scheduled maintenance and to allow more time for users to react to the warning that a system shutdown has been scheduled. The option to cancel the shutdown can also be an advantage.

Using systemctl Commands

To shut down the system and power off the machine, type the following at a shell prompt as root:
systemctl poweroff
To shut down and halt the system without powering off the machine, run the following command as root:
systemctl halt
By default, running either of these commands causes systemd to send an informative message to all users that are currently logged into the system. To prevent systemd from sending this message, run the selected command with the --no-wall command line option, for example:
systemctl --no-wall poweroff

Using the shutdown Command

To shut down the system and power off the machine at a certain time, use a command in the following format as root:
shutdown --poweroff hh:mm
Where hh:mm is the time in 24 hour clock format. The /run/nologin file is created 5 minutes before system shutdown to prevent new logins. When a time argument is used, an optional message, the wall message, can be appended to the command.
To shut down and halt the system after a delay, without powering off the machine, use a command in the following format as root:
shutdown --halt +m
Where +m is the delay time in minutes. The now keyword is an alias for +0.
A pending shutdown can be canceled by the root user as follows:
shutdown -c
See the shutdown(8) manual page for further command options.

8.4.2. Restarting the System

To restart the system, run the following command as root:
systemctl reboot
By default, this command causes systemd to send an informative message to all users that are currently logged into the system. To prevent systemd from sending this message, run this command with the --no-wall command line option:
systemctl --no-wall reboot

8.4.3. Suspending the System

To suspend the system, type the following at a shell prompt as root:
systemctl suspend
This command saves the system state in RAM and with the exception of the RAM module, powers off most of the devices in the machine. When you turn the machine back on, the system then restores its state from RAM without having to boot again. Because the system state is saved in RAM and not on the hard disk, restoring the system from suspend mode is significantly faster than restoring it from hibernation, but as a consequence, a suspended system state is also vulnerable to power outages.
For information on how to hibernate the system, see Section 8.4.4, “Hibernating the System”.

8.4.4. Hibernating the System

To hibernate the system, type the following at a shell prompt as root:
systemctl hibernate
This command saves the system state on the hard disk drive and powers off the machine. When you turn the machine back on, the system then restores its state from the saved data without having to boot again. Because the system state is saved on the hard disk and not in RAM, the machine does not have to maintain electrical power to the RAM module, but as a consequence, restoring the system from hibernation is significantly slower than restoring it from suspend mode.
To hibernate and suspend the system, run the following command as root:
systemctl hybrid-sleep