Showing posts with label power saving. Show all posts
Showing posts with label power saving. Show all posts

10 September 2020

Cheap energy efficient harddrives

Decisions

Every so often I'm faced with a difficult decision: Clean up my digital closet or buy more storage space. It's a good idea to sift through all the files periodically and throw out what's no longer needed but today I'm going the other route: We'll add more storage! My storage needs at home are covered by a Xpenology virtual machine running on my low power homelab server. It has served me well over the years and I don't intent to replace it anytime soon. 

For home use, I prefer backups over RAID since keeping my data is more important to me than having it always available. For this reason, the disks I use in my NAS are each set up with their own volume. Data I like to keep is copied between disks and to an offsite location by a scheduled job. I consider individual hard drives to be unreliable and have set up my backup schedule accordingly. Important data gets more copies and a higher copy frequency. Unimportant data is only present on a single disk and never gets copied. 

I don't believe I can differentiate a reliable hard drive (one that keeps working for 7+ years) from an unreliable one (one that fails in the first months of use). Therefore I consider "NAS" specific hard drives just as reliable as any other type. I just buy the cheapest one I can find and replace when needed. 

The search

When selecting a hard drive there are a number of things I consider:

  • Price
  • Capacity
  • Power consumption
  • Noise

We'll start with price since that's the least complicated factor. There are a good number of websites that compare prices between all the online shops. At €0,020/GB it seems 6TB drives are the sweet spot at the moment. They offer the cheapest storage for their price. However, external USB hard drives dive even lower at €0,016/GB for a 12TB model. So it seems I should shop for an external hard drive, then? Well, why not! 

Capacity is easy, I don't hoard data so I don't need huge capacity. I'm going to buy a single chunk of whatever is the best deal of the day.

In an always-on scenario, such as my little server that's powered on 24/7, running costs make up the biggest pile of cash needed to keep all my files available, the electricity bill needed to keep it running is higher than the initial purchase. In the search for a harddrive that makes little noise, is energy efficient and cheap, you are going to come across 2,5" models. The amount of power needed to keep a 2,5" drive spinning is significantly less (a little over one Watt) compared to a 3,5" drive (a little over 5 Watts). These models are available up to 5TBs as of now. That's enough for my needs. As every Watt of power used 24/7 costs around €2 every year, a 2,5" drive makes me lose the smallest bag of money all around.

I've tackled the noise factor at home by placing the homeserver in a padded closet. It's dead silent when I close the door. Case closed.

The sale

Searching for the cheapest 2,5" external USB drive I ended up at Amazon. They offer a Seagate 5TB model for less than 100 euro's. That makes the price €0,019/GB. Together with the low power consumption makes it good enough for me! 
The rest is well known. We found the cheapest hard drive at Amazon and no other shops. Added it to the shopping cart, clicked "Buy now" and a few days later there was a box on my doorstep.


A word of warning: Western Digital (WD) has big portable external harddrives on sale. Unfortunately some of these disks have a USB port on the drive itself (instead of a SATA-to-USB converter board). I did not want to run into this issue so I selected a Seagate drive.

Breaking stuff

A USB disk is nice and all, but usually it's a SATA disk in a piece of plastic. I have a bay available in the homeserver so I'll put in inside instead of keeping a dangling box on top. With some tools it's easy to open the plastic case. This process of liberating external USB drives from their housing is known as "shucking" a hard drive. Obviously this voids the warranty!


Insert the tool into the seam and wiggle until you hear *click* from inside. This housing is not meant to be serviced so I did not expect it to stay in one piece. 


After one round of destroying plastic clips, the hard drive is visible.



That looks like a SATA interface to me!


Removed the rubber grommets and screws.


These parts are no longer needed.

Adding the disk to XPenology works as it's supposed to. 

There's an extra disk available, creating a volume is easy using the wizard and that's all folks!

See the source image

23 August 2016

Homelab part 4: Suspending the lab

