IT Ramblings

Ramblings from an IT manager and long time developer.

NAVIGATION - SEARCH

Manually enable Appear Offline in Lync 2013 via Registry

Lync 2013, just as with previous releases, allows the ability to Appear Offline. And just as with previous releases, you can enable this functionality in the Lync Client Policies. For information on how Lync Client Policies work, see my post here. To enable Appear Offline through Client Policy against the Global Policy, use the following command:

Get-CSClientPolicy | Set-CSClientPolicy -EnableAppearOffline $true

This will require a Lync 2013 client restart.

As an Administrator, you may not want to make this change to a Client Policy as the goal of Lync is to promote collaboration, not inhibit it by having users Appear Offline and hide from other users. At the same time, you may want to enable it for a user or two at request and won’t want to have to bother providing this small group of users their own Client Policy. Lync 2010 provided the ability to do that via registry key. Mike Pfeiffer provides a great article on Lync 2010 for setting the Lync 2010 registry key to manually enable Appear Offline in Lync 2010. You can see his article here.

The goal of this article is to show how to do the same in Lync 2013. Because Lync 2013 is now a part of Office 2013, Lync 2013 registry items are now under the Office 2013 registry section (Office 15.0). There are two ways to set this registry:

  1. Cmd.exe
  2. Regedit.exe

Using Cmd.exe

The type the following command:

Reg Add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Office\15.0\Lync" /V "EnableAppearOffline" /D 1 /T REG_DWORD /F

Using Regedit.exe

  1. Start regedit.exe
  2. In Registry Editor, expand HKEY_LOCAL_MACHINE, expand Software, expand Policies, expand Microsoft, expand Office, expand 15.0, expand Lync
  3. Right-click the Lync registry key, point to New, and then click DWORD (32-bit) Value
  4. After the new value is created, type EnableAppearOffline to rename the value.
  5. Double-click the new EnableAppearOffline registry value.
  6. After the new value is created, type EnableAppearOffline to rename the value.
  7. Double-click the new EnableAppearOffline registry value.
  8. In the Edit DWORD (32-bit) Value dialog box, type 1 in the Value data box, and then click OK.

New-SPConfigurationDatabase – This SharePoint farm currently has pending upgrades

New-SPConfigurationDatabase : The pipeline has been stopped. 

At C:Usersadministrator.GENDesktopAutoSPInstallerSP2010AutoSPInstallerAutoSPInstaller.ps1:576 char:31 

+             New-SPConfigurationDatabase <<<<  –DatabaseName “$ConfigDB” –DatabaseServer “$DBServer” –AdministrationContentDatabaseName “$CentralAdminContentDB” –Passphrase $SecPhrase –FarmCredentials $Cred_Farm 

    + CategoryInfo          : InvalidData: (Microsoft.Share…urationDatabase:SPCmdletNewSPConfigurationDatabase) [New-SPConfigurationDatabase], PipelineStoppedException 

    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSPConfigurationDatabase 

Microsoft.SharePoint.SPException: This SharePoint farm currently has pending upgrades.  The cmdlet New-SPConfigurationDatabase cannot be executed until the upgrade is completed. 

   at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord) 

This SharePoint farm currently has pending upgrades.  The cmdlet New-SPConfigurationDatabase cannot be executed until the upgrade is completed. 

At C:Usersadministrator.GENDesktopAutoSPInstallerSP2010AutoSPInstallerAutoSPInstaller.ps1:576 char:31 

+                                             New-SPConfigurationDatabase <<<<  –DatabaseName “$ConfigDB” –DatabaseServer “$DBServer” –AdministrationContentDatabaseName “$CentralAdminContentDB” –Passphrase $SecPhrase –FarmCredentials $Cred_Farm 

    + CategoryInfo          : InvalidOperation: (:) [New-SPConfigurationDatabase], SPException 

    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSPConfigurationDatabase 

 

luckily there is a pretty easy fix -- run the following command and it will fix the issue (note: you can ignore the error that the command returns)

 

psconfig -cmd upgrade -inplace b2b -wait -force

 

What-If Analysis with Microsoft Project

What-If Analysis with Microsoft Project 2010   

Source: http://blogs.catapultsystems.com/epm/archive/2010/01/27/what-if-analysis-with-microsoft-project-2010.aspx

