Quick Way to Check DFS Replication Backlog with dfsrdiag

When DFS Replication (DFSR) falls behind, the fastest way to see how many files are waiting to replicate between two servers is the dfsrdiag backlog command. Run it from an elevated Command Prompt on a server with the DFS management tools installed.

dfsrdiag backlog /RGname:"ReplicationGroupName" /RFname:"ReplicatedFolderName" /smem:SendingServer /rmem:ReceivingServer
  • /RGname: the replication group name, for example domain.com\dir\dir
  • /RFname: the replicated folder name
  • /smem: the sending member (server name)
  • /rmem: the receiving member (server name)

The output shows the backlog count and the first files in the queue. Run it again in each direction to check both sides of the replication.

How to Set Up Sophos UTM 9 High Availability (Active-Passive) on VMware

This guide shows how I added a passive Sophos UTM 9.x node (version 9.307006 at the time) to build a hot-standby, active-passive high availability pair. Our environment is fully virtual: VMware ESXi 5.5 (build 2456374) hosts, Force10 switches, and SAN storage. I used these exact steps across three data centers and a development environment.

1. Prepare the Primary UTM

Get your UTM set up and working the way you want first. Add a couple of extra NICs for the future and confirm basic firewall functionality. Then log in to the UTM shell as root and run:

cc set ha advanced virtual_mac 0

This step is required for HA to work in a VMware environment.

2. Clone the UTM

I use an even/odd host naming scheme, so I renamed the existing UTM to UTM01 and cloned it from vHost01 to vHost02 as UTM02.

3. Enable HA on the Primary (Node 1)

  1. Log in to UTM01 and go to Management → High Availability → Configuration.
  2. Select Hot Standby (active-passive).
  3. Choose the HA sync NIC (I used the last one added, eth7).
  4. Enter the device name (csutm01), select device node 1, and set an encryption key.
  5. Click both Apply buttons.

4. Reset the Clone to Factory Defaults

When the clone finishes, do not power it on yet. Edit the VM and disconnect every network card except the one on the HA network. Then power on UTM02, open the console, and log in as root.

Make absolutely sure you’re on UTM02, then reset it:

cc
RAW
system_factory_reset

The system powers off when the reset completes. Reconnect the internal interface, power it back on, and run through basic setup. Configure only the internal network and nothing else (you may need to add a license file).

5. Enable HA on the Secondary (Node 2)

  1. Log in to UTM02 and go to Management → High Availability → Configuration.
  2. Select Hot Standby (active-passive) and the same HA NIC (eth7).
  3. Enter the device name (csutm02), select device node 2, and use the same encryption key.
  4. Click both Apply buttons.

The web interface will lock up, showing you’ve lost the connection to UTM02. That’s expected.

6. Verify the Cluster

On UTM01, open the High Availability menu. You should see UTM01 as Active (Master) and UTM02 as Syncing. Give it about 15 minutes to stabilize.

If you run into trouble, feel free to send me a message.

Fix Non-Root Write Permissions on a CIFS Mount in Oracle Linux

I was working on a system recently migrated from a very old Solaris server to Oracle Linux 6.6. It mounts a CIFS (SMB) share from a Windows Server 2012 R2 host, just like the old system did, but non-root users could no longer write to it or create files.

The Symptom

The empty mount point has 777 permissions:

[root@localhost ~]# ls -ld /datastore/
drwxrwxrwx 2 root root 4096 Jan 6 09:50 /datastore/

But once the share is mounted, they drop to 755:

[root@localhost ~]# ls -ld /datastore/
drwxr-xr-x 1 root root 634564 Jan 6 09:50 /datastore/

On the old server, files and subdirectories on the share had the setuid bit, which the new system doesn’t. The original /etc/fstab entry was:

//cifshost/datastore /datastore cifs username=user,password=password,domain=mydomain.local 0 0

The Fix: Add file_mode and dir_mode

Edit /etc/fstab and add the file_mode=0666,dir_mode=0777 mount options:

//cifshost/share/datastore /datastore cifs user=user,pass=password,file_mode=0666,dir_mode=0777 0 0

Remount the share, and non-root users can read and write again.

How to Update EqualLogic Disk Drive Firmware (No Downtime)

