ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login
    1. Topics
    2. stacksofplates
    3. Best
    • Profile
    • Following 0
    • Followers 13
    • Topics 145
    • Posts 7,946
    • Best 2,861
    • Controversial 1
    • Groups 0

    Best posts made by stacksofplates

    • KVM Snapshot/Backup Script

      So I posted a snapshot export script on here a long time ago, and it wasn't really correct. It created an overlay disk of a backing store and exported the backing store. Red Hat doesn't include the most up to date version of QEMU, so they can push RHEV. RHEL/CentOS 7 only comes with QEMU 1.5, and for live snapshots you need at least 2.0. So if you ad the oVirt repos you can get the newest version with the package qemu-kvm-rhev, or use Fedora server. Here's a script I wrote to take a live external snapshot and compress it to a location. I used my normal template with the interactive function. vmLocation is the location of your VMs. I usually keep mine in the same area. I should add full paths for everything, but I'm lazy this evening. I'll add them later. I also need to add some error handling but this is a rough start if anyone needs to use it.

      #!/bin/bash
      
      
      vmLocation="/data/VMs"
      
      today=$(date +%m-%d-%Y)
      
      
      
      #Script functions
      function script_help () {
        echo "
            Usage: $(basename $0) [options] dom-name snap-name save-location disk-name
      
                -i   Ineractive mode
      
                -h   this help text
      
                dom-name        Name of domain to take snapshot of
      
                snap-name       Name of snapshot
      
                save-location   location to copy snapshot to
      
                disk-name       Name of disk in VM
      
            Example:
              $(basename $0) bind-server bind-snap01 /export/snaps/ vda"
      
        exit ${1:-0}
      }
      
      function interactive_snap () {
      
        echo "Domain name"
        read name
      
        echo "Snapshot name"
        read snap
      
        echo "Location to save snap"
        read location
      
        echo "Disk name"
        read disk
      
        virsh dumpxml $name > $location/$name.xml
      
        diskPath=$(virsh domblklist $name | grep -i $disk | awk '{ print $2 }')
      
        virsh snapshot-create-as --domain $name $snap --diskspec $disk,file=$vmLocation/$snap.qcow2 --disk-only --atomic
      
        tar -czvf $location/$snap-$today.tar.gz $diskPath
      
        virsh blockcommit $name $disk --active --verbose --pivot
      
        rm -f $vmLocation/$snap.qcow2
      
        virsh snapshot-delete --metadata $name $snap
      
        exit ${1:-0}
      
      }
      
      function argument_snap () {
      
        virsh dumpxml $name > $location/$name.xml
      
        diskPath=$(virsh domblklist $name | grep -i $disk | awk '{ print $2 }')
      
        virsh snapshot-create-as --domain $name $snap --diskspec $disk,file=$vmLocation/$snap.qcow2 --disk-only --atomic
      
        tar -czvf $location/$snap-$today.tar.gz $diskPath
      
        virsh blockcommit $name $disk --active --verbose --pivot
      
        rm -f $vmLocation/$snap.qcow2
      
        virsh snapshot-delete --metadata $name $snap
      
        exit ${1:-0}
      
      
      
      }
      
      #Show help if no arguments or options are passed
      [[ ! "$*" ]] && script_help 1
      OPTIND=1
      
      
      #Read command line options
      while getopts "ih" opt; do
          case "$opt" in
            i) interactive_snap ;;
            h) script_help ;;
            \?) script_help 1 ;;
          esac
      done
      shift $(($OPTIND-1));
      
      #Run argument function
      name=$1
      snap=$2
      location=$3
      disk=$4
      argument_snap
      
      posted in IT Discussion kvm snapshots qcow2 linux virtualization
      stacksofplatesS
      stacksofplates
    • RE: What Are You Doing Right Now

      Well it's official now. I start on Monday as a senior systems engineer with Curtiss-Wright.

      posted in Water Closet
      stacksofplatesS
      stacksofplates
    • Dynamic DNS with CloudFlare

      So I have a dynamic DNS service for my ERL, but it's not in my actual domain. So I made a small script that updates my CloudFlare DNS from my ERL with their API. There is a cron job that just runs this script every 5 minutes.

      #!/bin/bash
      
      key="your-api-key"
      zoneID="your-zone-id"
      email="[email protected]"
      recordID="record-id-to-update"
      recordName="newrecord.yourdomain.com"
      ip=$(ifconfig eth0 | grep "inet addr:" | cut -d: -f2 | awk '{ print $1 }')
      
      curl -X PUT "https://api.cloudflare.com/client/v4/zones/$zoneID/dns_records/$recordID" \
           -H "X-Auth-Email: $email" \
           -H "X-Auth-Key: $key" \
           -H "Content-Type: application/json" \
           --data '{"type":"A","name":"'"$recordName"'","content":"'"$ip"'","ttl":120,"proxied":false}' -k
      

      You do have to get the record id from the API. I haven't found a way to get it through the web interface. So that means you have to create the record initially, either through the API or the web interface (or use an existing one). Once you have the ID, just paste it in the variable.

      posted in IT Discussion cloudflare api linux dns edge router
      stacksofplatesS
      stacksofplates
    • RE: What Are You Doing Right Now

      Guys I have a server I'm running to display a slideshow of my cats. It has to run 28/8/368. Downtime is not an option, I can't not see my cat's pictures. I need 40 TB of storage in RAID 0 for ultra redundancy and my budget is some change I found in the parking lot. Can anyone help me?

      posted in Water Closet
      stacksofplatesS
      stacksofplates
    • KVM Setup

      Ok so it seems there's a bit of confusion for how this is set up. On CentOS and Fedora workstations you don't need to do this because it's installed by default. For the servers it's just as easy.

      On CentOS just choose software and then virtualization host:

      0_1502146188845_software.png
      0_1502146200888_virt-host.png

      On Fedora under software choose headless virtualization:

      0_1502146216302_fedora.png

      That's literally all the steps needed to have a working KVM hypervisor. If you want a GUI to manage with then install Virt-Manager on your workstation:

      dnf install virt-manager
      

      or

      yum install virt-manager
      

      Then connect to your host:

      0_1502146361204_connection.png

      posted in IT Discussion kvm virt-manager centos fedora linux hypervisor
      stacksofplatesS
      stacksofplates
    • Re:scam. This is amazing

      Youtube Video

      posted in IT Discussion scam email ai
      stacksofplatesS
      stacksofplates
    • RE: Decent budget NAS

      WD MyCloud. I hear they're easy to remote support.

      posted in IT Discussion
      stacksofplatesS
      stacksofplates
    • RE: Merits of Staying Long Term with a Job or Moving More Rapidly

      @scottalanmiller said in Merits of Staying Long Term with a Job or Moving More Rapidly:

      There are a lot of opinions on this subject. What do people think, what have you found? Should you lean towards sticking with one employer and staying for a long time and working your way up? (Linear job progression.) Or should you lean towards looking for external opportunities and moving to other companies (Lateral job progression?)

      I think both have their place. If you are somewhere where you can stay for a while and move up that's awesome. Just don't get complacent so if you ever have to leave you can.

      posted in IT Careers
      stacksofplatesS
      stacksofplates
    • RE: What Are You Doing Right Now

      @dafyre said:

      And Suddenly @scottalanmiller disappears for hours. Guess we can go back to the #wheressam feed again?

      Carmen SAMdiego Hehe

      0_1454592445935_carmensamdiego.jpg

      posted in Water Closet
      stacksofplatesS
      stacksofplates
    • Vagrant Libvirt and Fedora 30

      If any of you use vagrant-libvirt and upgraded to Fedora 30 you might notice something strange. I finally figured it out after reviewing a pull request. Vagrant-libvirt was only using the user-session and not the default session even if you are in the libvirt group. So your networks wouldn't be available to the Vagrant boxes. Here's how to fix it:

      Put the following in ~/.vagrant.d/Vagrantfile

      Vagrant.configure("2") do |config|
        config.vm.provider :libvirt do |libvirt|
          libvirt.qemu_use_session = false
        end
      end
      

      Now it should behave like it used to before Fedora 30.

      posted in IT Discussion
      stacksofplatesS
      stacksofplates
    • RE: Oracle Linux Installation and performance seems insanely bad

      @DustinB3403 said in Oracle Linux Installation and performance seems insanely bad:

      Your ability to comprehend this is obviously not developed.

      Yo, adult time. Are you like 12 years old? Are you putting in a big league chew while smoking candy cigarettes behind the monitor while you type this stuff? I can see how you didn't get what he was saying, but honestly I don't understand why you can't reply to people you disagree with like an adult. This is supposed to be a professional forum and you're here acting like you're the tough guy at recess. Slow your roll scooter and try to be professional.

      posted in Water Closet
      stacksofplatesS
      stacksofplates
    • RE: SSH Key Pairs

      Since the images disappeared, I added them as code.

      Also, Identity Management (FreeIPA) makes it really easy to store public keys in LDAP so any system joined to IdM can verify the key.

      posted in IT Discussion
      stacksofplatesS
      stacksofplates
    • Gophemeral

      I wrote this utility. It's for sharing secrets or any sensitive data. Instead of just emailing or texting the data, you can create a message with this service and it will encrypt the data and store it. It will only allow the message to be viewed whatever number of times you specify. It gives you back a message ID and password that you pass on to your recipient and they can retrieve the message.

      You can use the hosted version, which is limited to 50 characters, and 5 days of retention. Or you can run the server on your own.

      By default the server will use Fauna as a backend, but you can specify to use a local BoltDB database. The utility can be downloaded from GitLab here and the same cli tool that runs the server also interacts with the server.

      https://gophemeral.com

      posted in IT Discussion
      stacksofplatesS
      stacksofplates
    • RE: Copying Content from other sources

      @mattspeller said in Copying Content from other sources:

      Sounds like it's time to make orange dinosaur memes

      0_1517447389373_hehe.png

      posted in Announcements
      stacksofplatesS
      stacksofplates
    • Red Hat Open Sources Ansible Galaxy

      http://www.zdnet.com/article/red-hat-open-sources-ansible-galaxy-for-all/

      posted in News red hat ansible devops linux open source
      stacksofplatesS
      stacksofplates
    • RE: What Are You Doing Right Now

      On my way to another interview

      posted in Water Closet
      stacksofplatesS
      stacksofplates
    • SSH Key Pairs

      To make access to our servers easier and more secure, we use SSH keys. When you create a key pair, you get a private key and a public key. The public key is transferred to the remote server and your private key stays on your device.

      Create the keys like this:

      ssh-keygen -t ecdsa -b 521
      

      In your home folder you will have a hidden folder named .ssh. Inside there will be a file named id_rsa which is your private key, and a file called id_rsa.pub which is your public file.

      You send the key to a server like this:

      ssh-copy-id user@host
      

      This will create a file inside the .ssh folder on the server named authorized_keys which will hold all of the public keys.

      This can be cumbersome if you need to add your key to multiple servers at once. Orchestration tools can make this process easier. With Ansible it's as easy as:

      - name: Copy SSH key
        authorized_key:
          user: jhooks
          state: present
          key: "{{ lookup('file', '/home/jhooks/.ssh/id_ecdsa.pub') }}"
      

      There are other methods for SSH key management like DNSSEC but I have not used them, so I can't comment on them.

      posted in IT Discussion ssh key management ssh keys public key private key ansible linux remote acces linux
      stacksofplatesS
      stacksofplates
    • RE: Congratulations to Mr. & Mrs. Plates

      Thanks everyone. He was 6 weeks early and they had to give him CPR when he came out because he wasn't breathing. He finally started but they flew him to children's hospital. He's doing well now.

      posted in News
      stacksofplatesS
      stacksofplates
    • RE: What Are You Doing Right Now

      http://hackaday.com/2016/05/16/raspberry-pis-sweeten-a-librarys-bottom-line/

      posted in Water Closet
      stacksofplatesS
      stacksofplates
    • I wrote a thing

      I wrote a utility in Go to get unique strings like the uniq utility. The plus side to mine is you don't need to sort the input, it's faster, and cross platform. You can run over stdin or a file.

      https://gitlab.com/hooksie1/goniq

      Here's a timed run with 2,799,264 words. It's a list of 466,544 words repeated 6 times.

      time sort allwords.txt | uniq
      sort allwords.txt  6.58s user 0.21s system 127% cpu 5.348 total
      uniq  2.88s user 0.79s system 68% cpu 5.347 total
      
      time goniq allwords.txt
      goniq allwords.txt  1.96s user 0.81s system 114% cpu 2.428 total
      

      But even with a sorted list it's still faster:

      uniq allwordssorted.txt  2.90s user 0.73s system 99% cpu 3.651 total
      
      goniq allwordssorted.txt  1.66s user 0.74s system 120% cpu 1.986 total
      
      posted in IT Discussion
      stacksofplatesS
      stacksofplates
    • 1
    • 2
    • 3
    • 4
    • 5
    • 143
    • 144
    • 1 / 144