Thursday, May 18, 2017

How to reduce size of EC2 EBS volume

Latest link: https://medium.com/@rahulian/how-to-reduce-volume-of-an-aws-ec2-instance-d493ec891698

copy commands:
-aAxXSH
-aHAXxSP


attach two volume and issue below commands:


Block Device Name Big Volume = /dev/sda1
Block Device Name Big Volume Snapshot = /dev/sdg
Block Device Name Small Volume = /dev/sdf

Restart the Instance and SSH in

Login:
Create a file system for the 2 volumes you have created (Note: In Ubuntu I had to do a cat/proc/partitions to work out which device was which).
Create two mount directories and mount the new volumes.
Sync the files.
Unmount the smaller volume.

Stop the instance


link from:
http://cloudacademy.com/blog/amazon-ebs-shink-volume/

Wednesday, May 10, 2017

common bugs in PHP: Include same file name

If two files with same names available, then content of second include will not be read if include_once used.

include vs include_once : There is only one difference between include() and include_once(). If the code from a file has been already included then it will not be included again if we use include_once(). Means include_once() include the file only once at a time.
include vs require : if include() is not able to find a specified file on location at that time it will throw a warning however, it will not stop script execution. For the same scenario, require() will throw a fatal error and it will stop the script execution.
require vs require_once : There is only one difference between require() and require_once(). If the code from a file has been already included then it will not be included again if we use require_once(). Means require_once() include the file only once at a time.