Updating controller firmware on a Dell EqualLogic PS Series array is easy: open Group Manager, upload a file, click a few buttons, and you’re done. But what about when SAN HQ starts emailing you about outdated disk drive firmware? That takes a different process, and the good news is that it can be done hot, with no outage.

Firmware Downloads

Controller firmware kits:

Disk drive firmware kits:

SAN HQ: SANHQSetup32And64_v3.2.1

Steps to Update Disk Firmware

  1. Open your FTP client (I use WinSCP) and connect to the array’s group IP or management IP.
  2. Upload the drive firmware .tgz package. I used kit_V8.0_DriveFw_2285700222.tgz. Don’t unzip it; it needs no further prep.
  3. SSH (PuTTY) to the same group or management IP and run one command: update. That’s it.

Example Output

Here’s what the update looked like on my array (repetitive drive lines trimmed):

Welcome to Group Manager
Copyright 2001-2014 Dell Inc.

EQLSAN> update
13:24:23 Updating from kit file "kit_V8.0_DriveFw_2285700222.tgz"

This command will install the update kit file that was
copied to the array.

If you choose to proceed, you will be shown the current firmware version
and the version to which you will update. You will then be given the
choice to proceed again.

Do you want to proceed (y/n) [y]: y

13:24:39 Verifying kit integrity.
Starting Disk Firmware update... V8.0
...Initializing support libraries...

Identifying drives that qualify for firmware upgrades... Please wait.
22 drive(s) in this array qualify for a firmware upgrade.
The process will now update the 22 drives that qualify for a firmware upgrade.

If you proceed, please do not power off or restart the array, or remove
any drives until the update process completes.
Do you want to continue at this time (Y/N)? y
SKIPPING DriveID 0 No firmware is available for Model: HUS723030ALS640
SKIPPING DriveID 1 No firmware is available for Model: HUS723030ALS640
SKIPPING DriveID 2 No firmware is available for Model: HUS723030ALS640
Checking health status of Array
UPGRADING DriveID 3 firmware from RN08 to RE12 using ./fwbin/RE12.lod
Drive firmware successfully updated : on drive 3
...
Checking health status of Array
UPGRADING DriveID 46 firmware from RN08 to RE12 using ./fwbin/RE12.lod
Drive firmware successfully updated : on drive 46
SKIPPING DriveID 47 No firmware is available for Model: HUS723030ALS640

Logging post run disk information
Entering cleanup phase... Please Wait...
The update was successful.
Would you like to email the results to Dell (Y/N)? n
Done cleanup ... quitting with an exit status of 0

EQLSAN>

The array checks its health before each drive, updates only the drives that qualify, and stays online the whole time.

Fix VMware Tools Not Starting After Reboot on CentOS 6/7

The Problem

On vSphere 5.x with VMware Tools installed on a CentOS 6.x x64 guest, VMware Tools doesn’t start automatically after an OS update that requires a reboot.

Starting with version 8.6.11.20852 (build-1015158), the installer script vmware-install.pl no longer creates a start script in /etc/init.d because it now uses Upstart. On top of that, the option to automatically build and install kernel modules at boot was not enabled during installation, so a new kernel leaves the tools without matching modules.

Three Ways to Fix It

Option 1: Re-run /usr/bin/vmware-config-tools.pl after every OS update that changes the kernel.

Option 2: Run /usr/bin/vmware-config-tools.pl and enable automatic building and installation of kernel modules at boot. You’ll need to remember to enable this again on future VMware Tools upgrades.

Option 3: Create your own init script from the services.sh script in /etc/vmware-tools:

cp /etc/vmware-tools/services.sh /etc/init.d/vmware-tools
vim /etc/init.d/vmware-tools

Paste this line just below ##VMWARE_INIT_INFO## and save:

# chkconfig: 235 03 99

Register the service and enable it at boot:

chkconfig --add vmware-tools
chkconfig vmware-tools on

Verify that it works:

service vmware-tools restart

How to Manage and Delete Wireless Network Profiles in Windows 8.1

My tablet kept having trouble connecting to different wireless networks that used the same SSID. The fix was managing the saved Wi-Fi profiles directly. Here’s how to view, change, and delete wireless network profiles in Windows 8.1 and Windows RT 8.1.

