DISCLAIMER : Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility.If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.
How to reduce LVM partition size in RHEL and CentOS
Sometimes when we are running out of disk space in our Linux box and if partition created on LVM , then we can make some free space in the volume group by reducing the LVM using lvreduce command.In this article we will discuss the required steps to reduce the size of LVM safely on CentOS and RHEL Servers, Below steps are eligible when the LVM partition is formated either as ext
Scenario : Suppose we want to reduce /home by 2GB which is on LVM partition & formated as ext4.
[root@cloud ~]# df -h /home/ Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_cloud-LogVol00 12G 9.2G 1.9G 84% /home
Step:1 Umount the file system
Use the beneath umount command
[root@cloud ~]# umount /home/
Step:2 check the file system for Errors using e2fsck command.
[root@cloud ~]# e2fsck -f /dev/mapper/vg_cloud-LogVol00 e2fsck 1.41.12 (17-May-2010) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/mapper/vg_cloud-LogVol00: 12/770640 files (0.0% non-contiguous), 2446686/3084288 blocks
Note: In the above command e2fsck , we use the option ‘-f’ to forcefully check the file system, even if the file system is clean.
Step:3 Reduce or Shrink the size of /home to desire size.
As shown in the above scenario, size of /home is 12 GB , so by reducing it by 2GB , then the size will become 10GB.
[root@cloud ~]# resize2fs /dev/mapper/vg_cloud-LogVol00 10G resize2fs 1.41.12 (17-May-2010) Resizing the filesystem on /dev/mapper/vg_cloud-LogVol00 to 2621440 (4k) blocks. The filesystem on /dev/mapper/vg_cloud-LogVol00 is now 2621440 blocks long.
Step:4 Now reduce the size using lvreduce command.
[root@cloud ~]# lvreduce -L 10G /dev/mapper/vg_cloud-LogVol00 WARNING: Reducing active logical volume to 10.00 GiB THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce LogVol00? [y/n]: y Reducing logical volume LogVol00 to 10.00 GiB Logical volume LogVol00 successfully resized
Step:5 (Optional) For the safer side, now check the reduced file system for errors
[root@cloud ~]# e2fsck -f /dev/mapper/vg_cloud-LogVol00 e2fsck 1.41.12 (17-May-2010) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/mapper/vg_cloud-LogVol00: 12/648960 files (0.0% non-contiguous), 2438425/2621440 blocks
Step:6 Mount the file system and verify its size.
[root@cloud ~]# mount /home/ [root@cloud ~]# df -h /home/ Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_cloud-LogVol00 9.9G 9.2G 208M 98% /home
Add Multiple IP address to single NIC in Suse Linux - Azure
Some of you might wondering why would we assign multiple IP addresses to single Network card. There can be many reasons. Say for example, you are doing some testing on your Linux box that requires two or more network cards. Would you buy new one? No, It is not necessary to buy a new one.
You can set multiple IP series, for example 192.168.1.0, 192.168.2.0, 192.168.3.0 etc., for a network card, and use all of them at the same time. Sounds useful? Of course, it is!
This method might be helpful when setting up Internet sharing servers, like Squid proxy.
To add multiple IP address for SUSE Linux VM on Azure, you may can take reference from below steps:
Login Azure portal then navigate to VM - Networking - Network Interface, then click the NIC
Click "Add" to add secondary DIP with static type
Login the VM then run "yast" to add the second IP address
Press "F4 Edit" – "F3 Add" then input the assigned IP address from the portal and follow the steps to press F10 Next|OK to save and exit
Now the VM has added the second IP address
And it's able to ping from another VM within same VNET
Now you have successfully configured the multiple address fro single NIC.
You can set multiple IP series, for example 192.168.1.0, 192.168.2.0, 192.168.3.0 etc., for a network card, and use all of them at the same time. Sounds useful? Of course, it is!
This method might be helpful when setting up Internet sharing servers, like Squid proxy.
To add multiple IP address for SUSE Linux VM on Azure, you may can take reference from below steps:
Login Azure portal then navigate to VM - Networking - Network Interface, then click the NIC
$ sudo yast
$ sudo ifconfig
$ ip a
$ ip a
Install AzCopy on Linux - Fastest way to copy in Azure
There are two versions of AzCopy that you can download. AzCopy on Linux is built with .NET Core Framework, which targets Linux platforms offering POSIX style command-line options. AzCopy on Windows is built with .NET Framework, and offers Windows style command-line options.
This article covers AzCopy on Linux.
Installation on Linux
Install and enable the .NET SDK
In your command prompt, run the following commands:
yum install rh-dotnet20 -y scl enable rh-dotnet20 bash
Once you have installed .NET Core, download and install AzCopy.
wget -O azcopy.tar.gz https://aka.ms/downloadazcopyprlinux tar -xf azcopy.tar.gz sudo ./install.sh
You can remove the extracted files once AzCopy on Linux is installed. Alternatively if you do not have superuser privileges, you can also run AzCopy using the shell script 'azcopy' in the extracted folder.
The basic syntax for AzCopy commands is:
azcopy --source <source> --destination <destination> [Options]
The following examples demonstrate various scenarios for copying data to and from Microsoft Azure Blobs and Files. Refer to the azcopy --help menu for a detailed explanation of the parameters used in each sample.
If any user face issue while running azcopy command which asks for dotnet files, enter the below line in the users .bashrc file.
source scl_source enable rh-dotnet20
If a user oracle needs to run this command, then add the below line to the oracle .bash_profile under PATH section
/opt/rh/rh-dotnet20/root/usr/bin/
Add the below line in the script if you would use azcopy in a shell script.
source scl_source enable rh-dotnet20
Now type azcopy in the server and it shows the available options to use, you can explore the options and use this command as required.