I’ve attended a couple Microsoft Project 2010 events as of late, but of yet, I haven’t seen this functionality getting much play.  On first glance, I think this could be one of the most compelling new features added to Project: the task level Active field.

Usage Scenarios

Scenario #1: The project manager has been requested to calculate the cost and schedule impact of a potential change order.  The change order is developed as a series of extra tasks in the MPP file.  Based on that model, the change request is submitted to the project stakeholders.  They deliberate for several weeks. 

During that time, the project schedule is updated repeatedly.  As the project manager cannot very well report on the project with the unapproved change order requests included, the PM will have to remove the tasks and reinsert them later once the change order has been approved.

Fast forward, and now the stakeholders have approved the change request.  Now the PM has to go back to the change order calculations and reinsert them into the updated project schedule, hoping that the calculations of cost and schedule impact haven’t changed significantly.

image

With the Active field.  I can now add the change order, but render it inactive so that it is not included in status reporting or resource allocation calculations.  Whenever I need to revalidate the change order calculations, I can toggle the Active status to yes and review the schedule.

image

Scenario #2: I wish to remove tasks from a baselined in-progress schedule.  Generally, deleting tasks is frowned upon as this does not change the rolled up baseline calculations, and you therefore are removing a record of how that original baseline was calculated.  The guidance in 2007 was to zero out the remaining work on the removed tasks and then to prefix the name with something like “DELETED-Task1”.  Needless to say, this has been know to confuse project stakeholders.

Now I can simply render them inactive.  This keeps the original baseline calculations but allows me to track the historical record of how the baseline was developed:

image

This also allows me to start tracking the cost savings associated with eliminating specific tasks by grouping on inactive tasks with baseline data.

Scenario #3: I wish to develop a schedule with conditional branches.  I insert different branches based on potential information that may be developed at a later date.  As the information is received, I activate or deactivate specific branches.  With some macro coding and a rough Monte Carlo analysis, I could probably expand this to do all sorts of probabilistic analysis on the schedule.

Server Level Support

On the server level, you’ll note a couple of things:

1) Setting a task to inactive automatically toggles Publish to “No.”

image

2) Options to include inactive tasks in the OLAP Cubes.  I am still getting my head around how this would be used, but I suppose it will be heavily dependent on the organization’s methodologies, much like Proposed vs Committed in previous versions of Project Server.

image

 

Use Non Certified Play To Devices in Windows 8.1

This is a re-post from here: http://answers.microsoft.com/en-us/windows/wiki/windows8_1-pictures/use-non-certified-play-to-devices-in-windows-81/660c16a5-33e8-4a1a-9466-6fa2bfe07956

Use Non Certified Play To Devices in Windows 8.1

Summary

Technical Level: Intermediate Applies to: Windows 8.1, also WindowsRT 8.1 If your device supports DLNA “Play To” using the classic desktop/explorer/libraries functionality but does not appear in the Devices Charm list in Apps like Music and Videos, or appears as non-certified, with a little work you can overcome this restriction and it will appear. The Photos App in Windows 8.1 does NOT support Play To.

Details

Background

 

A little history: In Windows 7, Microsoft introduced Play To which used the DLNA spec to let me send media from my computer to a DLNA DMR. I had so so results with my 2009 Samsung TV due to poor transcoding support, but great results with my WDTV Live Hub and my SONOS speakers. The so-so experience on my TV and the not wonderful experience on other device by many many people caused Microsoft to rethink their strategy for Windows 8 and come up with a more intensive certification process for devices to “insure” a good experience. This translated into a restrictive policy for Windows 8 Start Screen/Metro/Modern UI Apps where only MS certified devices would appear in an applications Settings: Devices menu. In Windows 8, a workaround is available that requires a registry entry for each device you wish to enable for Play To support for Modern UI Apps.

 

 

What I am about to describe works on both my Surface and Surface RT tablets as well as my Desktop running Windows 8.1

 

 

 Check if the Device is listed and shows as non certified in PC & Devices Settings/Devices. To do this:

1.     Click or tap the Settings Charm on the Start Screen

2.     Select Change PC Settings

3.     Select PC & Devices

4.     Select Devices

5.     Verify that your device is listed (the example below shows the TV that is Not Windows Certified as present in the list)

 

 

 