Change a Wireless Profile in PC Settings

  1. Swipe in from the right edge of the screen (or point to the upper-right corner with a mouse), tap Settings, then Change PC settings.
  2. Go to Network → Connections and choose the connection you want to change.
  3. Make your changes on the page that appears.

Manage Wi-Fi Profiles with netsh

Some tasks, like deleting a profile, have to be done from the Command Prompt. Search for “Command Prompt” from the Start screen, open it, and use these commands:

Show all wireless profiles on the PC:

netsh wlan show profiles

Delete a profile:

netsh wlan delete profile name="ProfileName"

Show a saved Wi-Fi password (security key):

netsh wlan show profile name="ProfileName" key=clear

Stop automatically connecting to a network that’s out of range:

netsh wlan set profileparameter name="ProfileName" connectionmode=manual

To move a network up the priority list, connect to it and choose Connect automatically; it goes to the top. To stop auto-connecting to a network that’s in range, select it in the network list and click Disconnect.

How Windows Chooses Which Network to Use

Windows usually prefers connections in this order: Ethernet, then Wi-Fi, then mobile broadband. Each new Wi-Fi network you join is added to the list, and if you connect to a second Wi-Fi network while the first is in range, Windows will prefer the second one from then on.

Mobile broadband is treated differently because it’s usually metered. If you manually connect to mobile broadband while Wi-Fi is in range, it’s preferred only for that session. To make your PC prefer mobile broadband over a Wi-Fi network, select that Wi-Fi network and click Disconnect, and Windows won’t connect to it automatically.

How to Re-register a Windows Client or Server in WSUS

When a Windows client or server stops reporting to WSUS (Windows Server Update Services), you can usually force it to re-register with a few commands. Run them on the affected machine from an elevated Command Prompt.

Steps to Re-register with WSUS

1. Refresh Group Policy so the machine picks up the WSUS server settings:

gpupdate /force

2. Trigger update detection:

wuauclt /detectnow

3. If it still doesn’t appear, reset the authorization cookie and detect again:

wuauclt.exe /resetauthorization /detectnow

Tip: Check Event Viewer on the client to confirm the re-registration went through.

Fix iSCSI TCP Retransmits with Force10 Switches, EqualLogic, and VMware

I was seeing high TCP retransmit rates on an iSCSI SAN built on Dell Force10 switches, EqualLogic storage arrays, and VMware ESXi hosts. The fix was configuring every switch port that connects to an EqualLogic array or a vHost iSCSI NIC with jumbo frames, flow control, and RSTP edge-port settings.

Force10 iSCSI Port Configuration

config
protocol spanning-tree rstp
no disable
interface GigabitEthernet x/x
description EQL or vHost iSCSI Port
no ip address
mtu 9252
switchport
flowcontrol rx on tx on
spanning-tree rstp edge-port
no shutdown
!

What Each Setting Does

  • mtu 9252: enables jumbo frames on the port for iSCSI traffic.
  • flowcontrol rx on tx on: lets the switch and storage pause traffic instead of dropping packets.
  • spanning-tree rstp edge-port: brings the port up immediately without waiting on spanning-tree.

With these settings in place, TCP retransmits dropped below 0.05%.

How to Join a Linux Server to Active Directory with Samba Winbind

Joining a CentOS or Red Hat server to Active Directory lets domain users log in with their AD credentials. This step-by-step guide uses Samba Winbind and authconfig, restricts shell access to admins, creates home folders on first login, and grants sudo to Domain Admins.

1. Install Samba, Winbind, and nscd

yum install nscd samba samba-common samba-client samba-winbind
yum upgrade

Add your domain controller to /etc/hosts:

192.168.1.30 dc.domain.com pdc01

2. Join the Domain with authconfig-tui

  1. Run authconfig-tui.
  2. Under Authentication Configuration, check Cache Information, Use Winbind, Use MD5 Passwords, Use Shadow Passwords, and Use Winbind Authentication.
  3. Under Winbind Settings, choose ads. Enter the short domain name (for example.com, enter just example), the FQDN of your domain controllers, the FQDN of the primary DC as the ADS realm, and /bin/bash as the shell.
  4. Click Join Domain, enter domain administrator credentials, and confirm the server joined successfully.

3. Restrict Shell Access with a Bash Wrapper

