Level 7 Cloud
0 FOLLOWERS
Tech blog providing IT solutions using open source software, scripts, and automation tools. Come and view some of the solutions that we have come up with
Level 7 Cloud
5y ago
In the following blog link I explained what Volume Groups and Logical Volumes are and how to create and expand them. In this blog I am going to continue on that work and go into details on how to shrink and remove logical volumes and physical volumes.
Working with Logical Volume Manager (LVM)
Commands Used
As I did in the last post I am putting the commands that I am using at the top for easier reference at a later date.
# Mount Commands
umount <directory>
mount -a # Mount the volumes in /etc/fstab
# LVM commands
lvdisplay
lvreduce -L 40G --resizefs /dev/<vg_name ..read more
Level 7 Cloud
5y ago
The logical volume manager allows for quick and easy management of the space within your linux server. Below is an image from Wikipedia which gives a good representation of the structure within the logical volume manager. I will go through the different aspects to try and help you understand how they work as well as provide commands to perform the different actions.
https://upload.wikimedia.org/wikipedia/commons/thumb/e/e6/Lvm.svg/1024px-Lvm.svg.png
Usually LVM is installed when the server is initially built and on most newer systems its already installed by default. But just be aware ..read more
Level 7 Cloud
5y ago
MySQL is a relational database that has been around for a long time time. There are three major distributions of MySQL: Oracle MySQL, MariaDB, MySQL and Percona MySQL.
Previously linux distributions would automatically include Oracle MySQL. But lately this has been changing and MariaDB is starting to become the default choice for MySQL installations in Linux repositories. I personally have the most experience with Percona MySQL and prefer this distribution primarily because of the the stability of the software and their level of development not only to the MySQL distribution ..read more
Level 7 Cloud
5y ago
Here are some tips to not use your password on the command line. Once you execute your password on the command line it goes into the history of your profile and if someone else has access to your profile, they now have access to your password.
Read into variable silently
You can read your password into a variable and then use the variable on the command line. To further secure your password you can read it in silently.
read -s MY_PASSWORD
echo $MY_PASSWORD
mycommand --username=user --password=$MY_PASSWORD
Use configuration files when possible (MySQL or Postgres ..read more
Level 7 Cloud
5y ago
grep is one of the fundamental commands that is used in the linux command line. It’s used to filter text based upon the criteria that you provide.
Examples
Here are some examples on how grep can be used as an initial introduction. The command has many more options which can be explored, but these are the options that I have used on a regular basis
Search for text in a file. This will find any line in file.txt that contains the text “mytext”
grep mytext file.txt
Search for text in all files in a path. This will find any line in all files in /var/log that contains t ..read more
Level 7 Cloud
5y ago
There are many times where I want to run a command that will take a long time to complete but have been disconnected due to SSH timeouts. This is where screen comes in handy. You can create session where you can execute your commands in and if you get disconnected, you can just reconnect to the computer and connect to the screen session that is running the command. Screen also has functionality to log the output from the session into a file. In the event that the computer rebooted, you can see where the command was and what its last output was before the reboot. Screen has far more ..read more
Level 7 Cloud
5y ago
Ansible is a
very powerful automation tool that can help you easily build machines to
your specifications and you then have track of how that server was
built to be able to make changes to it or rebuild it if needed. We will
go over the different aspects of Ansible and how you can use it for
quick and easy deployments. By no means is everything I am doing the
only way, but this is how I learned it and hopefully it will help others
learn it quickly and overcome some of the mistakes and frustrations
that I had.
Installation
Most distributions readily have Ansible and can b ..read more
Level 7 Cloud
5y ago
This
is an overview of how I build the virtual machines I use for the blog
and demonstrations that I do in the videos. I first utilize a tool
called Vagrant which allows you to automate virtual machine deployments
on multiple platforms like VMware workstation or Oracle VirtualBox. I
use Oracle VirtualBox as it’s a free open source virtualization tool. I
then use Ansible which is a linux automation tool, to configure the
virtual machine with whatever software or configuration that I would
like. Here is a GIT repository with a copy of the files that I will be
using. They may not be ..read more
Level 7 Cloud
5y ago
When I first started using find, it was merely to just find files that I wasn’t sure where they were located. But after a while I have found that it can be used for other tasks as well. Find can run commands against files that it does find. When working with backups and servers that have been running for a long while. Files tend to build up if they are not well maintained. The thing that I use the find command for the most is for cleaning up old files. Effectively implementing a file retention on the path that you are searching. This can then be scheduled in cron to run frequently ..read more