Labels

hpunix (63) marathi kavita (52) linux (21) solaris11 (10) AWS (5) numerology (5)

Wednesday, September 14, 2016

New FS creation steps - Linux

Let’s take example that, admin wants to create a new FS with new VG.

VG name = vgbackup
LV name = lvbkp
mountpoint name = /backup
New disk added by VM team : /dev/sde

1. Scan new disk added by VM team
#fdisk -l |grep -i disk --> before adding new disk

#cd /sys/class/scsi_host/ --> we are having host0, host1 and host2

#echo ""- - -"" > /sys/class/scsi_host/host0/scan --> scanning new Lun for host0 , host1 & host2
#echo ""- - -"" > /sys/class/scsi_host/host1/scan
#echo ""- - -"" > /sys/class/scsi_host/host2/scan

#fdisk -l |grep -i disk --> after adding new disk

compare both fdisk output

2. create pv on new disk
#pvcreate /dev/sde

3. Create new VG:
#vgcreate vgbackup /dev/sde
#vgs --> to check all VG's details present on server.

4. Create new LV:
#lvcreate -n lvbkp -l 100%FREE vgbackup --> to use 100% disk space from VG
#lvcreate -n lvbkp -L 4G vgbackup --> to create LV of size 4GB

5. Create FS with FS type ext4:
#mkfs.ext4 /dev/mapper/vgbackup-lvbkp

6. Tune the FS
#tune2fs -m 1 /dev/vgbackup/lvbkp

where -m reserved-blocks-percentage

#tune2fs –c 0 –i 0 /dev/vgbackup/lvbkp

where, The Mount Count (-c) and check interval (i) values below are set to "-1" which disables any checking.

(If c=50 & i=1m then following command will modify the Check interval and Mount Count to only check after 100 mounts or a 1 month period.
#tune2fs -c 100 -i 1m /dev/vgbackup/lvbkp)

7. Create mountpoint:

#mkdir -p /backup

8. Edit /etc/fstab & make entry of new FS
#vi /etc/fstab
/dev/mapper/vgbackup-lvbkp       /backup     ext4    defaults        1 2"

9. Mount file-system

mount /dev/vgbackup/lvbkp /backup

Thanks & Regards,
Kiran Jadhav 

Wednesday, September 7, 2016

Small script to move files to & from multiple servers - Linux

Small script to move files to & from multiple servers:

1. Lets take a scenario in which we want to move files from one source server to multiple servers.

Here, we are taking example that the admin wants to move nmon log files to multiple servers.

nmon_servers = file where multiple servers name mentioned
source path : /usr/local/nmon_monthly
destination path : /usr/local/

for i in `cat /home/kiran/nmon_servers`
do
scp -rp /usr/local/nmon_monthly $i:/usr/local/
done

2. Second scenario is that we want to move files from multiple servers to one server:
nmon_servers = file where multiple servers name mentioned

for i in `cat /home/kiran/nmon_servers`
do
scp -rp $i:/var/log/nmon/* /var/log/nmon/
done

Thanks & Regards,

Kiran Jadhav