Category: Uncategorized

  • Upgrade SSD with Bitlocker

    I have a laptop with a 500Gig SSD, but it’s too small. So I bought a 2TB SSD and replaced it. Here’s how I did it.

    About the Laptop

    The laptop is a Fujitsu U9311. To replace the SSD it was a matter of removing 10 screws from the bottom and lifting off the base. No clips to worry about. The SSD has a M.2 slot right there. The technical docs are available here.

    Great job, Fujitsu, why did you stop making Laptops?

    For reference, when booting, F2 will give the BIOS Setup. In setup I disabled Fast Boot so the Boot Menu is available.

    Press F12 to get the boot menu.

    Bitlocker considerations

    I’ve replaced HDDs with SSDs a few times before, and upgraded SSDs as well. Without Bitlocker in the mix, the process is relatively straightforward (the process below is good for this, and you can also use gparted to expand the partitions).

    With Bitlocker, I needed to know that the process wouldn’t interfere. It turns out that Windows is quite anti-fragile and you can do the things you would expect and it works.

    The thing I didn’t risk is using a 3rd party tools to expand the Bitlocker partitions. That wasn’t a problem because Windows Disk Manager can expand a partition into any free space that exists after the partition.

    Tools

    The (free) software I used is openSUSE Leap KDE Rescue x86_64.iso which I copied onto a 2GB USB stick. This build boots on my laptop and contains the two tools I used:

    • dd
    • gparted

    Process

    1. Put the new SSD in the Laptop
    2. Put the old SSD in a USB adapter
    3. Boot openSUSE
    4. Open Terminal and run su
    5. Check the devices (old was /dev/sdb, new was /dev/nvme0n1)
    6. dd if=/dev/sdb of=/dev/nvme0n1
    7. In another terminal (su) find the process number of dd and watch progress
      • ps ax | grep dd
      • watch kill -n 30 -USR1 999
    8. Wait – I was copying 500GB onto a 2TB disk. It copied at 44Meg/s, so was about 3 hours.
    9. Remove the USBs (old and boot) and reboot to check everything still works. It did. No issues at all.
    10. Reboot into openSUSE
    11. Open Terminal and run su, and then gparted.
    12. Then, starting at the right hand end, move partitions to their new start positions (but don’t change the partition sizes).
      • I have two partitions I wanted to expand: C: and E:. They were the 3rd and 5th partitions on the list, with partitions for EFI and Recovery there as well.
      • If a partition is not to be expanded, move it as far right as it will go.
      • If a partition is to be expanded, move it right and leave additional space to the right.
      • The left-most partition to expand (C:), is left with free space after it.
      • The actual move took about 3 minutes to move two small Recovery partitions and one 200Gig old partition.
    13. Reboot to Windows
    14. Using Disk Manager (Right click on My PC, Computer Management, Disk Manager), expand the partitions with free space after them.
    15. That’s it. No fussing, nothing unexpected.

  • Changing Workgroup can break Windows

    I discovered a way to break Windows 10 and Windows 11.

    Install Windows so you are signing in with an Azure Active Directory Account, and then change the Workgroup so it is the name of an existing WORKGROUP on your network (which, of course, is the only thing you might want to change it to). You will now find your computer will not boot. When Windows boots, the circling dots just continue to circle. Reports on the internet suggest that this continues forever (I’ve left it for multiple hours) or that it eventually stops.

    The Windows repair function isn’t able to recover from this situation – and the only option is to reinstall Windows from the recovery disk. Ouch.

    Or you can follow this relatively simple procedure to change the Workgroup and get your system booting again:

    Power off the computer and restart it – let the dots spin for a few seconds and repeat until you get the Windows Recovery screen.

    The select Advanced Options, then Troubleshoot, Advanced Options, Command Prompt.

    We need to change a registry entry, which we can do with a few tricks.

    First, run regedit.

    Then, select HKEY_LOCAL_MACHINE, and do File \ Load Hive… and load the hive C:\Windows\System32\config\SECURITY at KeyName ‘X’.

    Navigate to the key HKEY_LOCAL_MACHINE\X\Policy\PolPrDmN and Export it to X:\WorkGroup

    Then edit X:\WorkGroup.reg: in the Command Prompt, run notepad X:\Workgroup.reg

    Change the key so the Workgroup has a different name.

    The default name ‘WORKGROUP’ would have the setting:

    @=hex(0): 12 00 14 00 08 00 00 00 57 00 4F 00 52 00 4B 00 47 00 52 00 4F 00 55 00 50 00 00 00

    Close Notepad (and save the changes), then go back to RegEdit and import WorkGroup.reg

    Close Regedit, Exit out of Command Line and reboot.

  • Hello world!

    Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

  • RGPIO – LCD Screens

    Common Character LCD Screens can be controlled with between 6 and 11 GPIO pins. RGPIO L-Mode contains simple support for a 6-pin or 7-pin solution. The 6 or 7 pins are D4,D5,D6,D7,EN,RS with an optional RW (for most uses RW can be hard-wired to GND).

    Initialize RGPIO with the ports:

    L<RS>,<RW>,<EN>,<D4>,<D5>,<D6>,<D7>D

    For the PiBoard, the initialization is (RW is hardwired to GND, and we use 0 for that pin:

    L17,0,11,22,23,24,25C

    The initialization will reset the the screen and clear it.
    Some screens need additional initialization which need to be sent to the screen separately.
    To write characters to the LCD:

    LDHello world

    To send special codes, use \Cxx or \Xxx where xx is a hexadecimal pair. \C for a command (RS=1) and \X for a character (RS=0). For example, to write to the screen’s top-left, prefix with \C80. (the beginning of row 2 is often \CA0 on a 2-line screen).
    Special positioning commands include \C01 (clear screen); \C02 (go to top left)
    When sending \ using a command shell or programming language that uses \ as an escape character, you will need to double it:

    ./p LD\\C80

    These screens usually have a built-in font with most of the characters you need, and with the ability to add your own characters at code positions 00-07 or 00-0F.
    To add an elipsis at character position 00 (6 blank rows, one row of alternate bits,1 blank row):

    LD\C40\x00\x00\x00\x00\x00\x00\x15\x00\xC80

    To print a short line of elipsis characters

    LD\x00\x00\x00\x00\xC80
  • RGPIO Port handling

    RGPIO commands for simple ports (P-mode) are:

    Command Comment Example
    P<port>+ Set port Hi (turn it on) P4+
    P<port>- Set port Lo (turn it off) P11-
    P<port>R Set port input and read value P0x12R
    P[n,]<port>L Report when port goes Lo
    Cache n events – default=0, report once only.
    P8L
    P[n,]<port>H Report when port goes Hi
    Cache n events – default=0, report once only.
    P2,8H
    P[n,]<port>L Report when port changes
    Cache n events – default=1; if n=0, once only.
    P0,8C
    P<port>l Set port Hi and time how long before it goes Lo P8l
    P<port>h Set port Lo and time how long before it goes Hi P8l
    P<port>U Turn on the internal pullup on the port P8U
    P<port>u Turn off the internal pullup on the port P8u
    Command Response
    P4R P4:on
    This reports the current state of the port.
    P8L E8:off 2013/03/15 14:21:35 (812355433)
    After an L command is sent, RGPIO watches for the port to change (using a hardware interrupt). The output will be available after the event has occured. The output can be pollled for, or a signal can be set. The output indicates the port, and state, the time and an incrementing timestamp for the event.
    P7h E7:on t=56000
    After an h command is sent, RGPIO sets the port Lo and then times how long (in nanoseconds) it takes for the port to go Hi. The output can be pollled for, or a signal can be set. The output indicates the port, and state, the elapsed time.
  • Raspberry Pi – creating and installing a new kernel

    Abstract: Build your own Linux Kernel for Raspberry Pi.

    Follow the directions in Raspberry Pi – Setting up driver/module development environment.

    In directory Projects/source/tools/mkimage
    ./imagetool-uncompressed.py ../../linux/arch/arm/boot/zImage
    Create directory Projects/source/modules and in Projects/source/linux:
    make ARCH=arm CROSS_COMPILE=/tools/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi- modules_install INSTALL_MOD_PATH=../modules
    You now have tools/mkimage/kernel.org and modules/lib which need to be copied to the Raspberry Pi
    scp tools/mkimage/kernel.org rpi:/boot
    rsync -r --safe-links modules/lib/* rpi:/lib/

  • Linux – Override monitor settings

    Abstract: Sometimes Linux doesn’t find the correct monitor settings. This is how to override them.

    Find out what Linux thinks your monitor is called:
    eg under KDE, run Size & Orientation – the monitors available will be shown with their names. VGA1, HDMI1 etc..

    Get the monitor settings you want using the cvt tool:
    cvt 1280 1024
    The output will be something like:
    Modeline "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync

    Create or modify the file /etc/X11/xorg.conf.d/50-monitor.conf using the line just output:
    Section “Monitor”
    Identifier “VGA1” # use whatever name you discovered above
    Modeline … # as from the cvt output
    Option “PreferredMode” “1280x1024_60.00” # as on the Modeline
    EndSection

  • Raspberry Pi – setting up Web server

    Abstract: This is how to setup a Web server on Raspberry Pi

    Update your Raspberry Pi first.

    Run this commands to install this
    apt-get install apache2 The Apache web server
    apt-get install php5 libapache2-mod-php5 php5 and php5 support for Apache
    apt-get install mysql-server mysql-client MySQL server and client.
    You will be prompted to enter a SQL root password.
    apt-get install php5-mysql MySQL support for php

    Configure Apache. By defualt, a single-page website is active – /var/www/index.html.

    You can test php is working by creating a file: /var/www/phpinfo.php:

    Then in your webbrowser, visit http://rpi/phpinfo.php and you will see the php configuration screen.

  • Raspberry Pi – updating

    Abstract: This is how to update the OS and firmware on Raspberry Pi

    Note: If you don’t have git installed, you will need to install it with:
    apt-get install git-core
    Command Description
    apt-get update get latest updates to apt-get
    apt-get upgrade update to latest OS
    wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update -O /usr/bin/rpi-update
    chmod +x /usr/bin/rpi-update
    rpi-update
    Update the firmware
    You will need to reboot for these changes to work.
    You may need to delete /boot/config.txt and allow Linux to reconfigure itself.
    Note: any additional modules you have loaded will be lost (and will probably be for the wrong kernel version).