Create /usr/local/bin/bash-wrapper so only local wheel members and Domain Admins get a shell:

#!/bin/sh

# This script restricts shell access to privileged users. The "template shell"
# option in the '/etc/samba/smb.conf' file should be set to call this wrapper.

# Get group memberships for this user.
BFN_ID=$(/usr/bin/id)

# Grant shell access to users that are in the local wheel group.
if /bin/echo "$BFN_ID" | /bin/grep -P '[=,][0-9]{1,8}\(wheel\)' > /dev/null
then
exec /bin/bash --login "$@"
fi

# Grant shell access to users that are in the domain administrators group.
if /bin/echo "$BFN_ID" | /bin/grep -P '[=,][0-9]{1,8}\(domain admins\)' > /dev/null
then
exec /bin/bash --login "$@"
fi

# Else print a notice and just exit.
echo "Shell access to this computer is disabled."

# eof

4. Finish the Configuration (Phase 2 Script)

Create /usr/local/bin/ad-phase2.sh. Edit the LDAP base line to match the OU of the users you want to allow before running it.

# ad-phase2.sh - Phase 2
# Description: This script automates the process of joining a linux box
# to an AD domain. The process is divided in two parts.
#
# Please edit the relevant parts of the script below prior running it

# This block doesn't need to be edited
#sed -i 's%protocols: files%protocols: files winbind%g' /etc/nsswitch.conf
#sed -i 's%rpc: files%rpc: files winbind%g' /etc/nsswitch.conf
#sed -i 's%netgroup: files%netgroup: files winbind%g' /etc/nsswitch.conf
#sed -i 's%automount: files%automount: files winbind%g' /etc/nsswitch.conf

# The following line allows users to logon without the EXAMPLE\user syntax
sed -i 's%winbind use default domain = false%winbind use default domain = true%g' /etc/samba/smb.conf

# More parameters to make life easier with UID and GID correspondences
sed -i 's% template shell = /bin/bash% template shell = /usr/local/bin/bash-wrapper%g' /etc/samba/smb.conf
sed -i '/ winbind offline logon = false/a winbind enum users = true' /etc/samba/smb.conf
sed -i '/winbind enum users = true/a winbind enum groups = true' /etc/samba/smb.conf
sed -i '/winbind enum groups = true/a winbind cache time = 5' /etc/samba/smb.conf
sed -i '/winbind cache time = 5/a winbind nested groups = true' /etc/samba/smb.conf

# Create home folders in /home/DOMAIN/username on first login
echo "session optional pam_mkhomedir.so skel=/etc/skel/ umask=0022" >> /etc/pam.d/system-auth

# Allow all users in the Domain Admins group to sudo on the server
echo "%domain admins ALL=(ALL) ALL" >> /etc/sudoers

# Replace "base OU=Users,DC=example,DC=com" with the container of the users you want to allow on the box
sed -i 's%base dc=*******,dc=com%base OU=Users,DC=*******************,DC=com%g' /etc/openldap/ldap.conf

Make both scripts executable, run the phase 2 script, and restart the services:

chmod +x /usr/local/bin/ad-phase2.sh
chmod +x /usr/local/bin/bash-wrapper
/usr/local/bin/ad-phase2.sh
service winbind restart
service nscd restart

Reboot for good measure, then test logging in with a domain account.

How to Enable or Disable Hibernate in Windows from an Elevated Command Prompt

Windows hibernation is controlled with the powercfg command. Turning it off frees the disk space used by hiberfil.sys; turning it on restores hibernate and hybrid sleep. Both commands need an elevated (Run as administrator) Command Prompt.

Enable Hibernate

This restores the hiberfil.sys file and brings back the “Allow hybrid sleep” and “Hibernate after” settings under Sleep in Power Options.

  1. Open an elevated Command Prompt.
  2. Type the command below and press Enter.
  3. Close the Command Prompt.
powercfg -h on

Disable Hibernate

This turns off hibernation, deletes hiberfil.sys, and removes the “Allow hybrid sleep” and “Hibernate after” settings. On Windows 8 and later it also disables Fast Startup.

  1. Open an elevated Command Prompt.
  2. Type the command below and press Enter.
  3. Close the Command Prompt.
powercfg -h off