Clone a Hard Drive using Ubuntu Live CD

I have a hard drive-duplicator device. It works great if you two of the same drive. But I’ve had issues transferring from an SSD to a regular hard drive (and vice versa).

I looked into buying the EaseUS Disk Copy program (only works in Windows) but now they want a subscription? Hell no to that. So here we are, looking to Ubuntu for our solution!


EDIT: I used the following method to duplicate my Ubuntu Server backup and the copied disk booted into grub (no boot loader). All things considered, one of those duplicators found easily on ebay and Amazon are the best bet. They are much faster and more accurate. For the error I did get using the physical drive duplicator, it was easy to fix. I booted with an Ubuntu Desktop Live USB and used the Disks program to repair. No issues after that. The model I have is a Sabrent EC-HD2B and I have to say it’s pretty nice.

I found a great guide to duplicating hard drives using an Ubuntu Live CD/USB.
Balena Etcher will help you write the Ubuntu Live ISO to a USB disk.


Once you run the Ubuntu Live disk, open a terminal.

Plug in your first drive (the one that you want to copy).

sudo fdisk –l

Take note of what fdisk reports for this drive. It is likely /dev/sda

Now, plug in your second drive (the one you want to overwrite).
Run ‘sudo fdisk –l’ again.
fdisk will likely report this drive as /dev/sda.

Do not confuse the two drives. Here’s a sample statement that will allow your computer to copy the first drive to the second. Replace the drive names as necessary. In this example, sda is the source and sdb is the target:

sudo dd if=/dev/sda of=/dev/sdb

This process can take several hours. Do not turn your machine off until you see a report in your terminal that the process is complete. In my case, it took over 24 hours to copy a 1TB drive with a Mac Mini (Mid 2012)!

Example output when done:

1953525167+0 records in
1953525167+0 records out
1000204885504 bytes (1.0 TB, 932 GiB) copied, 102499 s, 9.8 MB/s

Connect a PC to a Commodore 1541/1571 drive

Did you ever want to transfer files from your old Commodore 1541/1571 drive between your computer and a real drive? Did you also want to use a real Commodore floppy drive with the VICE emulator? Me too! 😉 Both of these things are possible with the zoomfloppy device being offered by Retro Innovations. You can download basically anything you want from arnold.c64.org (or any other commodore software source) and transfer it right to your floppy device so it can be used on a real Commodore 64 or Vic 20.

This device is unlike other solutions that only worked with specially built cables and DOS. You simply plug a USB cable between your zoomfloppy and your computer and then the serial cable between the zoomfloppy and the floppy drive. Once the physical connections are made, you simply run the OpenCBM software to transfer files or backup disks.
Here’s how to install a zoomfloppy device to your Ubuntu computer.

sudo apt-get install libusb-dev build-essential linux-headers-generic git

Install the CC64 Compiler:

cd ~
git clone https://github.com/cc65/cc65.git
cd cc65
make
sudo prefix=/usr make install

Compile and install OpenCBM

cd ~
git clone git://git.code.sf.net/p/opencbm/code opencbm
cd opencbm/opencbm
make -f LINUX/Makefile
sudo make -f LINUX/Makefile install install-all install-plugin-xum1541
sudo ln -s /usr/local/lib/libopencbm.so.0 /usr/lib/libopencbm.so.0

Add udev rules for the ZoomFloppy hardware itself:

sudo pico /etc/udev/rules.d/45-opencbm-parallel.rules

Add this to the bottom of the file, then save and quit:

SUBSYSTEM!="usb_device", ACTION!="add", MODE="0666", GOTO="opencbm_rules_end"
# zoom floppy
ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="0504", GROUP="users", MODE="0666"
LABEL="opencbm_rules_end"

Restart udev:

sudo service udev restart

Check the ZoomFloppy and IEC device status:

cbmctrl detect

Bonus: Get VICE to use the zoomfloppy interface to utilize a real 1541 Commodore Floppy Drive!

1. Settings -> Peripheral Settings -> Device #8 -> Enable IEC Device
2. Settings -> Peripheral Settings -> Device #8 -> Device Type -> Real Device Access

Commodore 64 (Vic 20, Pet, etc) emulator from Raspberry Pi Raspbian

I can confirm this install method (source) worked with a Raspberry Pi 4 using Raspbian Buster.
Compiles Vice and installs into /usr/local/bin. Initial launch reports a sound issue. If you go into settings (F12), there’s a sound configuration you can change to “Alsa”.

# get dependencies – this may take a long time and ~ 1.5 GB
sudo apt install autoconf automake build-essential byacc dos2unix flex libavcodec-dev libavformat-dev libgtk2.0-cil-dev libgtkglext1-dev libmp3lame-dev libmpg123-dev libpcap-dev libpulse-dev libreadline-dev libswscale-dev libvte-dev libxaw7-dev subversion texi2html texinfo yasm libgtk3.0-cil-dev xa65 libsdl2-dev
mkdir -p src
cd src
svn checkout https://svn.code.sf.net/p/vice-emu/code/trunk trunk
cd trunk/vice
./autogen.sh
./configure
make -j4
sudo make install

Ubuntu fstab; mount external drive at boot

Procedure for rescuing an Ubuntu Server when the boot file gets messed up due to a misnamed external hard drive.
Backup the current fstab file:

sudo cp /etc/fstab /etc/fstab.old

List the drives:

sudo blkid

Example output:

/dev/sda1: UUID="8F1B-7691" TYPE="vfat" PARTUUID="eea0152e-f8aa-4d1f-8d44-172261edd5a2"
/dev/sda2: UUID="5be250be-a857-11e8-9dd6-a82066361186" TYPE="ext4" PARTUUID="9ba42200-226c-4e67-a667-649658dfbd0b"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/sdb1: LABEL="media" UUID="746622C40BE949C9" TYPE="ntfs" PTTYPE="dos" PARTUUID="e2bd323d-a7bb-4be8-83bb-4d547fb45e37"

Edit the fstab file:

sudo pico /etc/fstab

Example:

GNU nano 2.9.3 /etc/fstab
UUID=5be250be-a857-11e8-9dd6-a82066361186 / ext4 defaults 0 0
UUID=8F1B-7691 /boot/efi vfat defaults 0 0
/swap.img none swap sw 0 0
#Device #Mountpoint #fs-type #options #dump #fsck
/dev/sdb1 /media/usb ntfs defaults 0 0

Save, reboot.

Force Ubuntu Server to redirect http to https

If you want to redirect your web address from http to https, you will have to configure your server’s virtual host file.
Edit the virtualhost file to update the port 80 portion; replace “test.com” with your domain name:

sudo nano /etc/apache2/sites-available/test.com.conf

Edit the :80 portion (in bold), replacing <ip_or_host> with your domain name:

<VirtualHost *:80>
        ServerName <ip_or_host>
        Redirect "/" "https://<ip_or_host>"
</VirtualHost>
<VirtualHost *:443>
        ServerName <ip_or_host>
        DocumentRoot /var/www/whateverfolder
        SSLEngine on
        SSLCertificateFile      /etc/ssl/certs/apache-selfsigned.crt
        SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
        <Directory /var/www/whateverfolder/public>
           DirectoryIndex index.php
           AllowOverride All
           Require all granted
        </Directory>
</VirtualHost>

Save the .conf file
Modify the default Apache config file:

sudo nano /etc/apache2/sites-available/000-default.conf

Then add the bold portion (starting with “RewriteEngine on”) to the bottom of the file. Replace example.com with your domain name.

<VirtualHost *:80>
     ServerAdmin admin@example.com
     DocumentRoot /var/www/html/example.com/
     ServerName example.com
     ServerAlias www.example.com
     <Directory /var/www/html/example.com/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
     </Directory>
     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com [OR]
RewriteCond %{SERVER_NAME} =www.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

Enable the .conf files:

sudo a2ensite test.com.conf
sudo a2ensite 000-default.conf

Reboot your apache server:

sudo service apache2 restart

Test your server config in your web browser by typing in: http://www.example.com

Internet Security Habits, tips and tricks

Urban Knish discusses some good internet security habits in the age of data collection and man-in-the-middle attacks.

Relevant links:
Firefox Browser, Ghostery Plugin, HTTPS Everywhere, NoScript
ProtonVPN, AstrillVPN, Private Internet Access VPN
Tor Browser for the computer
Tor Browser for IOS
Tor Browser for Android
TailsOS

Install Linux console programs like Lynx on Mac OSX

You can install much loved Linux console programs like Lynx (text web browser) and Midnight Commander (powerful file browser) on Mac OSX using homebrew program installer “Brew”.

Example: Install Lynx
First you must install Brew. After this, you can install other programs with Brew.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null

Now use Brew to install Lynx:

brew install lynx

Now you can test it out:

lynx thinkzinc.com

Did you see thinkzinc.com in a text browser?

Try installing the Midnight Commander:

brew install mc

You can check out the “Brew” homepage and use the search for new programs to install. You can also very how many programs you have installed with this command:

brew list

I love Mac OSX but I can’t live without Lynx. Web surfing without busy ads and pictures. Enjoy!

Install Sony Playstation Now (PS Now) on Ubuntu

I’m always looking at ways to play video games on Ubuntu Linux. This one is a doozy. With Playstation Now, you can play over 700 real PS2, PS3 and PS4 games on your Ubuntu computer. The technology uses streaming from remote server where the gaming console exists. Sony typically will give you a couple weeks as a free trial though the deals vary. I was able to take advantage of a Black Friday sale with one full year of PS Now for only $70. Fantastic deal.

Here’s how to install PS Now on Ubuntu:

First install wine if it’s not already installed. Wine is a Linux program that helps us run Windows programs on the Linux platform.

sudo apt install wine-stable

Next, download winetricks into your downloads folder.

cd "${HOME}/Downloads"
wget  https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
chmod +x winetricks

Now install some Windows apps with winetricks.

./winetricks corefonts
./winetricks vulkansdk
./winetricks dxvk
./winetricks vcrun2013

Now we are going to install Lutris, which is a program that helps you install games and other apps on your Wine Windows installation.

sudo apt-get install lutris

Once you find Lutris in your application menu and launch it.
Now visit the Lutris website and launch the PS Now installer.
https://lutris.net/games/playstation-now/
After you select ‘install’ you will see a Playstation Now icon in the Lutris application.

Here’s where I ran into trouble with this installation Mind you, I figured all this out by using directions cobbled together from many broken install methods I found on the web! When I tried to launch PS Now from Lutris, I was met with a message that said, “Vulkan is not installed” even though I installed it with winetricks (above).

Here’s the fix:

Right-click on the Playstation Now icon in Lutris.
Select “configure”.
Select the “runner options” tab.
Turn “Enable DXVK” off.
Save and relaunch. After poking on a couple dialog boxes, you should be good to go!