6.     If the Device is not present, use Add Device to attempt to add the device to the list

 

 

Next Step: Verify Legacy DLNA “Play To” Support

 

1.  To do this, right click a supported media file in a classic library and verify the Play To menu appears

2.  Next, verify that you can successfully send to your target device and it plays the media you selected.

    a.       To do this, right click a supported media file in a classic library and verify the Play To menu appears and that you can successfully send to your target device and it plays the media you selected.

 

Open the Registry Editor

 

1.     On the Start Screen, type/search for regedit

2.     Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft

3.     Create a NEW key by right clicking Microsoft and name it PlayTo

 

Image

 

Image

 

4.      Once the key is created, right click it and create a new DWord

 

Image

 

5.      The new Dword should be named ShowNonCertifiedDevices. After you have created the key, right click, edit and change the value from 0 to 1.

 

Image

 

After a reboot, your Non Certified devices should be available in Windows Store Apps that support Play (PlayTO), as in the example below:

 

Image

 

 

Note: You alternatively could use HKEY_CURRENT_USER\Software\Microsoft\PlayTo with a DWORD ShowNonCertifiedDevices with value 1 which would limit functionality on a per user basis.

 

See Also

Originally published (Additional Information Available) at http://digitalmediaphile.com/index.php/2013/07/15/how-to-use-non-certified-play-to-devices-in-windows-8-1/

 

Here is a registry script to apply this workaround for you

Windows8PlayToFix.reg (266.00 bytes)

Use Non Certified Play To Devices in Windows 8.1

This is a re-post from here: http://answers.microsoft.com/en-us/windows/wiki/windows8_1-pictures/use-non-certified-play-to-devices-in-windows-81/660c16a5-33e8-4a1a-9466-6fa2bfe07956

Use Non Certified Play To Devices in Windows 8.1

Summary

Technical Level: Intermediate Applies to: Windows 8.1, also WindowsRT 8.1 If your device supports DLNA “Play To” using the classic desktop/explorer/libraries functionality but does not appear in the Devices Charm list in Apps like Music and Videos, or appears as non-certified, with a little work you can overcome this restriction and it will appear. The Photos App in Windows 8.1 does NOT support Play To.

Details

Background

 

A little history: In Windows 7, Microsoft introduced Play To which used the DLNA spec to let me send media from my computer to a DLNA DMR. I had so so results with my 2009 Samsung TV due to poor transcoding support, but great results with my WDTV Live Hub and my SONOS speakers. The so-so experience on my TV and the not wonderful experience on other device by many many people caused Microsoft to rethink their strategy for Windows 8 and come up with a more intensive certification process for devices to “insure” a good experience. This translated into a restrictive policy for Windows 8 Start Screen/Metro/Modern UI Apps where only MS certified devices would appear in an applications Settings: Devices menu. In Windows 8, a workaround is available that requires a registry entry for each device you wish to enable for Play To support for Modern UI Apps.

 

 

What I am about to describe works on both my Surface and Surface RT tablets as well as my Desktop running Windows 8.1

 

 

 Check if the Device is listed and shows as non certified in PC & Devices Settings/Devices. To do this:

1.     Click or tap the Settings Charm on the Start Screen

2.     Select Change PC Settings

3.     Select PC & Devices

4.     Select Devices

5.     Verify that your device is listed (the example below shows the TV that is Not Windows Certified as present in the list)

 

Image

 

6.     If the Device is not present, use Add Device to attempt to add the device to the list

 

 

Next Step: Verify Legacy DLNA “Play To” Support

 

1.  To do this, right click a supported media file in a classic library and verify the Play To menu appears

2.  Next, verify that you can successfully send to your target device and it plays the media you selected.

    a.       To do this, right click a supported media file in a classic library and verify the Play To menu appears and that you can successfully send to your target device and it plays the media you selected.

 

Open the Registry Editor

 

1.     On the Start Screen, type/search for regedit

2.     Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft

3.     Create a NEW key by right clicking Microsoft and name it PlayTo

 

Image

 

Image

 

4.      Once the key is created, right click it and create a new DWord

 

Image

 

5.      The new Dword should be named ShowNonCertifiedDevices. After you have created the key, right click, edit and change the value from 0 to 1.

 

Image

 

After a reboot, your Non Certified devices should be available in Windows Store Apps that support Play (PlayTO), as in the example below:

 

