Solaris 10 - Rename hostname of LDOM
~~~~~ Warning !!! Content posted here are gained through the real world experience or some may come from training or any other Internet sources. Reading this blog may confuse you or may increase understanding of UNIX/Linux operating system and its component. It might help you to land on Real job or may fire your from the Real job. So, use on your own risk !!! No left or right reserved !!! -Kamal ~~~~~
Friday, June 9, 2017
Solaris 10 - Steps to create LDOM
Steps to create LDOM
1. Create Domain
# ldm add-domain spup-lx-v01
# ldm add-vcpu 16 spup-lx-v01
# ldm add-mem 8g spup-lx-v01
# ldm list
Note: Record /etc/resolv.conf, /etc/netmasks, /etc/inet/ntp.conf file entry from same server environment.
You will need this info to set up this VM.
2. List some ldom related info
# ldm list
# ldm list-services
# ldm list-bindings
# ldm list-bindings spup-lx-v01
3. Add vnet to LDOM
# ldm add-vnet vnet0 primary-vsw2 spup-lx-v01
# ldm add-vnet vnet1 primary-vsw3 spup-lx-v01
We are configuring multi-pathing
# ldm set-vnet linkprop=phys-state vnet0 spup-lx-v01
# ldm set-vnet linkprop=phys-state vnet1 spup-lx-v01
4. Add Disk
# ldm list
# echo | format | grep -i <LUN>
# ldm add-vdsdev /dev/dsk/c0t6000D310006D6400000000000000023Cd0s2 DL30@primary-vds0
# ldm add-vdisk VDL30 DL30@primary-vds0 spup-lx-v01
Set boot device variables
# ldm set-var boot-device=vdl30 spup-lx-v01
# ldm set-variable auto-boot\?=false spup-lx-v01
# ldm list-bindings spup-lx-v01
5. Bind and start the LDOM
# ldm bind spup-lx-v01
# ldm list spup-lx-v01
# ldm start spup-lx-v01
# ldm list spup-lx-v01
6. Login to console
# telnet 0 5008
{0} ok boot -s
7. Once you login, perform the following tasks.
a. Remove /etc/path_to_inst (rebuilding device tree).
# mv /etc/path_to_inst /var/tmp/222._etc_path_to_inst
# rm /etc/path_to_inst*
b. Network and hostname configuration
Add hosts entry with correct IP/HOST
# vi /etc/hosts
192.168.10.60 spup-lx-v01.sces.dev spup-lx-v01 loghost
# vi /etc/netmasks
192.168.1128 255.255.255.128
192.168.10.0 255.255.255.128
# cat >/etc/hostname.vnet0
spup-lx-v01 netmask + broadcast + group ipmp up
# cat >/etc/hostname.vnet1
group ipmp up
# ifconfig vnet1 up
dns client set up
# vi /etc/resolv.conf
domain sces.dev
search sces.dev
nameserver 192.168.10.24
nameserver 192.168.10.29
- Set up default router
# cat /etc/defaultrouter
192.168.1129
# cat >/etc/nodename
spup-lx-v01
# cat /etc/nodename
# hostname
# vi /etc/inet/ntp.conf
server 192.168.10.24
# ls -l /var/ntp/ntp.drift
# more /etc/hosts.allow
rpcbind: 192.168.10. 192.168.1. 192.168.5.
sshd: ALL
sendmail: localhost 127.0.0.1
# more /etc/nsswitch.conf
# ls -ltr /etc | grep path_to
# reboot -- -r
spup-lx-v01 console login:
# more /etc/resolv.conf
domain sces.dev
nameserver 192.168.10.24
nameserver 192.168.10.29
# cat /etc/netmasks
192.168.10.0 255.255.255.128
# cat /etc/inet/ntp.conf
server 192.168.10.14
# ldm list-spconfig
# ldm add-spconfig cfg07012015
Record /etc/resolv.conf, /etc/netmasks, /etc/inet/ntp.conf file entry
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
474 ldm list
475 ldm list-devices vcpu | wc -l
476 ldm list-devices vcpu | grep 100 | wc -l
477 ldm list-devices memory
478 ldm list
479 ldm add-domain serp-db-v06_sol11
480 ldm list
481 ldm add-vcpu 8 serp-db-v06_sol11
482 ldm list
483 ldm add-memory 2G serp-db-v06_sol11
484 ldm list
485 ldm list
486 ldm list-bindings serp-db-v06_sol11
487 ldm list-bindings serp-db-v06
488 ldm list
489 df -k
490 exit
491 echo | format | grep 0351
492 ldm list-services | grep -i 0351
493 ldm list
494 ldm help | more
495 ldm-- help | more
496 ldm --help | more
497 ldm list-devices -o cpu | more
498 ldm list-devices -a cpu | more
499 ldm --help | more
500 man mpathadm
501 history >/var/tmp/cmd-list
502 clear
503 history #
1. Create Domain
# ldm add-domain spup-lx-v01
# ldm add-vcpu 16 spup-lx-v01
# ldm add-mem 8g spup-lx-v01
# ldm list
Note: Record /etc/resolv.conf, /etc/netmasks, /etc/inet/ntp.conf file entry from same server environment.
You will need this info to set up this VM.
2. List some ldom related info
# ldm list
# ldm list-services
# ldm list-bindings
# ldm list-bindings spup-lx-v01
3. Add vnet to LDOM
# ldm add-vnet vnet0 primary-vsw2 spup-lx-v01
# ldm add-vnet vnet1 primary-vsw3 spup-lx-v01
We are configuring multi-pathing
# ldm set-vnet linkprop=phys-state vnet0 spup-lx-v01
# ldm set-vnet linkprop=phys-state vnet1 spup-lx-v01
4. Add Disk
# ldm list
# echo | format | grep -i <LUN>
# ldm add-vdsdev /dev/dsk/c0t6000D310006D6400000000000000023Cd0s2 DL30@primary-vds0
# ldm add-vdisk VDL30 DL30@primary-vds0 spup-lx-v01
Set boot device variables
# ldm set-var boot-device=vdl30 spup-lx-v01
# ldm set-variable auto-boot\?=false spup-lx-v01
# ldm list-bindings spup-lx-v01
5. Bind and start the LDOM
# ldm bind spup-lx-v01
# ldm list spup-lx-v01
# ldm start spup-lx-v01
# ldm list spup-lx-v01
6. Login to console
# telnet 0 5008
{0} ok boot -s
7. Once you login, perform the following tasks.
a. Remove /etc/path_to_inst (rebuilding device tree).
# mv /etc/path_to_inst /var/tmp/222._etc_path_to_inst
# rm /etc/path_to_inst*
b. Network and hostname configuration
Add hosts entry with correct IP/HOST
# vi /etc/hosts
192.168.10.60 spup-lx-v01.sces.dev spup-lx-v01 loghost
# vi /etc/netmasks
192.168.1128 255.255.255.128
192.168.10.0 255.255.255.128
# cat >/etc/hostname.vnet0
spup-lx-v01 netmask + broadcast + group ipmp up
# cat >/etc/hostname.vnet1
group ipmp up
# ifconfig vnet1 up
dns client set up
# vi /etc/resolv.conf
domain sces.dev
search sces.dev
nameserver 192.168.10.24
nameserver 192.168.10.29
- Set up default router
# cat /etc/defaultrouter
192.168.1129
# cat >/etc/nodename
spup-lx-v01
# cat /etc/nodename
# hostname
# vi /etc/inet/ntp.conf
server 192.168.10.24
# ls -l /var/ntp/ntp.drift
# more /etc/hosts.allow
rpcbind: 192.168.10. 192.168.1. 192.168.5.
sshd: ALL
sendmail: localhost 127.0.0.1
# more /etc/nsswitch.conf
# ls -ltr /etc | grep path_to
# reboot -- -r
spup-lx-v01 console login:
# more /etc/resolv.conf
domain sces.dev
nameserver 192.168.10.24
nameserver 192.168.10.29
# cat /etc/netmasks
192.168.10.0 255.255.255.128
# cat /etc/inet/ntp.conf
server 192.168.10.14
# ldm list-spconfig
# ldm add-spconfig cfg07012015
Record /etc/resolv.conf, /etc/netmasks, /etc/inet/ntp.conf file entry
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
474 ldm list
475 ldm list-devices vcpu | wc -l
476 ldm list-devices vcpu | grep 100 | wc -l
477 ldm list-devices memory
478 ldm list
479 ldm add-domain serp-db-v06_sol11
480 ldm list
481 ldm add-vcpu 8 serp-db-v06_sol11
482 ldm list
483 ldm add-memory 2G serp-db-v06_sol11
484 ldm list
485 ldm list
486 ldm list-bindings serp-db-v06_sol11
487 ldm list-bindings serp-db-v06
488 ldm list
489 df -k
490 exit
491 echo | format | grep 0351
492 ldm list-services | grep -i 0351
493 ldm list
494 ldm help | more
495 ldm-- help | more
496 ldm --help | more
497 ldm list-devices -o cpu | more
498 ldm list-devices -a cpu | more
499 ldm --help | more
500 man mpathadm
501 history >/var/tmp/cmd-list
502 clear
503 history #
Thursday, June 8, 2017
Redhat 7 - Puppet installation
Client installation
1. Update hosts file with puppet server if DNS is not working
# vi /etc/hosts
214.38.138.239 spup-lx-v02 spup-lx-v02.expanor.local
wq
# ping spup-lx-v02.expanor.local
2. Update PATH variable
# vi /root/.profile
PATH=/usr/bin:/usr/sbin:/usr/local/bin:/usr/ccs/bin:$PATH:/opt/puppetlabs/puppet/bin
export PATH
wq!
# . /root/.profile
3. Use curn to download and install the agent package
# curl
-bash: curl: command not found
# ls -l /usr/ucb/curl
/usr/ucb/curl: No such file or directory
# cd /usr/local/bin/curl
-rwxr-xr-x 1 root root 171528 Jan 6 2014 curl
# ./curl -k https://214.38.138.239:8140/packages/current/install.bash | sudo bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (35) Unknown SSL protocol error in connection to 214.38.138.239:8140
# telnet 214.38.138.239:8140
214.38.138.239:8140: node name or service name not known
Verify you can connect to port 8140
# telnet 214.38.138.239 8140
Trying 214.38.138.239...
Connected to 214.38.138.239.
Escape character is '^]'.
^]
telnet> q
Connection to 214.38.138.239 closed.
4. Downloading from puppet server failed. Now, download the puppet client from puppet.com and upload to each client. Extract the file and install.
# gunzip puppet-agent-1.10.1-1.sparc.pkg.gz
# pkgadd -d puppet-agent-1.10.1-1.sparc.pkg
The following packages are available:
1 puppet-agent puppet-agent - https://www.puppetlabs.com
(sparc) 1.10.1-1
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:
Processing package instance <puppet-agent> from </var/tmp/puppet-agent-1.10.1-1.sparc.pkg>
Installation of <puppet-agent> was successful.
# puppet agent --test --server spup-lx-v02.expanor.local
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for sinf-mw-v20.sces.dsca.mil
Info: Applying configuration version '1496760334'
Notice: Applied catalog in 1.49 seconds
#
# svcs -a | grep pup
disabled 10:41:06 svc:/network/puppet:default
# svcadm enable svc:/network/puppet:default
# svcs -a | grep pup
online 11:30:47 svc:/network/puppet:default
#
error / troubleshooting
Received error : - Exiting; no certificate found and waitforcert is disabled
# puppet agent --test --server spup-lx-v02.expanor.local
Exiting; no certificate found and waitforcert is disabled
# telnet spup-lx-v02.expanor.local 8140
Trying 214.38.138.239...
Connected to spup-lx-v02.
Escape character is '^]'.
^]
telnet> q
Connection to spup-lx-v02 closed.
When puppet client try to make a connection to pupper server first time, it generate a certificate and pass it to puppet server to sign in. The certificate need to signed manually at the server side.
To resolve this issue,
Go to puppet master server and perform the following command to list all certificates that are waiting for sign.
# puppet cert --list | more
"sidm-mw-v18.expanor.local" (SHA256) 7D:0D:3A:0E:B7:14:9E:72:E5:6D:75:10:70:C1:1E:5A:CD:03:B2:5C:55:88:E8:86:2D:43:AE:C3:C6:E3:EA:B0
Now, we can see the certificate from client waiting for signing.
Run the following command below to sign the certificate.
[root@spup-lx-v02 ~]# puppet cert sign sidm-mw-v18.expanor.local
Signing Certificate Request for:
"sidm-mw-v18.expanor.local" (SHA256) 7D:0D:3A:0E:B7:14:9E:72:E5:6D:75:10:70:C1:1E:5A:CD:03:B2:5C:55:88:E8:86:2D:43:AE:C3:C6:E3:EA:B0
Notice: Signed certificate request for sidm-mw-v18.expanor.local
Notice: Removing file Puppet::SSL::CertificateRequest sidm-mw-v18.expanor.local at '/etc/puppetlabs/puppet/ssl/ca/requests/sidm-mw-v18.expanor.local.pem'
[root@spup-lx-v02 ~]#
if you want to sign all certificates, run the command below,
# puppet cert sign --all
you get this error.
Any Puppet agent connecting to a Puppet master server for a first time will generate a certificate and give it to a Puppet master server to sign. Depending on your puppet configuration, a default behavior is that the certificate must by signed manually and thus puppet agent exits with an error:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Puppet Implementation
Prerequisites
- Root Access
- Server with 2 cores, 6 GB RAM
- 20 GB of free space available under /opt
- Ensure port 3000 is open.
Puppet Enterprise Installation
1. Download Tar ball version ending in -el-<version arch>.tar.gz.
2. Run the following command to unpack the tarball:
# tar –xzf <tarball>
3. To set up the installer, Run
# sudo ./puppet-enterprise-installer
4. When prompted, choose the “Guilded” installation option.
5. The PE installer will start a web server at
https://<hostname>:3000
6. Log onto PE Console and create password for admin user and fill the remaining info and continue.
Puppet Agent Installation
1. In the console, click Nodes > Classification. On the Classes tab, select the class that matches your client.
2. Click Add Class and commit changes.
3. From the command line on Puppet Master, run puppet agent –t.
4. SSH into your agent node and run:
# Curl –k https://<master_server>:8140/packages/current/install.bash | sudo bash
5. The installer installs and configures the Puppet Enterprise Agent.
6. After installation is complete, approve the certificate request from the Request Console from the puppet server.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Enterprise Puppet Master is only supported on a Linux based Platform. Redhat Enterprise Linux is selected because it’s DOD Common Criteria (CC) certified. Puppet will be used for system baseline and configuration management.
For Puppet Enterprise Server to communicate with clients on TEST & DEV Enclaves, the following firewall changes needs to be implemented:
Source: TEST 214.38.139.128/25
DEV 10.222.102.0/25
Target: spup-lx-v02.expanor.local (214.38.138.239)
Ports:
8140 -- Puppet Master Inbound Port
61613 – Mcollective Port
4433 – Classifier/Console Services API Port
8081 – PuppetDB Port
8142 – Orchestrator Port
8143 – Orchestrator/PCP Broker Port
Puppet will be used to deploy system security baseline and configuration managements.
RedHat Enterprise Linux 7.0 (Puppet Master)
Solaris 10/11 (Puppet Agents Only)
Detailed Description Of Proposed Change
1. Build a VM running Redhat Enterprise Linux 7.x
2. Install Enterprise Puppet on Redhat VM.
3. Deploy Puppet Agents to Solaris systems.
4. Test communication and deployment pushes between Puppet Master & Client Agents.
Test Documentation
Create a sample Class for NTP under /opt/puppet/classes/ntp.mod
class { '::ntp':
servers => ['dev-ad1.sces.dev', 'dev-ad2.sces.dev'],
restrict => [
'default ignore',
'-6 default ignore',
'127.0.0.1',
'-6 ::1',
'ntp1.corp.com nomodify notrap nopeer noquery',
'ntp2.corp.com nomodify notrap nopeer noquery'
],
}
To test if sample ntp file gets push, Run:
Sudo puppet apply --test
Verify sample test modules created from PE Consoles gets successfully pushed out to Puppet Clients.
Back-out Plan
1. Shutdown Puppet services from Master server.
2. Disabled Puppet Agents on clients.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Installation error log
Transaction test succeeded
Running transaction
^Z
[1]+ Stopped ./puppet-enterprise-installer
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]# jobs
[1]+ Stopped ./puppet-enterprise-installer
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]# bg
[1]+ ./puppet-enterprise-installer &
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]# jobs
[1]+ Running ./puppet-enterprise-installer &
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]#
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]# jobs
[1]+ Running ./puppet-enterprise-installer &
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]# jobs
[1]+ Running ./puppet-enterprise-installer &
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]# fg
./puppet-enterprise-installer
Installing : puppet-agent-1.10.1-1.el7.x86_64 1/3
Using username "kbhusal".
You are accessing a U.S. Government (USG) Information System (IS) that is
provided for USG-authorized use only. By using this IS (
The other application is: yum
Memory : 85 M RSS (429 MB VSZ)
Started: Mon Jun 5 19:22:06 2017 - 1:02:21 ago
State : Uninterruptible, pid: 9221
Cleaning repos: puppet_enterprise
Cleaning up everything
grep: : No such file or directory
2017-06-05 20:24:29,974 Running command: yum install -y puppet-agent-1.10.1 pe-installer pe-modules
BDB2053 Freeing read locks for locker 0x12a: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x12c: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x13b: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x13d: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x13e: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x13f: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x140: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x141: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x142: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x143: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x144: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x145: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x146: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x147: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x148: 9221/140345866499904
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
: manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Package puppet-agent-1.10.1-1.el7.x86_64 already installed and latest version
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package -cleanup can help).
--> Running transaction check
---> Package pe-installer.x86_64 0:2017.2.0.rc0.20.g20fe238-1.el7 will be installed
---> Package pe-modules.x86_64 0:2017.2.0.rc0.68.g48b0405-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
pe-installer x86_64 2017.2.0.rc0.20.g20fe238-1.el7 puppet_enterprise 7.4 M
pe-modules x86_64 2017.2.0.rc0.68.g48b0405-1.el7 puppet_enterprise 1.6 M
Transaction Summary
================================================================================
Install 2 Packages
Total download size: 8.9 M
Installed size: 31 M
Downloading packages:
--------------------------------------------------------------------------------
Total 177 MB/s | 8.9 MB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : pe-modules-2017.2.0.rc0.68.g48b0405-1.el7.x86_64 1/2
Installed:
pe-installer.x86_64 0:2017.2.0.rc0.20.g20fe238-1.el7
pe-modules.x86_64 0:2017.2.0.rc0.68.g48b0405-1.el7
Complete!
## We're preparing the Web Installer...
2017-06-05 21:04:06,314 Running command: mkdir -p /opt/puppetlabs/puppet/share/installer/installer
2017-06-05 21:04:06,329 Running command: cp -pR /opt/puppet-enterprise-2017.2.1-el-7-x86_64/* /opt/puppetlabs/puppet/share/installer/installer
## Go to https://spup-lx-v02.expanor.local:3000 in your browser to continue installation.
## Be sure to use 'https://' and that port 3000 is reachable through the firewall.
2017-06-05 21:04:09,293 Running command: RACK_ENV=production /opt/puppetlabs/puppet/share/installer/vendor/bundler/bin/thin start --debug -p 3
----------------------------------
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]# yum history
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
8 | Kamal Bhusal <kbhusal> | 2017-06-05 20:24 | Install | 2
7 | Kamal Bhusal <kbhusal> | 2017-06-05 19:22 | Install | 3 **
6 | Kamal Bhusal <kbhusal> | 2017-06-05 17:58 | Install | 3 **
5 | Jay Kancho <jkancho> | 2017-05-31 11:05 | I, U | 163 EE
4 | Kamal Bhusal <kbhusal> | 2017-05-30 10:39 | Install | 1 <
3 | Kamal Bhusal <kbhusal> | 2017-04-20 11:06 | Install | 1 >
2 | Kamal Bhusal <kbhusal> | 2017-04-20 09:48 | Install | 1
1 | System <unset> | 2017-04-19 11:43 | Install | 1286
history list
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]# yum history redo last
1. Update hosts file with puppet server if DNS is not working
# vi /etc/hosts
214.38.138.239 spup-lx-v02 spup-lx-v02.expanor.local
wq
# ping spup-lx-v02.expanor.local
2. Update PATH variable
# vi /root/.profile
PATH=/usr/bin:/usr/sbin:/usr/local/bin:/usr/ccs/bin:$PATH:/opt/puppetlabs/puppet/bin
export PATH
wq!
# . /root/.profile
3. Use curn to download and install the agent package
# curl
-bash: curl: command not found
# ls -l /usr/ucb/curl
/usr/ucb/curl: No such file or directory
# cd /usr/local/bin/curl
-rwxr-xr-x 1 root root 171528 Jan 6 2014 curl
# ./curl -k https://214.38.138.239:8140/packages/current/install.bash | sudo bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (35) Unknown SSL protocol error in connection to 214.38.138.239:8140
# telnet 214.38.138.239:8140
214.38.138.239:8140: node name or service name not known
Verify you can connect to port 8140
# telnet 214.38.138.239 8140
Trying 214.38.138.239...
Connected to 214.38.138.239.
Escape character is '^]'.
^]
telnet> q
Connection to 214.38.138.239 closed.
4. Downloading from puppet server failed. Now, download the puppet client from puppet.com and upload to each client. Extract the file and install.
# gunzip puppet-agent-1.10.1-1.sparc.pkg.gz
# pkgadd -d puppet-agent-1.10.1-1.sparc.pkg
The following packages are available:
1 puppet-agent puppet-agent - https://www.puppetlabs.com
(sparc) 1.10.1-1
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:
Processing package instance <puppet-agent> from </var/tmp/puppet-agent-1.10.1-1.sparc.pkg>
Installation of <puppet-agent> was successful.
# puppet agent --test --server spup-lx-v02.expanor.local
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for sinf-mw-v20.sces.dsca.mil
Info: Applying configuration version '1496760334'
Notice: Applied catalog in 1.49 seconds
#
# svcs -a | grep pup
disabled 10:41:06 svc:/network/puppet:default
# svcadm enable svc:/network/puppet:default
# svcs -a | grep pup
online 11:30:47 svc:/network/puppet:default
#
error / troubleshooting
Received error : - Exiting; no certificate found and waitforcert is disabled
# puppet agent --test --server spup-lx-v02.expanor.local
Exiting; no certificate found and waitforcert is disabled
# telnet spup-lx-v02.expanor.local 8140
Trying 214.38.138.239...
Connected to spup-lx-v02.
Escape character is '^]'.
^]
telnet> q
Connection to spup-lx-v02 closed.
When puppet client try to make a connection to pupper server first time, it generate a certificate and pass it to puppet server to sign in. The certificate need to signed manually at the server side.
To resolve this issue,
Go to puppet master server and perform the following command to list all certificates that are waiting for sign.
# puppet cert --list | more
"sidm-mw-v18.expanor.local" (SHA256) 7D:0D:3A:0E:B7:14:9E:72:E5:6D:75:10:70:C1:1E:5A:CD:03:B2:5C:55:88:E8:86:2D:43:AE:C3:C6:E3:EA:B0
Now, we can see the certificate from client waiting for signing.
Run the following command below to sign the certificate.
[root@spup-lx-v02 ~]# puppet cert sign sidm-mw-v18.expanor.local
Signing Certificate Request for:
"sidm-mw-v18.expanor.local" (SHA256) 7D:0D:3A:0E:B7:14:9E:72:E5:6D:75:10:70:C1:1E:5A:CD:03:B2:5C:55:88:E8:86:2D:43:AE:C3:C6:E3:EA:B0
Notice: Signed certificate request for sidm-mw-v18.expanor.local
Notice: Removing file Puppet::SSL::CertificateRequest sidm-mw-v18.expanor.local at '/etc/puppetlabs/puppet/ssl/ca/requests/sidm-mw-v18.expanor.local.pem'
[root@spup-lx-v02 ~]#
if you want to sign all certificates, run the command below,
# puppet cert sign --all
you get this error.
Any Puppet agent connecting to a Puppet master server for a first time will generate a certificate and give it to a Puppet master server to sign. Depending on your puppet configuration, a default behavior is that the certificate must by signed manually and thus puppet agent exits with an error:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Puppet Implementation
Prerequisites
- Root Access
- Server with 2 cores, 6 GB RAM
- 20 GB of free space available under /opt
- Ensure port 3000 is open.
Puppet Enterprise Installation
1. Download Tar ball version ending in -el-<version arch>.tar.gz.
2. Run the following command to unpack the tarball:
# tar –xzf <tarball>
3. To set up the installer, Run
# sudo ./puppet-enterprise-installer
4. When prompted, choose the “Guilded” installation option.
5. The PE installer will start a web server at
https://<hostname>:3000
6. Log onto PE Console and create password for admin user and fill the remaining info and continue.
Puppet Agent Installation
1. In the console, click Nodes > Classification. On the Classes tab, select the class that matches your client.
2. Click Add Class and commit changes.
3. From the command line on Puppet Master, run puppet agent –t.
4. SSH into your agent node and run:
# Curl –k https://<master_server>:8140/packages/current/install.bash | sudo bash
5. The installer installs and configures the Puppet Enterprise Agent.
6. After installation is complete, approve the certificate request from the Request Console from the puppet server.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Enterprise Puppet Master is only supported on a Linux based Platform. Redhat Enterprise Linux is selected because it’s DOD Common Criteria (CC) certified. Puppet will be used for system baseline and configuration management.
For Puppet Enterprise Server to communicate with clients on TEST & DEV Enclaves, the following firewall changes needs to be implemented:
Source: TEST 214.38.139.128/25
DEV 10.222.102.0/25
Target: spup-lx-v02.expanor.local (214.38.138.239)
Ports:
8140 -- Puppet Master Inbound Port
61613 – Mcollective Port
4433 – Classifier/Console Services API Port
8081 – PuppetDB Port
8142 – Orchestrator Port
8143 – Orchestrator/PCP Broker Port
Puppet will be used to deploy system security baseline and configuration managements.
RedHat Enterprise Linux 7.0 (Puppet Master)
Solaris 10/11 (Puppet Agents Only)
Detailed Description Of Proposed Change
1. Build a VM running Redhat Enterprise Linux 7.x
2. Install Enterprise Puppet on Redhat VM.
3. Deploy Puppet Agents to Solaris systems.
4. Test communication and deployment pushes between Puppet Master & Client Agents.
Test Documentation
Create a sample Class for NTP under /opt/puppet/classes/ntp.mod
class { '::ntp':
servers => ['dev-ad1.sces.dev', 'dev-ad2.sces.dev'],
restrict => [
'default ignore',
'-6 default ignore',
'127.0.0.1',
'-6 ::1',
'ntp1.corp.com nomodify notrap nopeer noquery',
'ntp2.corp.com nomodify notrap nopeer noquery'
],
}
To test if sample ntp file gets push, Run:
Sudo puppet apply --test
Verify sample test modules created from PE Consoles gets successfully pushed out to Puppet Clients.
Back-out Plan
1. Shutdown Puppet services from Master server.
2. Disabled Puppet Agents on clients.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Installation error log
Transaction test succeeded
Running transaction
^Z
[1]+ Stopped ./puppet-enterprise-installer
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]# jobs
[1]+ Stopped ./puppet-enterprise-installer
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]# bg
[1]+ ./puppet-enterprise-installer &
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]# jobs
[1]+ Running ./puppet-enterprise-installer &
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]#
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]# jobs
[1]+ Running ./puppet-enterprise-installer &
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]# jobs
[1]+ Running ./puppet-enterprise-installer &
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]# fg
./puppet-enterprise-installer
Installing : puppet-agent-1.10.1-1.el7.x86_64 1/3
Using username "kbhusal".
You are accessing a U.S. Government (USG) Information System (IS) that is
provided for USG-authorized use only. By using this IS (
The other application is: yum
Memory : 85 M RSS (429 MB VSZ)
Started: Mon Jun 5 19:22:06 2017 - 1:02:21 ago
State : Uninterruptible, pid: 9221
Cleaning repos: puppet_enterprise
Cleaning up everything
grep: : No such file or directory
2017-06-05 20:24:29,974 Running command: yum install -y puppet-agent-1.10.1 pe-installer pe-modules
BDB2053 Freeing read locks for locker 0x12a: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x12c: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x13b: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x13d: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x13e: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x13f: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x140: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x141: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x142: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x143: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x144: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x145: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x146: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x147: 9221/140345866499904
BDB2053 Freeing read locks for locker 0x148: 9221/140345866499904
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
: manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Package puppet-agent-1.10.1-1.el7.x86_64 already installed and latest version
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package -cleanup can help).
--> Running transaction check
---> Package pe-installer.x86_64 0:2017.2.0.rc0.20.g20fe238-1.el7 will be installed
---> Package pe-modules.x86_64 0:2017.2.0.rc0.68.g48b0405-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
pe-installer x86_64 2017.2.0.rc0.20.g20fe238-1.el7 puppet_enterprise 7.4 M
pe-modules x86_64 2017.2.0.rc0.68.g48b0405-1.el7 puppet_enterprise 1.6 M
Transaction Summary
================================================================================
Install 2 Packages
Total download size: 8.9 M
Installed size: 31 M
Downloading packages:
--------------------------------------------------------------------------------
Total 177 MB/s | 8.9 MB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : pe-modules-2017.2.0.rc0.68.g48b0405-1.el7.x86_64 1/2
Installed:
pe-installer.x86_64 0:2017.2.0.rc0.20.g20fe238-1.el7
pe-modules.x86_64 0:2017.2.0.rc0.68.g48b0405-1.el7
Complete!
## We're preparing the Web Installer...
2017-06-05 21:04:06,314 Running command: mkdir -p /opt/puppetlabs/puppet/share/installer/installer
2017-06-05 21:04:06,329 Running command: cp -pR /opt/puppet-enterprise-2017.2.1-el-7-x86_64/* /opt/puppetlabs/puppet/share/installer/installer
## Go to https://spup-lx-v02.expanor.local:3000 in your browser to continue installation.
## Be sure to use 'https://' and that port 3000 is reachable through the firewall.
2017-06-05 21:04:09,293 Running command: RACK_ENV=production /opt/puppetlabs/puppet/share/installer/vendor/bundler/bin/thin start --debug -p 3
----------------------------------
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]# yum history
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
8 | Kamal Bhusal <kbhusal> | 2017-06-05 20:24 | Install | 2
7 | Kamal Bhusal <kbhusal> | 2017-06-05 19:22 | Install | 3 **
6 | Kamal Bhusal <kbhusal> | 2017-06-05 17:58 | Install | 3 **
5 | Jay Kancho <jkancho> | 2017-05-31 11:05 | I, U | 163 EE
4 | Kamal Bhusal <kbhusal> | 2017-05-30 10:39 | Install | 1 <
3 | Kamal Bhusal <kbhusal> | 2017-04-20 11:06 | Install | 1 >
2 | Kamal Bhusal <kbhusal> | 2017-04-20 09:48 | Install | 1
1 | System <unset> | 2017-04-19 11:43 | Install | 1286
history list
[root@spup-lx-v02 puppet-enterprise-2017.2.1-el-7-x86_64]# yum history redo last
Solaris - SPARC T7 Console login
SPARC T7 Console login
1. Plug the power cords from the AC power source to the rear of the server.
2. Connect a device to the SER MGT port.
3. Connect a terminal or a terminal emulator (PC or workstation) to the server SER MGT port.
4. Configure a terminal or terminal emulator with these settings:
9600 baud
8 bits
No parity
1 Stop bit
No handshake
Note: null modem configuration is needed, meaning the transmit and receive signals are reversed
(crossed over) for DTE to DTE communications. You can use the supplied RJ-45 crossover
adapters with a standard RJ-45 cable to achieve the null modem configuration.
5. Connect an Ethernet cable between the server's NET MGT port and
the network to which future connections to the SP and host will be made.
6. Connect an Ethernet cable between one of the server's NET ports and the
network to which the server will communicate.
7. Power on the System for the First Time
8. At the terminal device, log in to the SP.
login: root
Password: changeme
->
ILO default user name and password:- root/changeme
[ -> is ILOM prompt ]
9. Power on the server using the command below
-> start /SYSTEM
If you want to stop the power on process, type #. (hash+DOT keys) and at the ILO prompt type
-> stop /SYS
10. To redirect host output to display on serial terminal device type
-> start /HOST/console
Some parameter change
From ILOM, set the OpenBoot auto-boot? parameter to false.
-> set /HOST/bootmode script="setenv auto-boot? false"
to reset the system from the ILO prompt
-> reset /SYS
-> start /HOST/console
At ok prompt
{0} ok help boot
Assign a Static IP Address to the NET MGT Port
1. Connect to the ILOM on the SP using the SER MGT port.
-> set /SP/network pendingipdiscovery=static
-> set /SP/network pendingipaddress=service-processor-IPaddr
-> set /SP/network pendingipgateway=gateway-IPaddr
-> set /SP/network pendingipnetmask=255.255.255.0
Verify the parameters if set correctly.
-> show /SP/network -display properties
save the change
-> set /SP/network commitpending=true
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SPARC M7 server console login info
Log In to the Active SP
While both terminals display ILOM login prompts, the terminal connected to the Active SP displays system
status messages while the ILOM firmware initializes.
login: root
Password: changeme
Confirm that you are connected to the Active SP.
-> show /SP/redundancy status
status = Active
If the command displays status = Standby, you are logged in to the Standby SP.
1. Plug the power cords from the AC power source to the rear of the server.
2. Connect a device to the SER MGT port.
3. Connect a terminal or a terminal emulator (PC or workstation) to the server SER MGT port.
4. Configure a terminal or terminal emulator with these settings:
9600 baud
8 bits
No parity
1 Stop bit
No handshake
Note: null modem configuration is needed, meaning the transmit and receive signals are reversed
(crossed over) for DTE to DTE communications. You can use the supplied RJ-45 crossover
adapters with a standard RJ-45 cable to achieve the null modem configuration.
5. Connect an Ethernet cable between the server's NET MGT port and
the network to which future connections to the SP and host will be made.
6. Connect an Ethernet cable between one of the server's NET ports and the
network to which the server will communicate.
7. Power on the System for the First Time
8. At the terminal device, log in to the SP.
login: root
Password: changeme
->
ILO default user name and password:- root/changeme
[ -> is ILOM prompt ]
9. Power on the server using the command below
-> start /SYSTEM
If you want to stop the power on process, type #. (hash+DOT keys) and at the ILO prompt type
-> stop /SYS
10. To redirect host output to display on serial terminal device type
-> start /HOST/console
Some parameter change
From ILOM, set the OpenBoot auto-boot? parameter to false.
-> set /HOST/bootmode script="setenv auto-boot? false"
to reset the system from the ILO prompt
-> reset /SYS
-> start /HOST/console
At ok prompt
{0} ok help boot
Assign a Static IP Address to the NET MGT Port
1. Connect to the ILOM on the SP using the SER MGT port.
-> set /SP/network pendingipdiscovery=static
-> set /SP/network pendingipaddress=service-processor-IPaddr
-> set /SP/network pendingipgateway=gateway-IPaddr
-> set /SP/network pendingipnetmask=255.255.255.0
Verify the parameters if set correctly.
-> show /SP/network -display properties
save the change
-> set /SP/network commitpending=true
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SPARC M7 server console login info
Log In to the Active SP
While both terminals display ILOM login prompts, the terminal connected to the Active SP displays system
status messages while the ILOM firmware initializes.
login: root
Password: changeme
Confirm that you are connected to the Active SP.
-> show /SP/redundancy status
status = Active
If the command displays status = Standby, you are logged in to the Standby SP.
Sunday, June 4, 2017
Solaris 10 - autofs set up
autofs
On nfs server perform the following tasks
1. Add entry to dfshare
# vi /etc/dfs/dfstab
share -F nfs /data/mydb/test/myshare
2. Share your directory
# shareall
3. Verify your share
# share
- /data/mydb/test/myshare rw ""
4. List the directories under the share
# ls -R /data/mydb/test/myshare
/data/mydb/test/myshare:
test
/data/mydb/test/myshare/test:
best
/data/mydb/test/myshare/test/best:
bishal
/data/mydb/test/myshare/test/best/bishal:
Now, go to your client system
1. Add entry to auto_master file for direct map
# vi /etc/auto_master
/- auto_data -browse
2. Add entry for direct map on auto_data file
# vi /etc/auto_data
/dbdata/OS_Image1 192.168.10.21:/data/mydb/test/myshare
3. Run automunt command to update the share to be managed by automount
# automount -v
4. Restart autofs
# svcs -a | grep autofs
online 10:20:06 svc:/system/filesystem/autofs:default
# svcadm restart autofs
# cd /dbdata/
# ls
OS_Image1
# cd OS_Image1/
# ls
test
# cd test/
# ls
best
# cd best/bishal/
ls -R /dbdata/OS_Image1
/dbdata/OS_Image1:
test
/dbdata/OS_Image1/test:
best
/dbdata/OS_Image1/test/best:
bishal
/dbdata/OS_Image1/test/best/bishal:
# df -h .
Filesystem size used avail capacity Mounted on
192.168.10.21:/data/mydb/test/myshare 872M 453M 419M 52% /dbdata/OS_Image1
Solaris 10 - working with nfs server and client
Nfs share
1. Create the directory you want to share
# mkdir /data/mydb/test/myshare
2. Share your directory
# share -F nfs /data/mydb/test/myshare
# share
- /data/mydb/test/myshare rw ""
Now, go to the client and mount
On client system
1. Check if your system has access to the share
# showmount -e 192.168.10.21
export list for 192.168.10.21:
/data/mydb/test/myshare (everyone)
2. Mount the share
# mount 192.168.10.21:/data/mydb/test/myshare /mnt
3. Verify the share
# df -h /mnt
Filesystem size used avail capacity Mounted on
192.168.10.21:/data/mydb/test/myshare 872M 453M 419M 52% /mnt
#
Now on your server, check what/which clients are using your share.
# cat /etc/rmtab
# cat /etc/rm
rmmount.conf rmt rmtab
# cat /etc/rmtab
# cat /etc/rmtab
# cat /etc/rmtab
# vi /etc/dfs/dfstab
"/etc/dfs/dfstab" 12 lines, 397 characters
# Place share(1M) commands here for automatic execution
# on entering init state 3.
#
# Issue the command 'svcadm enable network/nfs/server' to
# run the NFS daemon processes and the share commands, after adding
"/etc/dfs/dfstab" 12 lines, 397 characters
# .e.g,
# share -F nfs -o rw=engineering -d "home dirs" /export/home2
share -F nfs /data/mydb/test/myshare
~
~
~
"/etc/dfs/dfstab" 12 lines, 433 characters
# share
- /data/mydb/test/myshare rw ""
# shareall
# share
- /data/mydb/test/myshare rw ""
#
1. Create the directory you want to share
# mkdir /data/mydb/test/myshare
2. Share your directory
# share -F nfs /data/mydb/test/myshare
# share
- /data/mydb/test/myshare rw ""
Now, go to the client and mount
On client system
1. Check if your system has access to the share
# showmount -e 192.168.10.21
export list for 192.168.10.21:
/data/mydb/test/myshare (everyone)
2. Mount the share
# mount 192.168.10.21:/data/mydb/test/myshare /mnt
3. Verify the share
# df -h /mnt
Filesystem size used avail capacity Mounted on
192.168.10.21:/data/mydb/test/myshare 872M 453M 419M 52% /mnt
#
Now on your server, check what/which clients are using your share.
# cat /etc/rmtab
# cat /etc/rm
rmmount.conf rmt rmtab
# cat /etc/rmtab
# cat /etc/rmtab
# cat /etc/rmtab
# vi /etc/dfs/dfstab
"/etc/dfs/dfstab" 12 lines, 397 characters
# Place share(1M) commands here for automatic execution
# on entering init state 3.
#
# Issue the command 'svcadm enable network/nfs/server' to
# run the NFS daemon processes and the share commands, after adding
"/etc/dfs/dfstab" 12 lines, 397 characters
# .e.g,
# share -F nfs -o rw=engineering -d "home dirs" /export/home2
share -F nfs /data/mydb/test/myshare
~
~
~
"/etc/dfs/dfstab" 12 lines, 433 characters
# share
- /data/mydb/test/myshare rw ""
# shareall
# share
- /data/mydb/test/myshare rw ""
#
Solaris 10 - Adding swap device ufs partition, zfs volume and ufs file as swap device
A. Adding UFS partition as a Swap device
1. Create partitions
# format c1t0d0
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
2. Add partition as a swap device
# swap -a /dev/dsk/c1t0d0s1
# swap -a /dev/dsk/c1t0d0s3
# swap -a /dev/dsk/c1t0d0s4
# swap -a /dev/dsk/c1t0d0s5
3. List swap device
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
/dev/dsk/c1t0d0s1 33,65 8 409592 409592
/dev/dsk/c1t0d0s3 33,67 8 409592 409592
/dev/dsk/c1t0d0s4 33,68 8 204792 204792
/dev/dsk/c1t0d0s5 33,69 8 204792 204792
4. Remove swap device
# for i in /dev/dsk/c1t0d0s1 /dev/dsk/c1t0d0s3 /dev/dsk/c1t0d0s4 /dev/dsk/c1t0d0s5
> do
> swap -d $i
> done
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
B. Adding zfs volume as a swap volume
Create zfs mirror and create swap device using zfs filesystem
1. Remove the sub mirror from the pool
# zpool detach datapool c1t2d0
# zpool status datapool
pool: datapool
state: ONLINE
scan: resilvered 454M in 0h0m with 0 errors on Sun Jun 4 09:00:42 2017
config:
NAME STATE READ WRITE CKSUM
datapool ONLINE 0 0 0
c1t0d0 ONLINE 0 0 0
errors: No known data errors
2. Mirror the disk
# zpool help attach
usage:
attach [-f] <pool> <device> <new-device>
# zpool attach datapool c1t0d0 c1t2d0
3. Create a swap volume
# zfs help
The following commands are supported:
allow clone create destroy diff get
groupspace help hold holds inherit list
mount promote receive release rename rollback
send set share snapshot unallow unmount
unshare upgrade userspace
For more info, run: zfs help <command>
# zfs help create
usage:
create [-p] [-o property=value] ... <filesystem>
create [-ps] [-b blocksize] [-o property=value] ... -V <size> <volume>
# zfs create -V 100m datapool/myswap
4. Locate your swap volume
# ls -l /dev/zvol/dsk/datapool/myswap
lrwxrwxrwx 1 root root 35 Jun 4 09:09 /dev/zvol/dsk/datapool/myswap -> ../../../../devices/pseudo/zfs@0:1c
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
datapool 557M 419M 32K none
datapool/mydb 454M 419M 453M /data/mydb
datapool/mydb/test 31K 419M 31K /data/mydb/test
datapool/myswap 103M 522M 16K -
mypool 142K 1.95G 31K none
mypool/opt_os 31K 1.95G 31K /opt/os
yourpool 189K 19.6G 31K none
yourpool/FS_opt-OS_Image 31K 19.6G 31K /opt/OS_Image
yourpool/fs-opt-os 31K 19.6G 31K /opt/os
5. Add swap
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
# swap -s
total: 273784k bytes allocated + 91588k reserved = 365372k used, 1264948k available
# swap -a /dev/zvol/dsk/datapool/myswap
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
/dev/zvol/dsk/datapool/myswap 181,1 8 204792 204792
# swap -s
total: 273868k bytes allocated + 91572k reserved = 365440k used, 1366508k available
#
c. Adding file as a swap device
1. Create 100 MB of swap device
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
/dev/zvol/dsk/datapool/myswap 181,1 8 204792 204792
# mkfile 100m /data/mydb/myswap
2. List current swap devices that are on use
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
/dev/zvol/dsk/datapool/myswap 181,1 8 204792 204792
# swap -s
total: 273868k bytes allocated + 91572k reserved = 365440k used, 1267308k available
3. Add swap file as swap device
# swap -a /data/mydb/myswap
"/data/mydb/myswap" may contain holes - can't swap on it.
Since this is zfs filesystem, you can create number of swap volume.
lets try ufs filesystem
1. Create 100MB of file
# df -h /
Filesystem size used avail capacity Mounted on
/dev/dsk/c0d1s0 8.1G 4.0G 4.0G 51% /
# mkfile 100m /myswapfile
2. List currently used swap devices
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
/dev/zvol/dsk/datapool/myswap 181,1 8 204792 204792
# swap -s
total: 273868k bytes allocated + 91572k reserved = 365440k used, 1263380k available
3. Add swap device
# swap -a /myswapfile
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
/dev/zvol/dsk/datapool/myswap 181,1 8 204792 204792
/myswapfile - 8 204792 204792
# swap -s
total: 273868k bytes allocated + 91572k reserved = 365440k used, 1365776k available
#
1. Create partitions
# format c1t0d0
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
2. Add partition as a swap device
# swap -a /dev/dsk/c1t0d0s1
# swap -a /dev/dsk/c1t0d0s3
# swap -a /dev/dsk/c1t0d0s4
# swap -a /dev/dsk/c1t0d0s5
3. List swap device
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
/dev/dsk/c1t0d0s1 33,65 8 409592 409592
/dev/dsk/c1t0d0s3 33,67 8 409592 409592
/dev/dsk/c1t0d0s4 33,68 8 204792 204792
/dev/dsk/c1t0d0s5 33,69 8 204792 204792
4. Remove swap device
# for i in /dev/dsk/c1t0d0s1 /dev/dsk/c1t0d0s3 /dev/dsk/c1t0d0s4 /dev/dsk/c1t0d0s5
> do
> swap -d $i
> done
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
B. Adding zfs volume as a swap volume
Create zfs mirror and create swap device using zfs filesystem
1. Remove the sub mirror from the pool
# zpool detach datapool c1t2d0
# zpool status datapool
pool: datapool
state: ONLINE
scan: resilvered 454M in 0h0m with 0 errors on Sun Jun 4 09:00:42 2017
config:
NAME STATE READ WRITE CKSUM
datapool ONLINE 0 0 0
c1t0d0 ONLINE 0 0 0
errors: No known data errors
2. Mirror the disk
# zpool help attach
usage:
attach [-f] <pool> <device> <new-device>
# zpool attach datapool c1t0d0 c1t2d0
3. Create a swap volume
# zfs help
The following commands are supported:
allow clone create destroy diff get
groupspace help hold holds inherit list
mount promote receive release rename rollback
send set share snapshot unallow unmount
unshare upgrade userspace
For more info, run: zfs help <command>
# zfs help create
usage:
create [-p] [-o property=value] ... <filesystem>
create [-ps] [-b blocksize] [-o property=value] ... -V <size> <volume>
# zfs create -V 100m datapool/myswap
4. Locate your swap volume
# ls -l /dev/zvol/dsk/datapool/myswap
lrwxrwxrwx 1 root root 35 Jun 4 09:09 /dev/zvol/dsk/datapool/myswap -> ../../../../devices/pseudo/zfs@0:1c
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
datapool 557M 419M 32K none
datapool/mydb 454M 419M 453M /data/mydb
datapool/mydb/test 31K 419M 31K /data/mydb/test
datapool/myswap 103M 522M 16K -
mypool 142K 1.95G 31K none
mypool/opt_os 31K 1.95G 31K /opt/os
yourpool 189K 19.6G 31K none
yourpool/FS_opt-OS_Image 31K 19.6G 31K /opt/OS_Image
yourpool/fs-opt-os 31K 19.6G 31K /opt/os
5. Add swap
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
# swap -s
total: 273784k bytes allocated + 91588k reserved = 365372k used, 1264948k available
# swap -a /dev/zvol/dsk/datapool/myswap
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
/dev/zvol/dsk/datapool/myswap 181,1 8 204792 204792
# swap -s
total: 273868k bytes allocated + 91572k reserved = 365440k used, 1366508k available
#
c. Adding file as a swap device
1. Create 100 MB of swap device
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
/dev/zvol/dsk/datapool/myswap 181,1 8 204792 204792
# mkfile 100m /data/mydb/myswap
2. List current swap devices that are on use
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
/dev/zvol/dsk/datapool/myswap 181,1 8 204792 204792
# swap -s
total: 273868k bytes allocated + 91572k reserved = 365440k used, 1267308k available
3. Add swap file as swap device
# swap -a /data/mydb/myswap
"/data/mydb/myswap" may contain holes - can't swap on it.
Since this is zfs filesystem, you can create number of swap volume.
lets try ufs filesystem
1. Create 100MB of file
# df -h /
Filesystem size used avail capacity Mounted on
/dev/dsk/c0d1s0 8.1G 4.0G 4.0G 51% /
# mkfile 100m /myswapfile
2. List currently used swap devices
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
/dev/zvol/dsk/datapool/myswap 181,1 8 204792 204792
# swap -s
total: 273868k bytes allocated + 91572k reserved = 365440k used, 1263380k available
3. Add swap device
# swap -a /myswapfile
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
/dev/zvol/dsk/datapool/myswap 181,1 8 204792 204792
/myswapfile - 8 204792 204792
# swap -s
total: 273868k bytes allocated + 91572k reserved = 365440k used, 1365776k available
#
Subscribe to:
Posts (Atom)