You are not logged in.

#1 2015-10-25 13:35:04

stueja
Member
Registered: 2015-10-18
Posts: 47

Over-provisioning on SSD after OS was installed / dual-boot / via SSH

OK, I am posting this just in case someone has a similar stupid series of problems.

Main problem: new UEFI laptop with 2 SSDs and 1 HDD, Windows 10 came pre-installed on the wrong (smaller, slower) SSD.
Goal: Windows 10 and Arch however should co-exist on the bigger, faster SSD.
Solution: use Acronis to clone Win 10 to correct SSD

In a stupid first run I Acronis-cloned the smaller SSD to the correct SSD. (Acronis True Image 2016, Build 5634). Worked a charm, so I erased everything on the smaller SSD.
Stupid, because I did not care for the over-provisioning of the correct SSD. None was set according to

hdparm -N /dev/sdb
/dev/sdb:
 max sectors   = 439557452/439557452, HPA is disabled

Problem: HPA disabled.
Goal: enable HPA with ~10% over-provisioning.

However,
Problem: enabling HPA will erase all data on the SSD.
Goal: have Windows boot again after enabling HPA

So I created an Acronis whole-disk image of the correct SSD and stored it on the hard disk.

Problem: Acronis does not automagically create a UEFI-bootable USB stick, plus I have no optical drives.
Goal: boot Acronis from USB to be able to locate the backup and restore it later.
Solution: Luckily, the Acronis rescue media ISO  contains EFI bootloaders. So I prepared a USB stick in Windows via

        diskpart
        list disk
        select disk X (the number for the USB drive!!!)
        clean
        create partition primary
        select partition 1
        active
        format quick fs=fat32
        assign
        exit

After that, I right-clicked the Acronis rescue ISO file, mounted it and copied the contents over to the USB partition, rebooted from that USB drive, located the backup. Check.

Again, enable HPA:
In order to activate HPA/over-provisioning on an already-in-use-SSD, three things must be noted.
A) you must destroy all contents of the SSD (aka SSD Secure Erase)
B) you probably can't do so because the SSD appears as "frozen"

hdparm -I /dev/sdb | grep frozen
       frozen

C) after all, recover from an Acronis image

To un-freeze the SSD so that hdparm can secure-erase it:
- boot Arch installation USB stick
- hdparm -I /dev/sdb | grep frozen shows: frozen
- systemctl suspend
- wait a little, 10s maybe
- wake laptop up

hdparm -I /dev/sdb | grep frozen:  
  not  frozen

To secure-erase the SSD, I followed the guide at https://www.thomas-krenn.com/en/wiki/SSD_Secure_Erase

hdparm --user-master u --security-set-pass Eins /dev/sdb
hdparm --user-master u --security-erase Eins /dev/sdb

Problem: my laptop screen would stay black after resume from suspend.
Goal: nevertheless secure-erase the SSD and enable HPA.
Solution: SSH
So I
- booted Arch from USB
- edited /etc/dhcpcd.conf to use "clientid" instead of "duid"
- invoked wifi-menu to connect to wifi
- set a password for root
- started the ssh daemon (systemctl start sshd)
- suspended laptop, woke laptop up
- ssh'd into laptop from another laptop

hdparm --user-master u --security-set-pass Eins /dev/sdb
hdparm --user-master u --security-erase Eins /dev/sdb
hdparm -NpXYZ /dev/sdb

Note: XYZ is for the value you want to keep as storage space in your SSD. I substracted 10% from the total amount of 439557452, so I ran

hdparm -nP395601707 /dev/sdb

Note: also, you have to give a special switch if you really want to do that. hdparm will let you know. wink

After that, I ran systemctl poweroff, plugged in the Acronis rescue media and recovered the drive image to the now over-provisioned SSD.

Offline

Board footer

Powered by FluxBB