Image

 

 

Note: You alternatively could use HKEY_CURRENT_USER\Software\Microsoft\PlayTo with a DWORD ShowNonCertifiedDevices with value 1 which would limit functionality on a per user basis.

 

See Also

Originally published (Additional Information Available) at http://digitalmediaphile.com/index.php/2013/07/15/how-to-use-non-certified-play-to-devices-in-windows-8-1/

Powershell Script to Setup Internal/External URLS for Exchange 2013

Frm here: http://jaworskiblog.com/2013/04/13/setting-internal-and-external-urls-in-exchange-2013/

#
# Author: Scott Jaworski
# Website: jaworskiblog.com
# Version: 1.0
# Description: This script sets internal and external URL's on the specified Exchange 2013 Client Access Server
# then displays the results of all the urls that have been set.
# How to Use: Copy the text file to a location on the Exchange server. Change the .txt extension to .ps1,
# Open Exchange Management Shell, Browse to the location of the script in EMS, Run .\Set-Exchange2013Vdirs 
#

Function Set-Exchange2013Vdirs
{
$ExServer = Read-Host "Please enter the Exchange 2013 Server Name you'd like to set Vdirs  " 
$InternalName = Read-Host "Input the internal domain name eg.. IntMail.domain.com  " 
$ExternalName = Read-Host "Input the external domain name eg. ExtMail.domain.com  " 

Write-Host "Configuring Directories for $ExServer.." -Foregroundcolor Green

Get-WebservicesVirtualDirectory -Server $ExServer | Set-WebservicesVirtualDirectory -InternalURL https://$InternalName/EWS/Exchange.asmx -ExternalURL https://$externalName/EWS/Exchange.asmx
Get-OwaVirtualDirectory -Server $ExServer | Set-OwaVirtualDirectory -InternalURL https://$InternalName/owa -ExternalURL https://$ExternalName/owa
Get-ecpVirtualDirectory -Server $ExServer | Set-ecpVirtualDirectory -InternalURL https://$InternalName/ecp -ExternalURL https://$ExternalName/ecp
Get-ActiveSyncVirtualDirectory -Server $ExServer | Set-ActiveSyncVirtualDirectory -InternalURL https://$InternalName/Microsoft-Server-ActiveSync -ExternalURL https://$ExternalName/Microsoft-Server-ActiveSync
Get-OABVirtualDirectory -Server $ExServer | Set-OABVirtualDirectory -InternalUrl https://$InternalName/OAB -ExternalURL https://$ExternalName/OAB
Set-ClientAccessServer $ExServer -AutodiscoverServiceInternalUri https://$internalName/Autodiscover/Autodiscover.xml
Set-OutlookAnywhere -Identity "$ExServer\Rpc (Default Web Site)" -InternalHostname $internalName -ExternalHostName $ExternalName -InternalClientAuthenticationMethod ntlm -InternalClientsRequireSsl:$True -ExternalClientAuthenticationMethod Basic -ExternalClientsRequireSsl:$True


Write-Host "Vdirs have been set to the following.." -Foregroundcolor Green
Write-Host "$ExServer EWS"
Get-WebservicesVirtualDirectory -Server $ExServer |Fl internalURL,ExternalURL
Write-Host "$ExServer OWA"
Get-OWAVirtualDirectory -Server $ExServer | Fl internalUrl,ExternalURL
Write-Host "$ExServer ECP"
Get-ECPVirtualDirectory -Server $ExServer | Fl InternalURL,ExternalURL
Write-Host "$ExServer ActiveSync"
Get-ActiveSyncVirtualDirectory -Server $ExServer | Fl InternalURL,ExternalURL
Write-Host "$ExServer OAB"
Get-OABVirtualDirectory -Server $ExServer | Fl InternalURL,ExternalURL
Write-Host "$ExServer Internal Autodiscover URL"
Get-ClientAccessServer $ExServer | Fl AutodiscoverServiceInternalUri
Write-Host "$Exserver Outlook Anywhere Settings"
Get-OutlookAnywhere -Identity "$ExServer\rpc (Default Web Site)" |fl internalhostname,internalclientauthenticationmethod,internalclientsrequiressl,externalhostname,externalclientauthenticationmethod,externalclientsrequiressl

Write-Host "The Powershell URL have not been set as part of this script. Set it if you choose" -ForegroundColor Yellow
}
Set-Exchange2013Vdirs

