Good tutorial from here and here. Managing tmux sessions: $ tmux # start tmux server $ tmux at # attach running sessions to a terminal $ tmux ls # list running tmux sessions $ exit # close tmux session Sharing sessions between terminals: $ tmux new -s session_name # make new named session $ tmux at -t session_name # attach to exist session (allowing shared sessions) $ tmux kill-session -t session_name # kill named session Commands (used within a running tmux session): NOTE: All commands need to be prefixed with the action key. By default, this is CTRL-b c - create new window n/p - move to next/previous window 0-9 - move to window number 0-9 f - find window by name w - menu with all windows & - kill current window , - rename window % - split window, adding a vertical pane to the right " - split window, adding an horizontal pane below ←/→ - move focus to left/right pane ↑/↓ - move focus to upper/lower pane ! - Break current pane into new window x - Kill the current pane. z - toggle maximize the current pane. d - detach the current client [ - enter copy mode (then use emacs select/yank keys) * press CTRL-SPACE or CTRL-@ to start selecting text * move cursor to end of desired text * press ALT-w to copy selected text ] - paste copied text ? - show tmux key bindings
12.03.2015
tmux Terminal Multiplexer
11.08.2015
Install Go and Setup Vim as IDE
1. Install Go - http://www.hostingadvice.com/how-to/install-golang-on-ubuntu/ 2. Configure Vim as IDE for Go - http://farazdagi.com/blog/2015/vim-as-golang-ide/ 3. Docker image of Vim configured with Go - https://hub.docker.com/r/mbrt/golang-vim-dev/ Setup Notes: When installing vim-go-ide while in corporate firewall, do a clone in this fashion... git clone https://github.com/farazdagi/vim-go-ide.git ~/.vim_go_runtime Additional configurations: $ vim ~/.bashrc gvm use go1.5.1 alias vimgo='vim -u ~/.vimrc.go' $ vim ~/.vimrc.go set t_Co=256 Using the Docker image (what I prefer): $ cd your/go/workspace $ docker run --rm -tiv `pwd`:/go mbrt/golang-vim-dev
8.13.2015
How to Create and Use SSL Certificates
From this post.
1. ~]$ mkdir CA 2. ~]$ cd CA 3. CA]$ mkdir newcerts private 4. CA]$ echo '01' >serial 5. CA]$ touch index.txtCreate a Root Certificate
6. CA]$ vi openssl.cnf # # OpenSSL configuration file. # # Establish working directory. dir = . [ ca ] default_ca = CA_default [ CA_default ] serial = $dir/serial database = $dir/index.txt new_certs_dir = $dir/newcerts certificate = $dir/cacert.pem private_key = $dir/private/cakey.pem default_days = 365 default_md = md5 preserve = no email_in_dn = no nameopt = default_ca certopt = default_ca policy = policy_match [ policy_match ] countryName = match stateOrProvinceName = match organizationName = match organizationalUnitName = optional commonName = supplied emailAddress = optional [ req ] default_bits = 1024 # Size of keys default_keyfile = key.pem # name of generated keys default_md = md5 # message digest algorithm string_mask = nombstr # permitted characters distinguished_name = req_distinguished_name req_extensions = v3_req [ req_distinguished_name ] # Variable name Prompt string #---------------------- ---------------------------------- 0.organizationName = Organization Name (company) organizationalUnitName = Organizational Unit Name (department, division) emailAddress = Email Address emailAddress_max = 40 localityName = Locality Name (city, district) stateOrProvinceName = State or Province Name (full name) countryName = Country Name (2 letter code) countryName_min = 2 countryName_max = 2 commonName = Common Name (hostname, IP, or your name) commonName_max = 64 # Default values for the above, for consistency and less typing. # Variable name Value #------------------------------ ------------------------------ 0.organizationName_default = The Sample Company localityName_default = Metropolis stateOrProvinceName_default = New York countryName_default = US [ v3_ca ] basicConstraints = CA:TRUE subjectKeyIdentifier = hash authorityKeyIdentifier = keyid:always,issuer:always [ v3_req ] basicConstraints = CA:FALSE subjectKeyIdentifier = hash 7. CA]$ openssl req -new -x509 -extensions v3_ca -keyout private/cakey.pem -out cacert.pem -days 3650 -config ./openssl.cnf Generating a 1024 bit RSA private key ....................++++++ ................++++++ writing new private key to 'private/cakey.pem' Enter PEM pass phrase:demo Verifying - Enter PEM pass phrase:demo ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Organization Name (company) [The Sample Company]:My Company Organizational Unit Name (department, division) []:CA Division Email Address []:ca@sample.com Locality Name (city, district) [Metropolis]:Santa Clara State or Province Name (full name) [New York]:California Country Name (2 letter code) [US]:Common Name (hostname, IP, or your name) []:TSC Root CA Create a Certificate Signing Request
8. CA]$ openssl req -new -nodes -out req.pem -config ./openssl.cnf Generating a 1024 bit RSA private key ...++++++ .....................++++++ writing new private key to 'key.pem' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Organization Name (company) [The Sample Company]:My Company Organizational Unit Name (department, division) []:Web Server Email Address []:ca@test.com Locality Name (city, district) [Metropolis]:Santa Clara State or Province Name (full name) [New York]:California Country Name (2 letter code) [US]:US Common Name (hostname, IP, or your name) []:hostname.domain.comSign a Certificate
9. CA]$ openssl ca -out cert.pem -config ./openssl.cnf -infiles req.pem Using configuration from ./openssl.cnf Enter pass phrase for ./private/cakey.pem:demo Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows organizationName :PRINTABLE:'My Company' organizationalUnitName:PRINTABLE:'Web Server' localityName :PRINTABLE:'Santa Clara' stateOrProvinceName :PRINTABLE:'California' countryName :PRINTABLE:'US' commonName :PRINTABLE:'hostname.domain.com' Certificate is to be certified until Aug 12 18:22:03 2016 GMT (365 days) Sign the certificate? [y/n]:y 1 out of 1 certificate requests certified, commit? [y/n]y Write out database with 1 new entries Data Base Updated 10. CA]$ cat key.pem cert.pem >key-cert.pem 11. CA]$ ls *.pem cacert.pem cert.pem key-cert.pem key.pem req.pemDeploy Certificate
12. Copy the appropriate files, usually cert.pem and key.pem to the location where the certificates will be used as specified by the application.
8.12.2015
Rails configure Webrick to use SSL
Came from this post.
Change bin/rails to be...
To generate certificates, follow this post.
#!/usr/bin/env ruby require 'rails/commands/server' require 'rack' require 'webrick' require 'webrick/https' if ENV['SSL'] == "true" module Rails class Server < ::Rack::Server def default_options super.merge({ :Port => 3001, :environment => (ENV['RAILS_ENV'] || "development").dup, :daemonize => false, :debugger => false, :pid => File.expand_path("tmp/pids/server.pid"), :config => File.expand_path("config.ru"), :SSLEnable => true, :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE, :SSLPrivateKey => OpenSSL::PKey::RSA.new( File.open("certs/key.pem").read), :SSLCertificate => OpenSSL::X509::Certificate.new( File.open("certs/cert.pem").read), :SSLCertName => [["CN", WEBrick::Utils::getservername]], }) end end end end APP_PATH = File.expand_path('../../config/application', __FILE__) require_relative '../config/boot' require 'rails/commands'For self-signed certificates as outlined here.
#!/usr/bin/env ruby require 'rails/commands/server' require 'rack' require 'webrick' require 'webrick/https' if ENV['SSL'] == "true" module Rails class Server < ::Rack::Server def default_options super.merge({ :Port => 3001, :environment => (ENV['RAILS_ENV'] || "development").dup, :daemonize => false, :debugger => false, :pid => File.expand_path("tmp/pids/server.pid"), :config => File.expand_path("config.ru"), :SSLEnable => true, :SSLCertName => [["CN", WEBrick::Utils::getservername]], }) end end end end APP_PATH = File.expand_path('../../config/application', __FILE__) require_relative '../config/boot' require 'rails/commands'Then run server as...
$ SSL=true rails s
A Simple Ruby DSL
It's very easy to create a new language with ruby, here's a simple DSL
class SleepActivity def initialize(name) @name = name end def start(&block) sleep 1 puts "#{@name} goes to bed" instance_eval &block if block_given? end def slumber(&block) sleep 1 puts "#{@name} is starting to sleep" instance_eval &block if block_given? end def cycle(period, &block) sleep 1 period.times do |time| puts "Sleep cycle #{time + 1}:" instance_eval &block if block_given? end end def awake(duration) sleep 1 puts "Still awake for #{duration} minutes" end def light_sleep(duration) sleep 1 puts "Sleeping lightly for #{duration} minutes" end def deep_sleep(duration) sleep 1 puts "Sleeping deeply for #{duration} minutes" end def rem(duration) sleep 1 puts "REM for #{duration} minutes" end end if $PROGRAM_NAME == __FILE__ sleep_activity = SleepActivity.new("Sam") sleep_activity.start do awake 5 slumber do cycle 5 do light_sleep 20 deep_sleep 60 rem 10 end end end endHere's the output
samdc@mango:~/dev/ruby/projects/dsl$ ruby dsl_interpreter.rb Sam goes to bed Still awake for 5 minutes Sam is starting to sleep Sleep cycle 1: Sleeping lightly for 20 minutes Sleeping deeply for 60 minutes REM for 10 minutes Sleep cycle 2: Sleeping lightly for 20 minutes Sleeping deeply for 60 minutes REM for 10 minutes Sleep cycle 3: Sleeping lightly for 20 minutes Sleeping deeply for 60 minutes REM for 10 minutes Sleep cycle 4: Sleeping lightly for 20 minutes Sleeping deeply for 60 minutes REM for 10 minutes Sleep cycle 5: Sleeping lightly for 20 minutes Sleeping deeply for 60 minutes REM for 10 minutes
7.21.2015
Bash Cheat Sheet
1. Run a script with no output and in the background $ ./my_script.sh > /dev/null 2>&1 & 2. Run a script with no output and in the background and see the pid $ ./my_script.sh > /dev/null 2>&1 & echo $! 3. Template script that loops thru and writes to a file #!/bin/bash # $1 - number of minutes # $2 - task id COUNTER=$(($1*60/5)) TOTAL=$COUNTER echo Perfload will run for $1 minutes echo "Perfload will run for $1 minutes" > /tmp/$2.log until [ $COUNTER -eq 0 ]; do echo The counter is $COUNTER PROGRESS=$(echo "scale=2;($TOTAL - $COUNTER)*100/$TOTAL" | bc -l) echo "Perfload RUNNING $PROGRESS %" >> /tmp/$2.log let COUNTER-=1 sleep 5 done echo "Perfload SUCCESS" >> /tmp/$2.log
7.14.2015
Cisco Switch Cheat Sheet
sho lldp neighbors sho cdp ne switch-name# show mac address-table | i 0060.165c.f83e * 2016 0060.165c.f83e dynamic ~~~ F F Eth1/22 switch-name# sho int description | grep 'yogi34 eth4b' Eth8/19 eth 10G yogi34 eth4b 90E2BA068BB1 switch-name# show interface ethernet 2/27 description ------------------------------------------------------------------------------- Port Type Speed Description ------------------------------------------------------------------------------- Eth2/27 eth 10G artemis59-eth3b 0060.1645.505a switch-name(config)# config switch-name(config)# int e8/19 switch-name(config-if)# inherit port-profile Apposite switch-name(config-if)# exit switch-name(config)# exit switch-name# copy run startup-config switch-name# show interface ethernet 1/28 switchport # If missing VLANs, can set using... switch-name(config-if)# switchport trunk allow vlan 2016,2030-2049
5.15.2015
Configure VLAN tagging via CLI
1. Create VLAN interface # ip link add link eth4 name eth4.2030 type vlan id 2030 2. Assign IP # ifconfig eth4.2030 11.0.20.1 netmask 255.255.240.0 3. Make sure new interface is enabled # ifconfig eth4.2030 up 4. Check # ifconfig eth4.2030 eth4.2030 Link encap:Ethernet HWaddr 90:E2:BA:6D:B5:95 inet addr:11.0.20.1 Bcast:11.0.31.255 Mask:255.255.240.0 inet6 addr: fe80::92e2:baff:fe6d:b595/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:10 errors:0 dropped:0 overruns:0 frame:0 TX packets:6 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1046 (1.0 KiB) TX bytes:468 (468.0 b) 5. Remove VLAN # ip link delete eth4.2030
4.29.2015
Sync Clock Automatically on CentOS
Got it from here.
1. Install # yum install ntp ntpdate ntp-doc 2. Turn on service # chkconfig ntpd on 3. Sync one time # ntpdate pool.ntp.org 4. Configure ntpd # vi /etc/ntp.conf Add public servers server 0.rhel.pool.ntp.org server 1.rhel.pool.ntp.org server 2.rhel.pool.ntp.org 5. Start the NTP server. The following will continuously adjusts system time from upstream NTP server. No need to run ntpdate: # /etc/init.d/ntpd start
3.12.2015
Ansible for Configuration Management and IT automation
Wow, Ansible is a great tool for configuration management and IT automation. I got this reference from here and here.
1. Install ansible on your workstation (machine which will be the controller) $ sudo yum install ansible $ ansible --version 2. Create env variable $ export ANSIBLE_HOSTS=~/ansible/ansible_hosts 3. Create hosts file $ echo -e "perf-c690\nperf-c691" > ~/ansible/ansible_hosts 4. Do a quick ping $ ansible all -m ping --ask-pass 5. Now, let's create ssh keys (Should typically run using your own user account, have used root here for convenience) # ssh-keygen -t rsa 6. Copy public key to the remote machines $ ansible all -m copy -a "src=/root/.ssh/id_rsa.pub dest=/tmp/id_rsa.pub" --ask-pass -c paramiko Warning: error message: "Aborting, target uses selinux but python bindings (libselinux-python) aren't installed!" Which means we need to install libselinux-python on the remote machine prior to copying the files there. We can use ansible to do that for us. Install libselinux-python on remote machines $ ansible all -m yum -a "name=libselinux-python state=latest" -u root --ask-pass -c paramiko Now we can go back to copying the public key 7. Let's add the public key to the remote machines $ ansible all -m shell -a "cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys" --ask-pass -c paramiko 8. Test if we actually don't need any password $ ansible all -m shell -a "hostname" 9. Now we can do or install whatever on the remote machines, let's try installing expect $ ansible all -m yum -a "name=expect state=latest" -u root 10. We can remotely reboot all machines at once $ ansible all -a "/sbin/reboot" -u root
3.10.2015
Install Ruby via RVM on CentOS 6.5
Got install from here.
RVM best practices here.
How to use RVM gemsets here.
How to use Bundler here.
RVM best practices here.
How to use RVM gemsets here.
How to use Bundler here.
1. Install pre-requisites # yum groupinstall -y development 2. Install RVM # curl -L get.rvm.io | bash -s stable 3. Create system environment for RVM # source /etc/profile.d/rvm.sh 4. Install Ruby # rvm reload # rvm install 2.2.1 5. Check version of ruby installed # ruby --version 6. To see all rubies installed # rvm list rubies rvm rubies =* ruby-2.2.1 [ x86_64 ] # => - current # =* - current && default # * - default 7. To set a Ruby version as the default # rvm use 2.2.1 --default Using /usr/local/rvm/gems/ruby-2.2.1 8. Shortcut - create a new gemset along with a fresh .rvmrc in our project directory # cd projects/dev/phoenix # rvm --rvmrc --create use 2.2.1@phoenix ruby-2.2.1 - #gemset created /usr/local/rvm/gems/ruby-2.2.1@phoenix ruby-2.2.1 - #generating phoenix wrappers.......... Using /usr/local/rvm/gems/ruby-2.2.1 with gemset phoenix 9. To ignore rmvrc warnings ... # rvm rvmrc warning ignore all.rvmrcs 10. Now when we cd to our project directory we get a confirmation which ruby-version and gemset we are using... dev]# cd phoenix/ Using: /usr/local/rvm/gems/ruby-2.2.1@phoenix 11. Let's make use of bundler to make it easy to track and install the exact gems and versions for our project # gem install bundler 12. Create a Gemfile # bundle init Writing new Gemfile to /root/projects/dev/phoenix/Gemfile 13. Add gems to Gemfile # vi Gemfile source "https://rubygems.org" # 1. de facto XML/HTML parsing library gem 'nokogiri' 14. Now, let's install all gems we listed in the Gemfile # bundle install To create and use gemsets the longer way: a. Create gemset # rvm gemset create my_proj b. Use the gemset # rvm gemset use my_proj c. Install a gem # gem install package_name d. Wipe all gems installed # rvm gemset empty my_proj e. Delete the gemset # rvm gemset delete my_proj f. Check your current gemset # rvm gemset name
2.19.2015
Open HTTP port 80 on CentOS
Got from here.
1. Look at the current iptables # iptables --line -vnL Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT udp -- virbr0 * 0.0.0.0/0 0.0.0.0/0 udp dpt:53 2 0 0 ACCEPT tcp -- virbr0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:53 3 0 0 ACCEPT udp -- virbr0 * 0.0.0.0/0 0.0.0.0/0 udp dpt:67 4 0 0 ACCEPT tcp -- virbr0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:67 5 195K 212M ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 6 3 252 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 7 74 5440 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0 8 16 864 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 9 170K 39M REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited 2. Inject rule, as long as it's before the REJECT line # iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT 3. Save # service iptables save 4. Add httpd_t to the list of permissive domains (So we don't need to turn off selinux) # yum install policycoreutils-python # semanage permissive -a httpd_t
Perl specific installs for Centos 6.6
1. Enable RPMForge Repository # wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm # rpm -Uvh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm # rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt 2. Install perl installs MANUAL: 1. Dependency of Net::SSH::Perl # wget http://download.opensuse.org/repositories/home:/csbuild:/Perl/CentOS_CentOS-6/x86_64/perl-Math-GMP-2.04-2.5.x86_64.rpm # rpm -Uvh perl-Math-GMP-2.04-2.5.x86_64.rpm 2. Dependency of gnuplot for Chart::Graph::Gnuplot # wget http://www.my-guides.net/en/images/stories/fedora12/msttcore-fonts-2.0-3.noarch.rpm # rpm -Uvh msttcore-fonts-2.0-3.noarch.rpm YUM: # yum install perl-Math-BigInt-GMP # yum install perl-Math-Pari # yum install perl-Archive-Zip # yum install perl-Chart # yum install perl-DBI # yum install perl-DBD-MySQL # yum install perl-Data-Compare # yum install perl-Date-Manip # yum install perl-JSON # yum install perl-Net-Telnet # yum install perl-NetAddr-IP # yum install perl-Statistics-Descriptive # yum install perl-Text-Table # yum install perl-XML-Simple # yum install perl-XML-Writer # yum install gnuplot CPAN: # cpan Data::Diff # cpan HTML::TextToHTML # cpan XML::SemanticDiff # cpan Chart::Graph - this didn't install Force installed: cpan[1]> force install Net::Telnet::Brcd
2.13.2015
Install different versions of Perl on Linux using Perlbrew
Got from here and here.
What is perlbrew.
1. Install perfbrew $ curl -kL http://install.perlbrew.pl | bash 2. Modify .bashrc and add: source ~/perl5/perlbrew/etc/bashrc 3. Initialize $ perlbrew init 4. Select mirror $ perlbrew mirror 5. See what's available $ perlbrew available perl-5.20.1 perl-5.18.4 perl-5.16.3 perl-5.14.4 6. Install perls $ perlbrew install perl-5.20.1 # did not work for Centos 6.5 $ perlbrew --notest install perl-5.20.1 7. See what were installed $ perlbrew list 8. Swith to an installation and set it as default $ perlbrew switch perl-5.20.1 9. Temporarily use another version only in current shell. $ perlbrew use perl-5.20.1 $ perl -v 10. Or turn it off completely. Useful when you messed up too deep. Or want to go back to the system Perl. $ perlbrew off 11. Use 'switch' command to turn it back on. $ perlbrew switch perl-5.20.1 12. Exec something with all perlbrew-ed perls $ perlbrew exec -- perl -E 'say $]' 13. Install cpanm $ perlbrew install-cpanm 14. Install cpan modules $ cpanm install File::Copy::Recursive XML::Simple etc
2.07.2015
Ruby Notes
While reading RubyMonk tutorials
1. Truthiness of objects in Ruby
Only objects false and nil equates to false. Every other object like say 1, 0, "" are all evaluated to be true.
2. Use break in infinite loops
1. Truthiness of objects in Ruby
Only objects false and nil equates to false. Every other object like say 1, 0, "" are all evaluated to be true.
2. Use break in infinite loops
loop do monk.meditate break if monk.nirvana? end3. Append to an array, use << operator
[1, 2, 3, 4, 5] << 'woot' [1, 2, 3, 4, 5, "woot"]4. Filter elements of an array, use 'select'
names = ['rock', 'paper', 'scissors', 'lizard', 'spock'] names.select { |word| word.length > 5 }5. Delete elements of an array, use 'delete_if'
[1,2,3,4,5,6,7,8,9].delete_if { |i| i % 2 == 0 }6. Methods are themselves objects, and responds using 'call'
next_method_object = 1.method("next") puts next_method_object.call7. Beware of shallow object copies, to do a deep copy use Marshal
new_job = Marshal.load(Marshal.dump(job))8. Use heredoc for convenient multiline strings. The dash ignores spaces before placeholder. The gsub takes care of removing spaces at beginning of each line.
def long_message puts <<-EOT.gsub(/^\s*/, '') Here goes a very long message... Sincerely, Dr. Foobear EOT end7. Use 'send' when testing private methods
# obj.send(:method_name, args) @parser.send(:running?, test_strings)
1.21.2015
Use iperf to measure network link bandwidth
Nice writeup on how to use iperf. Another example, writeup.
Bandwidth : Refers how fast a device can send data over a single communication channel.
Throughput: Refers how fast a device is actually sending data over the communication channel.
1. Install iperf $ sudo yum install iperf 2. Start server on another system: $ iperf -s ------------------------------------------------------------ Server listening on TCP port 5001 TCP window size: 85.3 KByte (default) ------------------------------------------------------------ [ 4] local 10.1.1.1 port 5001 connected with 10.0.0.1 port 46699 [ ID] Interval Transfer Bandwidth [ 4] 0.0-10.3 sec 107 MBytes 87.7 Mbits/sec 3. Start client from your system specifying server ip: $ iperf -c 10.1.1.1 ------------------------------------------------------------ Client connecting to 10.1.1.1, TCP port 5001 TCP window size: 85.0 KByte (default) ------------------------------------------------------------ [ 3] local 10.0.0.1 port 46699 connected with 10.1.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.1 sec 107 MBytes 89.0 Mbits/sec 4. Use options, e.g., -t duration, -i interval between measurements $ iperf -c 10.1.1.1 -t 20 -i 2 ------------------------------------------------------------ Client connecting to 10.1.1.1, TCP port 5001 TCP window size: 85.0 KByte (default) ------------------------------------------------------------ [ 3] local 10.0.0.1 port 46761 connected with 10.1.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0- 2.0 sec 17.6 MBytes 73.9 Mbits/sec [ 3] 2.0- 4.0 sec 22.5 MBytes 94.4 Mbits/sec [ 3] 4.0- 6.0 sec 21.2 MBytes 89.1 Mbits/sec [ 3] 6.0- 8.0 sec 22.6 MBytes 94.9 Mbits/sec [ 3] 8.0-10.0 sec 22.5 MBytes 94.4 Mbits/sec [ 3] 10.0-12.0 sec 21.2 MBytes 89.1 Mbits/sec [ 3] 12.0-14.0 sec 22.6 MBytes 94.9 Mbits/sec [ 3] 14.0-16.0 sec 22.5 MBytes 94.4 Mbits/sec [ 3] 16.0-18.0 sec 21.2 MBytes 89.1 Mbits/sec [ 3] 18.0-20.0 sec 22.5 MBytes 94.4 Mbits/sec [ 3] 0.0-20.1 sec 217 MBytes 90.6 Mbits/secJust want to take note: Bandwidth vs Throughput
Bandwidth : Refers how fast a device can send data over a single communication channel.
Throughput: Refers how fast a device is actually sending data over the communication channel.
1.20.2015
Network 2 ubuntu systems via crossover cable
Got from here.
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case
1. Pick one of the computers to be the server. If one computer has a connection to the Internet use that as the server. 2. On the server click the network indicator and chose "Edit Connections...". Select the Ethernet connection then click the "Edit..." button. Go to the IPv4 tab and change "Method" from "Automatic (DHCP)" to "Shared to other computers". 3. Connect the two computers together using an Ethernet cable. The second computer will get assigned an IP address from the server and get access to the Internet. If you have old hardware you may need to make sure the Ethernet cable is a crossover cable. Modern hardware automatically does the crossover.==============================================
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case
Install and setup Samba on Ubuntu
Got from here.
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case
1. Install samba $ sudo apt-get update $ sudo apt-get install samba 2. Set a password for samba user $ sudo smbpasswd -a samdc New SMB password: Retype new SMB password: Added user samdc. 3. Create a directory to be shared $ sudo mkdir /data1/staging 4. Make sure user has access $ sudo chown samdc:samdc /data1/staging 5. Make a backup copy of smb.conf $ cp /etc/samba/smb.conf ~ 6. Edit smb.conf $ sudo vi /etc/samba/smb.conf Add this to the very end of the file: [staging] path = /data1/staging available = yes valid users = samdc read only = no browseable = yes public = yes writable = yes 7. Restart samba $ sudo service smbd restart 8. Check smb.conf for any syntax errors $ testparm 9. To access network share Linux: smb://<HOST_IP_OR_NAME>/<folder_name>/ smb://10.42.0.1/staging/ Windows: \\<HOST_IP_OR_NAME>\<folder_name>\ \\10.42.0.1\staging\==============================================
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case
1.07.2015
Prepare FC19 for RabbitMQ development
Got RabbitMQ install from here and here.
Install Erlang
1. $ sudo yum install erlang
Install RabbitMQ from RPM
2. $ sudo rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc 3. $ sudo rpm -Uvh http://www.rabbitmq.com/releases/rabbitmq-server/v3.4.3/rabbitmq-server-3.4.3-1.noarch.rpm (or grab latest here)
Configure RabbitMQ SSL
TODO: outline steps
Install RabbitMQ management console
4. $ sudo rabbitmq-plugins enable rabbitmq_management
Open Firewall
5. $ firewall-cmd --permanent --add-port=5672/tcp 6. $ firewall-cmd --reload 7. $ setsebool -P nis_enabled 1
Start RabbitMQ as a daemon by default
8. $ sudo chkconfig rabbitmq-server on # To start the service: /sbin/service rabbitmq-server start # To stop the service: /sbin/service rabbitmq-server stop # To restart the service: /sbin/service rabbitmq-server restart # To check the status: /sbin/service rabbitmq-server status
Open RabbitMQ management UI
10. Browse to http://localhost:15672/
Install Bunny (Ruby Development)
9. $ gem install bunny Fetching: amq-protocol-1.9.2.gem (100%) Successfully installed amq-protocol-1.9.2 Fetching: bunny-1.6.3.gem (100%) Successfully installed bunny-1.6.3 2 gems installed Enjoy!
1.06.2015
p4 diff output colorizer
Create a ruby file p4c.rb:
#!/usr/local/bin/ruby -w # encoding: UTF-8 # # A simply `p4 diff` output colorizer. # Got this from: # http://writequit.org/blog/?p=341 FILE_R = /^====\s+([\s\S]+)(#\d+) - ([\s\S]+) ====$/ POS_R = /^(\d+[ad]\d+)$/ OUT_R = /^< / IN_R = /^> / ## Escape sequences for colors ## Misc $RESET = "\033[0m" $BOLD = "\033[1m" $BLINK = "\033[5m" ## Foreground colors $BLACK = "\033[30m" $RED = "\033[31m" $GREEN = "\033[32m" $BROWN = "\033[33m" $BLUE = "\033[34m" $MAGENTA = "\033[35m" $CYAN = "\033[36m" $WHITE = "\033[37m" $stdin.each_line do |line| line.chomp! if line =~ FILE_R puts "#{$MAGENTA}" + line + "#{$RESET}" elsif line =~ POS_R puts "#{$CYAN}" + line + "#{$RESET}" elsif line =~ OUT_R puts "#{$RED}" + line + "#{$RESET}" elsif line =~ IN_R puts "#{$GREEN}" + line + "#{$RESET}" else puts line end endYou can call it like this...
$ p4 diff Module.pm | ~/bin/p4c.rb # or with an alias: colorize='~/bin/p4c.rb' $ p4 diff Module.pm | colorize
My .aliases
My collection of bash knick knacks.
alias 2proj='cd /auto/home/samdc/projects' # cd to a directory that is relative to 2proj directory function 2p() { 2proj && cd $@ ;} # list resources files # use: res filename* function res() { 2proj && cd common/resources/ && ls -l */$@ ; } # diff color alias colorize='~/bin/p4c.rb'
1.05.2015
Things to do after installing Ubuntu 14.10 Utopic Unicorn
I got this from here, here, here and here.
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case
1. Enable partner repository $ sudo sed -i "/^# deb .*partner/ s/^# //" /etc/apt/sources.list && apt-get update 2. Download and Install GetDeb and PlayDeb $ echo "Downloading GetDeb and PlayDeb" && wget http://archive.getdeb.net/install_deb/getdeb-repository_0.1-1~getdeb1_all.deb http://archive.getdeb.net/install_deb/playdeb_0.3-1~getdeb1_all.deb && echo "Installing GetDeb" && sudo dpkg -i getdeb-repository_0.1-1~getdeb1_all.deb && echo "Installing PlayDeb" && sudo dpkg -i playdeb_0.3-1~getdeb1_all.deb && echo "Deleting Downloads" && rm -f getdeb-repository_0.1-1~getdeb1_all.deb && rm -f playdeb_0.3-1~getdeb1_all.deb 3. Add PPAs (Personal Package Archives) $ sudo add-apt-repository -y ppa:videolan/stable-daily $ sudo add-apt-repository -y ppa:otto-kesselgulasch/gimp $ sudo add-apt-repository -y ppa:gnome3-team/gnome3 $ sudo add-apt-repository -y ppa:webupd8team/java $ sudo add-apt-repository -y ppa:webupd8team/y-ppa-manager $ sudo add-apt-repository -y ppa:transmissionbt/ppa $ echo 'deb http://download.videolan.org/pub/debian/stable/ /' | sudo tee -a /etc/apt/sources.list.d/libdvdcss.list && echo 'deb-src http://download.videolan.org/pub/debian/stable/ /' | sudo tee -a /etc/apt/sources.list.d/libdvdcss.list && wget -O - http://download.videolan.org/pub/debian/videolan-apt.asc|sudo apt-key add - 4. Update and upgrade $ sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade 5. Install essentials $ sudo apt-get install synaptic vlc gimp gimp-data gimp-plugin-registry gimp-data-extras y-ppa-manager bleachbit openjdk-7-jre oracle-java8-installer flashplugin-installer unace unrar zip unzip p7zip-full p7zip-rar sharutils rar uudeview mpack arj cabextract file-roller flac faac faad sox ffmpeg2theora libmpeg2-4 uudeview mpeg3-utils mpegdemux liba52-dev mpeg2dec vorbis-tools id3v2 mpg321 mpg123 libflac++6 totem-mozilla icedax lame libmad0 libjpeg-progs libdvdcss2 libdvdread4 libdvdnav4 ubuntu-restricted-extras ubuntu-wallpapers* 6. Install additional drivers Open Software & Updates > Additional Drivers, install as needed 7. Install Google Chrome $ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && sudo dpkg -i google-chrome-stable_current_amd64.deb && rm -f google-chrome-stable_current_amd64.deb 8. Install VirtualBox Verify if virtualbox packages are included in multiverse repository $ apt-cache policy virtualbox virtualbox: Installed: (none) Candidate: 4.3.18-dfsg-1 Version table: 4.3.18-dfsg-1 0 500 http://in.archive.ubuntu.com/ubuntu/ utopic/multiverse amd64 Packages Update repository then install $ sudo add-apt-repository multiverse $ sudo apt-get update $ sudo apt-get install virtualbox 9. Install TrueCrypt To install: sudo add-apt-repository ppa:stefansundin/truecrypt sudo apt-get update sudo apt-get install truecrypt To automatically grant TrueCrypt sudo powers, edit sudoers with "sudo visudo" and add this (important: add it to the end of the file!): your_username ALL=(ALL) NOPASSWD:/usr/bin/truecrypt Using "sudo visudo" makes sure you don't damage the file and prevent your system to boot. Never edit the sudoers file directly. If you're wondering why TrueCrypt exits when you hide it, go to Preferences » Background Task » uncheck "Exit when there are no mounted volumes". 10. Install vim with perl/python/ruby support $ sudo apt-get remove vim-tiny vim vim-nox $ sudo apt-get build-dep vim $ sudo apt-get install mercurial $ hg clone https://vim.googlecode.com/hg/ vim74 $ cd vim74 $ ./configure --enable-perlinterp --enable-pythoninterp --enable-rubyinterp --enable-cscope --with-features=huge --prefix=/usr $ sudo make $ sudo make install 11. Adjust privacy System Settings > Security & Privacy Files & Applications - turn OFF Search - turn OFF 12. Disable system crash reports $ sudo vim /etc/default/apport Change to: enabled=0 $ sudo service apport stop 13. Show menus in window's title bar System Settings > Appearance > Behavior 14. Change display scale System Settings ~ Displays ~ Scale for menu and title bars ~ adjust to 0.875 15. Install TweakTools or Unity Tweak Tools $ sudo apt-get install unity-tweak-tool gnome-tweak-tool Open Unity Tweak Tool and select "Minimize single window applications on click" 16. Install Skype 17. Install dupeGuru $ sudo add-apt-repository ppa:hsoft/ppa $ sudo apt-get update $ sudo apt-get install dupeguru* 18. Install Unison $ sudo apt-get install unison unison-gtk 19. To watch silverlight based video streams (HBO Go, etc) $ sudo add-apt-repository ppa:mjblenner/ppa-hal $ sudo apt-get update $ sudo apt-get install hal $ cd ~/.adobe/Flash_Player $ rm -rf NativeCache AssetCache APSPrivateData2 $ sudo add-apt-repository ppa:pipelight/stable $ sudo apt-get update $ sudo apt-get install --install-recommends pipelight-multi $ sudo pipelight-plugin --update $ sudo pipelight-plugin --enable silverlight 20. Card reader support $ sudo apt-get install exfat-fuse exfat-utils 21. Clean up echo "Cleaning Up" && sudo apt-get -f install && sudo apt-get autoremove && sudo apt-get -y autoclean && sudo apt-get -y clean==============================================
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case
Best Way to Check Version of IE?
Just add this to the page...
<!--[if lt IE 9 ]> <script> var is_ie_lt9 = true; </script> <![endif]-->Or in my case, I just wanted to display that they are using IE 8, then suggest to use a different browser...
<!--[if lte IE 8]> <h2 style="background-color:red;color:white;text-align:center;padding:10px;">You are using Internet Explorer 8 or older. Please use Firefox or Chrome for proper display of this page.</h2> <![endif]-->
1.04.2015
Add and Delete Users on Ubuntu 14.10
1. Create user samdc@mango:~$ sudo adduser raqueldc [sudo] password for samdc: Adding user `raqueldc' ... Adding new group `raqueldc' (1001) ... Adding new user `raqueldc' (1001) with group `raqueldc' ... Creating home directory `/home/raqueldc' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for raqueldc Enter the new value, or press ENTER for the default Full Name []: Raquel Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] 2. Delete user Delete account: samdc@mango:~$ sudo userdel newuser Delete home directory samdc@mango:~$ sudo rm -rf /home/newuser==============================================
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case
Move home dir to another drive
Got it from here.
First install the drive, then follow these steps:
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case
First install the drive, then follow these steps:
1. Find UUID of the partition root@mango:~# blkid /dev/sdb1: UUID="8b1e1564-d7b6-4ef4-9ffd-d7d191251cc2" TYPE="ext4" PARTUUID="0835b8cd-01" 2. Modify fstab root@mango:~# vim /etc/fstab Add this line UUID=8b1e1564-d7b6-4ef4-9ffd-d7d191251cc2 /media/home ext4 defaults 0 2 3. Create temporary mount point root@mango:~# mkdir /media/home 4. Reload fstab root@mango:~# mount -a 5. Copy /home to new partition root@mango:~# rsync -aXS --exclude='/*/.gvfs' /home/. /media/home/. 6. Prepare fstab for the switch root@mango:/home/samdc# vim /etc/fstab Modify this line to: UUID=8b1e1564-d7b6-4ef4-9ffd-d7d191251cc2 /home ext4 defaults 0 2 7. Do the switch root@mango:~# cd / && sudo mv /home /old_home && sudo mkdir /home 8. Reload fstab root@mango:/# mount -a 9. Delete old home root@mango:/# rm -r /old_home 10. Reboot==============================================
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case
Install a new hard drive
Got it from here.
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case
1. Partition disk samdc@mango:/dev$ sudo fdisk /dev/sdc Welcome to fdisk (util-linux 2.25.1). 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. Created a new DOS disklabel with disk identifier 0xb73af669. Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-1953525167, default 2048): 2048 Last sector, +sectors or +size{K,M,G,T,P} (2048-1953525167, default 1953525167): Created a new partition 1 of type 'Linux' and of size 931.5 GiB. Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. 2. Format disk samdc@mango:/dev$ sudo mkfs -t ext4 /dev/sdc1 mke2fs 1.42.10 (18-May-2014) Creating filesystem with 244190390 4k blocks and 61054976 inodes Filesystem UUID: 6dba4379-83fa-4288-b390-98574bc24bb2 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000, 214990848 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done 3. Modify reserved space samdc@mango:/dev$ sudo tune2fs -m 1 /dev/sdc1 tune2fs 1.42.10 (18-May-2014) Setting reserved blocks percentage to 1% (2441903 blocks) 4. Label disk samdc@mango:/dev$ sudo e2label /dev/sdc1 DataDisk2 5. Create mount point samdc@mango:/dev$ sudo mkdir /data2 6. Mount the drive Automatic mount at boot: root@mango:/dev# vim /etc/fstab Add this line (find out UUID of the disk via blkid): UUID=6dba4379-83fa-4288-b390-98574bc24bb2 /data2 ext4 defaults 0 2 For changes to take effect: root@mango:/dev# mount -a Manually mount/unmount: sudo mount /dev/sdc1 /data2 sudo umount /data2==============================================
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case
Find out what disks are in the system
root@mango:/dev# sfdisk -l Disk /dev/sda: 29185 cylinders, 255 heads, 63 sectors/track sfdisk: Warning: extended partition does not start at a cylinder boundary. DOS and Linux will interpret the contents differently. Units: cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0 Device Boot Start End #cyls #blocks Id System /dev/sda1 * 0+ 27135- 27136- 217963520 83 Linux /dev/sda2 27135+ 29185- 2050- 16464897 5 Extended /dev/sda3 0 - 0 0 0 Empty /dev/sda4 0 - 0 0 0 Empty /dev/sda5 27135+ 29185- 2050- 16464896 82 Linux swap / Solaris Disk /dev/sdb: 121601 cylinders, 255 heads, 63 sectors/track Disk /dev/sdc: 121601 cylinders, 255 heads, 63 sectors/track root@mango:/dev# lshw -class disk *-disk description: ATA Disk product: OCZ-ARC100 physical id: 0.0.0 bus info: scsi@0:0.0.0 logical name: /dev/sda version: 1.00 serial: A22L1061449007331 size: 223GiB (240GB) capabilities: partitioned partitioned:dos configuration: ansiversion=5 sectorsize=512 signature=2a960743 *-disk description: ATA Disk product: WDC WD10EZEX-00B vendor: Western Digital physical id: 0.0.0 bus info: scsi@1:0.0.0 logical name: /dev/sdb version: 1A01 serial: WD-WCC3F3NFSS65 size: 931GiB (1TB) configuration: ansiversion=5 sectorsize=4096 *-cdrom description: DVD-RAM writer product: iHAS124 E vendor: ATAPI physical id: 0.0.0 bus info: scsi@3:0.0.0 logical name: /dev/cdrom logical name: /dev/cdrw logical name: /dev/dvd logical name: /dev/dvdrw logical name: /dev/sr0 version: 4L08 capabilities: removable audio cd-r cd-rw dvd dvd-r dvd-ram configuration: ansiversion=5 status=nodisc *-disk description: ATA Disk product: WDC WD10EZEX-00B vendor: Western Digital physical id: 0.0.0 bus info: scsi@4:0.0.0 logical name: /dev/sdc version: 1A01 serial: WD-WCC3F1CX4JKE size: 931GiB (1TB) configuration: ansiversion=5 sectorsize=4096 root@mango:/dev# lsblk -f NAME FSTYPE LABEL UUID MOUNTPOINT sda ├─sda1 ext4 1987feef-7ad1-4e00-8578-9559d8aff148 / ├─sda2 └─sda5 swap c17c259d-e3a8-4220-9f0d-9df4af33fa34 [SWAP] sdb sdc sr0 root@mango:/dev# blkid /dev/sda1: UUID="1987feef-7ad1-4e00-8578-9559d8aff148" TYPE="ext4" PARTUUID="2a960743-01" /dev/sda5: UUID="c17c259d-e3a8-4220-9f0d-9df4af33fa34" TYPE="swap" PARTUUID="2a960743-05" root@mango:/dev# ls -l /dev/disk/by-uuid/ total 0 lrwxrwxrwx 1 root root 10 Jan 4 08:24 1987feef-7ad1-4e00-8578-9559d8aff148 -> ../../sda1 lrwxrwxrwx 1 root root 10 Jan 4 08:24 c17c259d-e3a8-4220-9f0d-9df4af33fa34 -> ../../sda5==============================================
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case
New System 2015
I built a new system this winter break...
==============================================
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case
==============================================
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case
Subscribe to:
Posts (Atom)