• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. ch3i
    3. Posts
    • Profile
    • Following 1
    • Followers 4
    • Topics 37
    • Posts 916
    • Best 169
    • Controversial 0
    • Groups 1

    Posts made by ch3i

    • RE: [SCRIPT] FOG tools

      Updated :

      • Correct rights problem on new imgs
      • Adding progression bar using PV

      With progression :

      #########################################################
      #                 FOG Images tools                      #
      #########################################################
      
      Changing compression of MASTER_WB from 0 to 5 :
      
                               
      Backup img...Done
       
      Compress new img...In progress
      24,2MO 0:00:00 [  78MB/s] [=======================================================>] 100%            
      73,3GO 0:18:12 [68,7MB/s] [=======================================================>] 100%            
      37,5GO 0:09:58 [64,1MB/s] [=======================================================>] 100%            
       5,1kO 0:00:00 [ 394kB/s] [=======================================================>] 100%            
       142MO 0:00:00 [ 163MB/s] [=======================================================>] 100%            
       
      Compress new img...Done
                                   
      Remove backups...Done
                                    
      Update database...Done
      Exiting...
      

      The size isn’t the compressed size, but size before.

      posted in Tutorials
      ch3iC
      ch3i
    • RE: [SCRIPT] FOG tools

      @Wayne-Workman said:

      Then, we wouldn’t need FTP client side to move images from /images/dev to /images because after compression completes, the image could be moved?

      Depends the server performance, if you have multiple uploads you will have a high cpu utilization.

      posted in Tutorials
      ch3iC
      ch3i
    • [SCRIPT] FOG tools

      Hi,

      I use a script to compress images (inspired by https://forums.fogproject.org/topic/5141/compression-change/6) and display configuration of my FOG ( using https://forums.fogproject.org/topic/4581/let-s-make-scripts).

      I have terminated the compression of images present where I launch the script (to compress an image you have to launch the script on the master node of the group where the image is stored) :

      • Backup old image
      • Compress new image
      • Update database
      • Remove backup

      In futur release I want to add :

      • A progress bar on pigz (using pv maybe) >> Done
      • Checking if pigz is installed
      • function to move image in another folder/storage.

      Script (you need to have pigz installed) :

      #!/bin/bash
      ##############################################
      # Tools for FOG
      # Last change 2015-06-15
      #
      # /!\ pigz and pv are required /!\
      #
      # Ch3i
      ##############################################
      
      ##############################################
      # Functions
      ##############################################
      
      FUNC_TOP(){
      echo -e "\033[42m#########################################################
      #                 FOG Images tools                      #
      #########################################################\033[0m\n\n"
      }
      
      ##############################################
      # Get FOG configuration
      ##############################################
      
      source /opt/fog/.fogsettings
      snmysqlhost=${snmysqlhost#p:}
      logfile="FOGtroubleshoot.log"
      
      clear
      FUNC_TOP
      
      echo -e "/!\ pigz and pv are required for image compression /!\ \n"
      echo "Press Enter to continue..."; read
      
      clear
      FUNC_TOP
      
      echo -e "1 - Change image compression
      2 - Export configuration in `pwd`/$logfile
      3 - Exit\n"
      read -e fog_operation
      
      clear
      FUNC_TOP
      
      if [ "$fog_operation" == "1" ]
      then
      	##############################################
      	# List all images (id/name/compression)
      	##############################################
      
      	echo -e "Choose the image to resize\n"
      	echo -e "|ID\t| Image name (compression)"
      	echo "------------------------------------------"
      	# Display all images >> mysql --host="$snmysqlhost" --user="$snmysqluser" --password="$snmysqlpass" "fog" -Bse "SELECT images.imageID, images.imageName, images.imageCompress FROM images ORDER BY imageID" | while read image_id image_name image_compression
      	mysql --host="$snmysqlhost" --user="$snmysqluser" --password="$snmysqlpass" "fog" -Bse "SELECT images.imageID, images.imageName, images.imageCompress FROM images INNER JOIN imageGroupAssoc ON images.imageID = imageGroupAssoc.igaImageID INNER JOIN nfsGroups ON imageGroupAssoc.igaStorageGroupID = nfsGroups.ngID INNER JOIN nfsGroupMembers ON nfsGroupMembers.ngmGroupID = nfsGroups.ngID WHERE ngmHostname = '$ipaddress' ORDER BY imageID" | while read image_id image_name image_compression #Display images on the node where the script is running
      	do
      		echo -e "|$image_id\t| $image_name ($image_compression)"
      		echo "------------------------------------------"
      	done
      	echo -en "\nEnter the Image ID : "; read image_id_selected
      	echo -n "Enter the compression level (0-9) : "; read image_compression_selected
      
      	##############################################
      	# Get image selected informations
      	##############################################
      
      	image_name_selected=$(mysql --host="$snmysqlhost" --user="$snmysqluser" --password="$snmysqlpass" "fog" -Bse "SELECT images.imageName FROM images WHERE images.imageID='$image_id_selected'")
      	image_compression_original=$(mysql --host="$snmysqlhost" --user="$snmysqluser" --password="$snmysqlpass" "fog" -Bse "SELECT images.imageCompress FROM images WHERE images.imageID='$image_id_selected'")
      	image_path=$(mysql --host="$snmysqlhost" --user="$snmysqluser" --password="$snmysqlpass" "fog" -Bse "SELECT images.ImagePath FROM images WHERE images.imageID='$image_id_selected'")
      	
      	if [ "$image_compression_selected" -ge 0 -a "$image_compression_selected" -le 9 -a "$image_name_selected" != "" ]
      	then
      		echo -n "Do you want to change compression of $image_name_selected from $image_compression_original to $image_compression_selected ? (y/n) : "; read go_compression
      	else
      		echo "error"
      		echo "Exiting..."
      		sleep 1
      		clear
      		exit
      	fi
      	
      	##############################################
      	# Resize the image and update database
      	##############################################
      	if [ "$go_compression" = "Y" -o "$go_compression" = "y" ]
      	then
      		clear
      		FUNC_TOP
      		echo -e "Changing compression of $image_name_selected from $image_compression_original to $image_compression_selected : \n"
      		echo -n "Backup img...In progress"
      		for f in "$storageLocation/$image_path/"*.img; do mv "$f" "${f%.img}-bak.img"; done
      		echo -e "\033[1K"
      		echo "Backup img...Done"
      		echo "Compress new img...In progress"
      		for f in "$storageLocation/$image_path/"*bak.img; do pigz -d -c $f | pv $f | pigz -"$image_compression_selected" > "${f%-bak.img}.img"; done
      		echo -e "\033[1K"
      		echo "Compress new img...Done"
      		echo -n "Remove backups...In progress"
      		rm "$storageLocation/$image_path/"*bak.img
      		chmod 777 -R "$storageLocation/$image_path/"
      		echo -e "\033[1K"
      		echo "Remove backups...Done"
      		echo -n "Update database...In progress"
      		mysql --host="$snmysqlhost" --user="$snmysqluser" --password="$snmysqlpass" "fog" -Bse "UPDATE images SET images.imageCompress='$image_compression_selected' WHERE images.imageID='$image_id_selected'"
      		echo -e "\033[1K"
      		echo "Update database...Done"
      		echo "Exiting..."
      		sleep 1
      		exit
      	else
      		echo "Exiting..."
      		sleep 1
      		clear
      		exit
      	fi
      elif [ "$fog_operation" == "2" ]
      then
      	##############################################
      	# Export Configuration
      	##############################################
      
      	(( EUID != 0 )) && exec sudo -- "$0" "$@"
      	linuxReleaseName=`lsb_release -a 2> /dev/null | grep "Distributor ID" | awk '{print $3,$4,$5,$6,$7,$8,$9}' | tr -d " "`;
      	if [ -z "$linuxReleaseName" ]; then
      		# Fall back incase lsb_release does not exist / fails - use /etc/issue over /etc/*release*
      		linuxReleaseName=`cat /etc/issue /etc/*release* 2>/dev/null | head -n1 | awk '{print $1}'`;
      	fi
      	#logfile="FOGtroubleshoot.log"
      	# Delete logfile if it exists
      	if [ -f $logfile ]; then
      		rm $logfile
      	fi
      	#argument 1 is the logfile name
      	getStatus() {
      		i=1;
      		if [ ! -z "`echo $linuxReleaseName | grep -Ei 'Fedora|Redhat|CentOS|Mageia'`" ]; then
      			RHVER=`rpm -qa | grep release | xargs rpm -q --queryformat '%{VERSION}' | cut -c -1`;
      		fi
      		if [ "`echo $RHVER`" -gt 6 ]; then
      			services="xinetd rpcbind nfs-server vsftpd firewalld FOGMulticastManager FOGSnapinReplicator FOGImageReplicator FOGScheduler";
      			nicename="TFTP RPCBind NFS FTP Firewall FOGMulticastManager FOGSnapinReplicator FOGImageReplicator FOGScheduler";
      			for service in $services; do
      				niceval=`echo $nicename|awk '{print $'$i'}' |sed 's/_/ /'`;
      				echo "----------------------$niceval status below" >> $1
      				systemctl status $service >> $1;
      				i=`expr $i '+' 1`;
      			done
      		else
      			services="xinetd rpcbind nfs vsftpd iptables FOGMulticastManager FOGSnapinReplicator FOGImageReplicator FOGScheduler";
      			nicename="TFTP RPCBind NFS FTP Firewall FOGMulticastManager FOGSnapinReplicator FOGImageReplicator FOGScheduler";
      			for service in $services; do
      				niceval=`echo $nicename|awk '{print $'$i'}' |sed 's/_/ /'`;
      				echo "----------------------$niceval status below" >> $1
      				service $service status >> $1;
      				i=`expr $i '+' 1`;
      			done
      		fi
      	}
      	#argument 1 is the logfile name
      	getLogs() {
      		if [ ! -z "`echo $linuxReleaseName | grep -Ei 'Fedora|Redhat|CentOS|Mageia'`" ]; then
      			httploc='httpd';
      			httpsep='_';
      		else
      			httploc='apache2';
      			httpsep='.';
      		fi
      		logs="/var/log/foginstall.log /var/log/${httploc}/error${httpsep}log /var/log/${httploc}/access${httpsep}log";
      		nicename="Installation Apache_Error Apache_Access";
      		i=1;
      		for lfname in $logs; do
      			if [ -f "$lfname" ]; then
      				niceval=`echo $nicename|awk '{print $'$i'}' |sed 's/_/ /'`;
      				echo ----------------------$niceval log below >> $1;
      				tail -30 $lfname >> $1
      			fi
      			i=`expr $i '+' 1`;
      		done
      	}
      	#argument 1 is the logfile name
      	getConfs() {
      		conffiles="/etc/dhcp/dhcpd.conf /etc/dnsmasq.d/ltsp.conf /etc/xinetd.d/tftp /etc/vsftpd/vsftpd.conf /etc/rc.d/rc.local";
      		for confname in $conffiles; do
      			if [ -f "$confname" ]; then
      				echo "----------------------$confname file below" >> $1;
      				cat $confname >> $1;
      			fi
      		done
      	}
      	echo '----------------------'$linuxReleaseName' version below' >> $logfile
      	cat /etc/issue >> $logfile
      	if [ ! -z "`echo $linuxReleaseName | grep -Ei 'Fedora|Redhat|CentOS|Mageia'`" ]; then
      		echo '----------------------SELinux status below' >> $logfile;
      		sestatus >> $logfile
      	fi
      	echo '----------------------IP Configuration below' >> $logfile
      	ip addr >> $logfile
      	getStatus $logfile;
      	getLogs $logfile;
      	getConfs $logfile;
      	storageLocation="/images";
      	if [ -d "/opt/fog" -a -f "/opt/fog/.fogsettings" ]; then
      		. /opt/fog/.fogsettings;
      	fi
      	if [ -d "$storageLocation" ]; then
      		echo '----------------------Check for /images/.mntcheck' >> $logfile
      		ls $storageLocation -a |grep "mntcheck" >> $logfile
      		echo '----------------------Check for /images/dev/.mntcheck' >> $logfile
      		ls ${storageLocation}/dev -a |grep "mntcheck" >> $logfile
      		echo '----------------------/images & file permissions below' >> $logfile
      		ls -lR $storageLocation >> $logfile
      	fi
      	if [ -d "/tftpboot" ]; then
      		echo '----------------------/tftpboot & file permissions below' >> $logfile
      		ls -lR /tftpboot >> $logfile
      	fi
      	sed -i 's/$/
      	/g' $logfile
      	echo -n "Script Completed ";
      	date
      	echo "Your logfile can be found in `pwd`/$logfile";
      	echo "Exiting..."
      	sleep 1
      	exit
      else
      	echo "Exiting..."
      	sleep 1
      	clear
      	exit
      fi
      

      It’s not perfect but functional, I used it without problem, if you want to test it make a backup of the target image before 😄

      Ch3i.

      posted in Tutorials
      ch3iC
      ch3i
    • RE: Error mounting XX.XX.XX.XX:/fog/ on /fog

      @YuYo

      Hi,

      Fog version ? OS ?
      Please provide the configuration of the image and the storage concerned. (screenshots if you want)

      Ch3i.

      posted in General
      ch3iC
      ch3i
    • RE: Cant find file to configure boot menu? FOG 1.2.0 ubuntu 12.04

      @Lenny87 Hi, there is no “user guide” to add iso on iPXE, it depends what ISO you want to add : https://forums.fogproject.org/topic/5142/adding-iso

      posted in FOG Problems
      ch3iC
      ch3i
    • RE: FOG::SnapinClient Download Failed; Zero size file.

      @Kiweegie Don’t know wich protocol is used to transfer snapins from server to client. But “Download Failed” seem to be a service that not running or a right problem.

      posted in FOG Problems
      ch3iC
      ch3i
    • RE: More compression testing!

      @Wayne-Workman Thx 😉

      posted in Tutorials
      ch3iC
      ch3i
    • RE: FOG::SnapinClient Download Failed; Zero size file.

      @Kiweegie Hi, have you some snapins that work correctly ?

      posted in FOG Problems
      ch3iC
      ch3i
    • RE: Storage Node replication question

      @sbps As said @Wayne-Workman the solution is to used “Location Plugin” with differents “storage group” (one group per location) and use another tools to sync images between storages, because (I think) the replication is between nodes in a same group.

      posted in General
      ch3iC
      ch3i
    • RE: More compression testing!

      @DevinR Hi, Thank you for that great job. I think @Wayne-Workman can add your tests to the Wiki, it’s very helpfull.

      posted in Tutorials
      ch3iC
      ch3i
    • RE: Issue with SVN 3542?

      @jamesb https://forums.fogproject.org/topic/5186/install-svn-on-debian-8-stay-block-downloading-new-fog-client-file

      posted in Bug Reports
      ch3iC
      ch3i
    • [3537] Update imageGroupAssoc

      Hi,

      When I delete an image from GUI, the ID of the image is always on the table “imageGroupAssoc”

      Regards,
      Ch3i.

      posted in Bug Reports
      ch3iC
      ch3i
    • RE: Fog resize Hard drive (C partition) after compression...

      @Matthieu-Jacquart That bug is fixed in SVN.

      @Tom-Elliott said:

      The “repair” is actually much simpler I think.
      […]
      I’ve actually fixed this in the development version so I’d say start there if you could.

      posted in Windows Problems
      ch3iC
      ch3i
    • RE: Fog resize Hard drive (C partition) after compression...

      @Matthieu-Jacquart Hi, are you using SVN version ?

      posted in Windows Problems
      ch3iC
      ch3i
    • RE: Script to install Samba with settings for FOG

      @cspence The difference is IO access. NFS need more IO access than CIFS, if you have a good NAS/SAN/Local storage prefer NFS. If you have Local/NAS storage in SATA II take what you want.
      Tests with : HP MSA, HP3par, EMC Clarion, EMC VNX, Synology RS2414 and Netgear Readynas RN3220

      posted in Tutorials
      ch3iC
      ch3i
    • RE: Script to install Samba with settings for FOG

      @cspence said:

      Oh, I see! You were just trying to share your images directory. I’ve been talking about replacing NFS completely with samba. It would take care of some of the biggest security issues.

      Bad perfomance…

      posted in Tutorials
      ch3iC
      ch3i
    • RE: SMB setup for external storage

      @cmcleod said:

      @ch3i
      Initially I tried the NFS route with the Terastation. When I added it to the Storage Group as a second node, fog just showed an error on the Home page for that storage device.

      I then mounted the NFS share within CentOS and pointed fog to the local mount point. Fog saw the additional storage with no problem. However, when I tried to upload the image, I received the same error I stated in my original post that I was receiving now with CIFS.

      Wich is the mount point of your NFS share in your NAS? I think is not xxx.xxx.xxx.xxx:/images.

      For example a ReadyNAS : the NFS share is >> xxx.xxx.xxx.xxx:/c/media/your_share/ (your_share can be images…)

      posted in Linux Problems
      ch3iC
      ch3i
    • RE: SMB setup for external storage

      @cmcleod
      Hi,

      You can setup your Terastation with a NFS share instead cifs, and declare it as a second node in your Storage Group.
      You must configure your share for NFS and FTP on your NAS for the user fog.

      posted in Linux Problems
      ch3iC
      ch3i
    • RE: 2 NIC in host problem (loops at sending discovery...)

      @Knut Hi, sorry for the late answer… could you upload or download as a debug task. Just check debug after select upload or download.

      posted in FOG Problems
      ch3iC
      ch3i
    • RE: Use NAS as NFS share

      @Wayne-Workman It’s only working if the NAS isn’t the Master Node, I think…

      posted in FOG Problems
      ch3iC
      ch3i
    • 1
    • 2
    • 26
    • 27
    • 28
    • 29
    • 30
    • 45
    • 46
    • 28 / 46