Export SharePoint Terms Group to XML

Here is a PowerShell script to export SharePoint Term Groups to XML

 

param(
	[string]$siteUrl = "http://sharepoint.local:2013",
	[string]$termGroup = "Sample Term Group",
	[string]$exportPath = $null
)


function Add-Snapin {
	if ((Get-PSSnapin -Name Microsoft.Sharepoint.Powershell -ErrorAction SilentlyContinue) -eq $null) {
		$global:SPSnapinAdded = $true
		Write-Host "Adding SharePoint module to PowerShell" -NoNewline
		Add-PSSnapin Microsoft.Sharepoint.Powershell -ErrorAction Stop
		Write-Host " - Done."
	}
	
	Write-Host "Adding Microsoft.SharePoint assembly" -NoNewline
	Add-Type -AssemblyName "Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
	# Disable the above line and enable the line below for SharePoint 2013
	# Add-Type -AssemblyName "Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
	Write-Host " - Done."
}

function Remove-Snapin {
	if ($global:SPSnapinAdded -eq $true) {
		Write-Host "Removing SharePoint module from PowerShell" -NoNewline
		Remove-PSSnapin Microsoft.Sharepoint.Powershell -ErrorAction SilentlyContinue
		Write-Host " - Done."
	}
}

function Get-ScriptDirectory
{
	$Invocation = (Get-Variable MyInvocation -Scope 1).Value
	return Split-Path $Invocation.MyCommand.Path
}

function Export-SPTerms {
    param (
        [string]$siteUrl = $(Read-Host -prompt "Please provide the site collection URL"),
        [string]$termGroupName = $(Read-Host -prompt "Please provide the term group name to export"),
        [string]$saveLocation = $(Read-Host -prompt "Please provide the path of the folder to save the CSV file to")
    )
	
	if ([IO.Directory]::Exists($saveLocation) -eq $false)
	{
		New-Item ($saveLocation) -Type Directory | Out-Null
	}
	
	Write-Host "Getting Taxonomy Session";
	$taxonomySession = Get-SPTaxonomySession -site $siteUrl
	$taxonomyTermStore =  $taxonomySession.TermStores | Select Name
	$termStore = $taxonomySession.TermStores[$taxonomyTermStore.Name]
	$fileRootNoteCreated = $false;
	
	# Ampersands are stored as full width ampersands (see http://www.fileformat.info/info/unicode/char/ff06/index.htm)
	[Byte[]] $amp = 0xEF,0xBC,0x86
	
	Write-Host "Looping through Term store Groups to find: '$termGroupName'"
	foreach ($group in $termStore.Groups) {
		Write-Host "Checking: '$($group.Name)'"
		$groupName = $group.Name.Replace([System.Text.Encoding]::UTF8.GetString($amp), "&");
		if ($groupName -eq $termGroupName) {
		
			Write-Host "Looping through Term sets"
		    foreach ($termSet in $group.TermSets) {
            	# Remove unsafe file system characters from file name
				$parsedFilename =  [regex]::replace($termSet.Name, "[^a-zA-Z0-9\\-]", "_")
				
				$file = New-Object System.IO.StreamWriter($saveLocation + "\termset_" + $parsedFilename + ".xml")
                
		        # Write out the headers
		        #$file.Writeline("Term Set Name,Term Set Description,LCID,Available for Tagging,Term Description,Level 1 Term, Level 2 Term,Level 3 Term,Level 4 Term,Level 5 Term,Level 6 Term,Level 7 Term")
				$file.Writeline("<termStore Name='" + $termStore.Name + "' GUID='" + $termStore.ID + "' Group='" + $groupName + "'>");	
		        $file.Writeline("`t<termSet Name='" + $termSet.Name + "' GUID='" + $termSet.ID + "' Description='" + $termSet.Description + "'>");
				try {
					Export-SPTermSet $termSet.Terms
				}
				finally {
					$file.Writeline("`t</termSet>");
					$file.Writeline("</termStore>");
			        $file.Flush()
			        $file.Close()
				}
			}
		}
	}
}