Since my homelab is just a playground to try and test things, there's no point it keeping it running when I'm not actively using it. I've decided to shut down or suspend the virtual machines that are running and make a script that saves the state of the lab so it all comes back when it's time to go play. I use a Windows virtual machine as a jumphost and ESXi as the hypervisor so I've chosen PowerCLI as the glue that sticks it all together.

The first script is used to start the homelab.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#variables
$ipmiCred = Get-Credential ADMIN
$Ip = "192.168.2.229"
$vcenterCred = get-credential root
$vcenterserver = '192.168.2.200'
$vmhost = '192.168.2.230'
$PoweredOnVMspath = 'c:\temp\PoweredOnVMs.csv'

#boot host using IPMI
try {
Get-PcsvDevice -TargetAddress $Ip -ManagementProtocol IPMI -Credential $ipmiCred | Start-PcsvDevice
}
catch {
$ErrorMessage = $_.Exception.Message
$FailedItem = $_.Exception.ItemName

write-host "error connecting to IPMI: $faileditem $errormessage" 
}

#load PowerCLI
. 'C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1'

#connect to vCenter server
try{
Connect-VIServer -Server $vcenterserver -Credential $vcenterCred
}
catch{
write-host 'Connection to vCenter server failed' -ForegroundColor Red
}
#wait for the host to start up
do {
sleep 10
$ServerState = (get-vmhost $vmhost).ConnectionState
}
while ($ServerState -eq 'NotResponding')
Write-Host "$vmhost is still booting"
#load the list of VMs that were powered on last time
try{ 
$PoweredOnVMs = Import-Csv -Path $PoweredOnVMspath
}
catch{
Write-Host 'Import CSV of powered on VMs failed' -ForegroundColor Red
}
#start VMs that were powered on last time
try{ start-vm $PoweredOnVMs.name}
catch{Write-Host 'VMs power on failed' -ForegroundColor Red} 
 So this script starts the ESXi host using IPMI and loads the CSV file that contains the running virtual machines from last time and starts them as soon as the ESXi host is connected to vCenter.

The second script is used to store the running virtual machines into the CSV file and shut down the ESXi host.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#variables
$vcenterCred = get-credential root
$vcenterserver = '192.168.2.200'
$vmhost = '192.168.2.230'
$PoweredOnVMspath = 'c:\temp\PoweredOnVMs.csv'

#load PowerCLI
. 'C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1'

#connect to vCenter server
try{
Connect-VIServer -Server $vcenterserver -Credential $vcenterCred 
}
catch{
write-host 'Connection to vCenter server failed' -ForegroundColor Red
}

#find powered on VMs
try{
$PoweredOnVMs = get-vmhost $vmhost | get-vm | Where-Object{$_.PowerState -eq 'PoweredOn'}
} 
catch{ write-host 'Failed to find Powered On VMs' -ForegroundColor Red}

#export powered on VMs to CSV
try{ 
$PoweredOnVMs | Export-Csv -Path $PoweredOnVMspath
}
catch { Write-Host 'failed to export CSV' -ForegroundColor Red} 

# shut it all down, start with VMs that have VMtools installed
foreach ($PoweredOnVM in $PoweredOnVMs) { try{ Shutdown-VMGuest $PoweredOnVM.Name -Confirm:$false} catch{Suspend-VM $PoweredOnVM.Name -Confirm:$false}}
write-host 'Shutting down VMs and waiting some minutes' -foregroundcolor Green
#wait for the VMs to shut down or suspend

do {
start-sleep 10
$VMState = (get-vmhost $vmhost|get-vm)
}
while ($VMState.PowerState -eq 'PoweredOn')

#wait a few more seconds
start-sleep 15
#shut down the ESXi host
write-host 'Shutting down ESXi host'
try{Stop-VMHost $vmhost -Force -Confirm:$false | Out-Null}
catch{Write-Host 'ESXi host shutdown failed' -ForegroundColor Red}

As with all things in a homelab, these scripts are subject to change as soon as I think of something new. Suggestions are welcome!