Thursday, July 19, 2018

Extend your logical volume



 // current scenario - get VG, LV and PV information
# vgs;pvs;lvs

// check the free disks available
# cat /proc/partitions

// So , sdc is available free , do a pvcreate
# pvcreate /dev/sdc
  Physical volume "/dev/sdc" successfully created.

// This should show
# lvmdiskscan -l
   /dev/sdc                                                                             [      10.00 GiB] LVM physical volume



// extend the vg which corresponds to the lv - so here rhel_dhcp43_130 is the VG

# vgextend rhel_dhcp43-130 /dev/sdc


// Now extend the lv - here rhel_dhcp43--130-root is the LV

# lvextend -l +100%FREE /dev/mapper/rhel_dhcp43--130-root
  Size of logical volume rhel_dhcp43-130/root changed from 7.00  GiB (1792 extents) to <17.00 GiB (4351 extents).
  Logical volume rhel_dhcp43-130/root successfully resized.


// Check the size  - hmm..size not changed yet :(

# df -h


// resize underlying filesystem

# xfs_growfs -d /

// hooray - size changed :)

# df -h


============================================

Another day. 


--

vgs
lvs

--
// This is make the end size of ubuntu-home 60G.
// earlier it is of larger size say for example 160G

# lvresize -r  -L 60G /dev/fedora_localhost-live/ubuntu-home  
fsck from util-linux 2.38.1
/dev/mapper/fedora_localhost--live-ubuntu--home: 315/10485760 files (2.5% non-contiguous), 939484/41943040 blocks
resize2fs 1.46.5 (30-Dec-2021)
Resizing the filesystem on /dev/mapper/fedora_localhost--live-ubuntu--home to 15728640 (4k) blocks.
The filesystem on /dev/mapper/fedora_localhost--live-ubuntu--home is now 15728640 (4k) blocks long.

  Size of logical volume fedora_localhost-live/ubuntu-home changed from 160.00 GiB (40960 extents) to 60.00 GiB (15360 extents).
  Logical volume fedora_localhost-live/ubuntu-home successfully resized.

--
// check change in lvs and vgs(check free here)
lvs;

vgs;
--

// whatever free we take in the ubuntu-root logical volume

# lvextend -l +100%FREE /dev/mapper/fedora_localhost--live-ubuntu--root  
  Size of logical volume fedora_localhost-live/ubuntu-root changed from 10.00 GiB (2560 extents) to <113.13 GiB (28961 extents).
  Logical volume fedora_localhost-live/ubuntu-root successfully resized.



// mandatory check after lvextend

e2fsck -f   /dev/mapper/fedora_localhost--live-ubuntu--root   
e2fsck 1.46.5 (30-Dec-2021)
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/fedora_localhost--live-ubuntu--root: 225489/655360 files (0.1% non-contiguous), 2431025/2621440 blocks
[root@fedora saran]#
[root@fedora saran]# resize2fs  /dev/mapper/fedora_localhost--live-ubuntu--root   

// mandatory for filesystem notification.

resize2fs 1.46.5 (30-Dec-2021)
Resizing the filesystem on /dev/mapper/fedora_localhost--live-ubuntu--root to 29656064 (4k) blocks.
The filesystem on /dev/mapper/fedora_localhost--live-ubuntu--root is now 29656064 (4k) blocks long.

--
vgs
lvs
--
=========================================


Check shell script online



Check your shell script online for any errors:

https://www.shellcheck.net/


Hooray, its GPLv3 :)

Welcome message in your terminal




Install cowsay and get a welcome message(with date/time) everytime you open the terminal


1.
sudo yum install cowsay -y

2.
cowsay "Welcome $USER! It's now $(date '+%A %B %d %Y %r')"
Add the above line in your ~/.bashrc.



Now, open a fresh terminal. 

/ Welcome <user>! It's now Thursday \
\ July 19 2018 12:54:54 PM IST        /
 -------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


Its fun :) 

Wednesday, July 18, 2018

Cleanup and restart docker-storage-setup


Cleanup and setting up docker-storage-setup

In this example, vdb partition is used.



 vgremove docker-vg

 pvremove /dev/vdb1

 parted /dev/vdb rm 1

 wipefs -af /dev/vdb

 systemctl stop docker

 rm -rf /var/lib/docker

 rm -f   /etc/sysconfig/docker-storage

 docker-storage-setup

 systemctl start docker






Thursday, July 5, 2018

docker image - remove old tag and add new tag



-----------------

# Tag the image as below
# docker tag   e0d6b0ded794   <your_newtag_here>

Where <e0d6b0ded794> is the image id of the image you wish to update.

----------------

#remove old tag:

# docker rmi <your_old_tag_here>

----------------

# Check the image, you should only see the newtag:

# docker images | grep <your_newtag_here>

-----------------

To load the tar'd docker image:
# docker load -- input  


Building and running gluster container

Building and running gluster container:

# clone
git clone https://github.com/gluster/gluster-containers.git

cd gluster-containers/CentOS/

# Build using dockerfile
docker build -t glusterfs .

# Now run
docker run -v /etc/glusterfs:/etc/glusterfs:z -v /var/lib/glusterd:/var/lib/glusterd:z -v /var/log/glusterfs:/var/log/glusterfs:z -v /sys/fs/cgroup:/sys/fs/cgroup:ro -d --privileged=true --net=host -v /dev/:/dev  glusterfs


# Now, you can login to the container and check whether glusterd is running

Also, peer probe to other gluster containers using its IP address.


The above workflow is for building  the contianer from source.

You can also, simply pull the container using:
 # docker pull gluster/gluster-centos

and then start running as mentioned above.