function Export-SPTermSet {
    param (
        [Microsoft.SharePoint.Taxonomy.TermCollection]$terms,
		[int]$level = 1,
		[string]$previousTerms = ""
    )
	
	$tabCount = $level+1;
	if ($level -gt 1) {$tabCount = $tabCount + ($level-1);}
	
	if ($terms.Count -gt 0)
	{
		$file.Writeline("`t" * $tabCount + "<terms>");
	}
	
	if ($level -ge 1 -or $level -le 7)
	{
		if ($terms.Count -gt 0 ) {
			$termSetName = ""
			if ($level -eq 1) {
				$termSetName =  """" + $terms[0].TermSet.Name.Replace([System.Text.Encoding]::UTF8.GetString($amp), "&") + """"
			}
			$terms | ForEach-Object {
				$termName = $_.Name.Replace([System.Text.Encoding]::UTF8.GetString($amp), "&");
				$currentTerms = $previousTerms + ",""" + $termName + """";
				
				$file.Writeline("`t" * $tabCount + "`t<term Name='" + $termName + "' isAvailableForTagging='" + $_.IsAvailableForTagging + "'>");
				$file.Writeline("`t" * $tabCount + "`t`t<description>" + $_.GetDescription() + "</description>");
				
				if ($level -lt 7) {
					Export-SPTermSet $_.Terms ($level + 1) ($previousTerms + $currentTerms)
				}
				$file.Writeline("`t" * $tabCount + "`t</term>");
			}
		}
	}

	if ($terms.Count -gt 0)
	{
		$file.Writeline("`t" * $tabCount + "</terms>");
	}
}

try {
	Write-Host "Starting export of Metadata Termsets" -ForegroundColor Green
	$ErrorActionPreference = "Stop"
	Add-Snapin
	
	if (!($exportPath)) {
		$exportPath = (Get-ScriptDirectory)
	}
	
	Write-Host "Site: $siteUrl" -ForegroundColor Yellow
	Write-Host "Term Group: $termGroup" -ForegroundColor Yellow
	Write-Host "Export Path: $exportPath" -ForegroundColor Yellow
	
	Export-SPTerms $siteUrl $termGroup $exportPath
}
catch {
	Write-Host ""
    Write-Host "Error : " $Error[0] -ForegroundColor Red
	throw
}
finally {
	Remove-Snapin
}
Write-Host Finished -ForegroundColor Blue

export-terms-xml.ps1 (5.31 kb)

Adding a new drive to linux

 

Determine Drive Information

We assume that the hard drive is physically installed and detected by the BIOS.

To determine the path that your system has assigned to the new hard drive, open a terminal and run:

sudo lshw -C disk

IconsPage/IconExample48.png This should produce output similar to this sample:

  *-disk
       description: ATA Disk
       product: IC25N040ATCS04-0
       vendor: Hitachi
       physical id: 0
       bus info: ide@0.0
       logical name: /dev/sdb
       version: CA4OA71A
       serial: CSH405DCLSHK6B
       size: 37GB
       capacity: 37GB

 

Be sure to note the "logical name" entry, as it will be used several times throughout this guide.

 

Command Line Partitioning

You'll be using "fdisk" to accomplish this. Refer back to the logical name you noted from earlier. For illustration, I'll use /dev/sdb, and assume that you want a single partition on the disk, occupying all the free space.

If the number of cylinders in the disk is larger than 1024 (and large hard drives always have more), it could, in certain setups, cause problems with:

  1. software that runs at boot time (e.g., old versions of LILO)
  2. booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK)

Otherwise, this will not negatively affect you. 

1) Initiate fdisk with the following command:

  •   sudo fdisk /dev/sdb 

2) Fdisk will display the following menu:

  •   Command (m for help): m <enter>
      Command action
       a   toggle a bootable flag
       b   edit bsd disklabel
       c   toggle the dos compatibility flag
       d   delete a partition
       l   list known partition types
       m   print this menu
       n   add a new partition
       o   create a new empty DOS partition table
       p   print the partition table
       q   quit without saving changes
       s   create a new empty Sun disklabel
       t   change a partition's system id
       u   change display/entry units
       v   verify the partition table
       w   write table to disk and exit
       x   extra functionality (experts only)
    
      Command (m for help):

3) We want to add a new partition. Type "n" and press enter.

  Command action
   e   extended
   p   primary partition (1-4)

4) We want a primary partition. Enter "p" and enter.

  Partition number (1-4):

5) Since this will be the only partition on the drive, number 1. Enter "1" and enter. 

  Command (m for help):

If it asks about the first cylinder, just type "1" and enter. (We are making 1 partition to use the whole disk, so it should start at the beginning.)

6) Now that the partition is entered, choose option "w" to write the partition table to the disk. Type "w" and enter.

  The partition table has been altered!

7) If all went well, you now have a properly partitioned hard drive that's ready to be formatted. Since this is the first partition, Linux will recognize it as /dev/sdb1, while the disk that the partition is on is still /dev/sdb.

 

Command Line Formatting

To format the new partition as ext3 file system (best for use under Ubuntu):

  •   sudo mkfs -t ext3 /dev/sdb1

To format the new partition as fat32 file system (best for use under Ubuntu & Windows):

  •   sudo mkfs -t fat32 /dev/sdb1

 

As always, substitute "/dev/sdb1" with your own partition's path.

 

Modify Reserved Space (Optional)

When formatting the drive as ext2/ext3, 5% of the drive's total space is reserved for the super-user (root) so that the operating system can still write to the disk even if it is full. However, for disks that only contain data, this is not necessary.

NOTE: You may run this command on a fat32 file system, but it will do nothing; therefore, I highly recommend not running it.

You can adjust the percentage of reserved space with the "tune2fs" command, like this:

 sudo tune2fs -m 1 /dev/sdb1

This example reserves 1% of space - change this number if you wish.

  • (i) Using this command does not change any existing data on the drive. You can use it on a drive which already contains data.

 

Create A Mount Point

Now that the drive is partitioned and formatted, you need to choose a mount point. This will be the location from which you will access the drive in the future. I would recommend using a mount point with "/media", as it is the default used by Ubuntu. For this example, we'll use the path "/media/mynewdrive"

  •   sudo mkdir /media/mynewdrive

Now we are ready to mount the drive to the mount point.

 

Mount The Drive

 

You can choose to have the drive mounted automatically each time you boot the computer, or manually only when you need to use it.

 

Automatic Mount At Boot

Note: Ubuntu now recommends to use UUID instead, see the instructions here:https://help.ubuntu.com/community/UsingUUID

You'll need to edit /etc/fstab:

  •   sudo vi -Bw /etc/fstab

Note: https://help.ubuntu.com/community/Fstab#Editing_fstab

Add this line to the end (for ext3 file system):

  •   /dev/sdb1    /media/mynewdrive   ext3    defaults     0        2

Add this line to the end (for fat32 file system):

  •   /dev/sdb1    /media/mynewdrive   vfat    defaults     0        2
    The defaults part may allow you to read, but not write. To write other partition and FAT specific options must be used. If gnome nautilus is being used, use the right-click, mount method, from computer folder. Then launch the mount command from terminal, no options. The last entry should be the FAT drive and and look something like:
      /dev/sda5 on /media/mynewdrive type vfat (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush)
    All of the parts between the parenthesis are the mount options and should replace "defaults" in the fstab file. The "2" at the end instructs your system to run a quick file system check on the hard drive at every boot. Changing it to "0" will skip this. Run 'man fstab' for more info here.

You can now run "sudo mount -a" (or reboot the computer) to have the changes take effect.

If you want to allow a normal user to create files on this drive, you can either give this user ownership of the top directory of the drive filesystem: (replace USERNAME with the username)

  •   sudo chown -R USERNAME:USERNAME /media/mynewdrive

or in a more flexible way, practical if you have several users, allow for instance the users in the plugdev group (usually those who are meant to be able to mount removable disks, desktop users) to create files and sub-directories on the disk:

  •   sudo chgrp plugdev /media/mynewdrive
      sudo chmod g+w /media/mynewdrive
      sudo chmod +t /media/mynewdrive

The last "chmod +t" adds the sticky bit, so that people can only delete their own files and sub-directories in a directory, even if they have write permissions to it (see man chmod).

 

Manually Mount

Alternatively, you may want to manually mount the drive every time you need it.

For manual mounting, use the following command:

sudo mount /dev/sdb1 /media/mynewdrive 

When you are finished with the drive, you can unmount it using:

 

sudo umount /media/mynewdrive