Cloning Bootable Linux Disk

I got a new and bigger HDD for my webserver and so I decided to clone my existing one (128GB) to the new one (512GB). The best thing was that I didn’t need to install and configure all my applications again, so here is a short manual that worked in my case.

  1. Download Ubuntu Desktop
  2. Create a bootable USB disk with Rufus
  3. Start from USB disk and choose “Try Linux from bootable media”
  4. After Linux has started open a terminal and enter the following commands to copy the disk layout:
    >> sudo bash [go to superuser mode]
    >> fdisk /dev/sda [source disk]
    >> o [dump disk layout to file]
    >> q [quit]
    >> fdisk /dev/sdb [destination disk]
    >> d [delete]
    >> I [load disk layout from currently saved sda layout]
    >> w [write layout]
  5. Now clone all data from the source disk to the destination disk by following this command:
    >> dd if=/dev/sda1 of=/dev/sdb1 bs=64K conv=noerror,sync [blocksize 64K, don't stop on error and keep syncing] Don't mix up input and output disk!!!
  6. Now you have to make the destination disk bootable again:
    >> mount /dev/sdb1 /mnt
    >> grub-install --root-directory=mnt /dev/sdb
  7. If all worked correctly you can optionally open gparted and resize the cloned partation to your needings.

 

Visual Studio 2015 CE and GitLab

Here is a small example of how you can use Visual Studio 2015 CE with Gitlab:

  1. Create a new project in GitLab and clone it to your local file system. Notice you will need the http link to your project in a later step.
  2. Open Visual Studio 2015 CE and create a new project in the cloned directory. VS 2015 CE will automatically detect the git version control.
  3. Go to the Team Explorer register tab and follow these steps:
    vs2015_ce_git_1
    Next open the the Repository Settings by clicking on the combobox in the top area of the register card.
    vs2015_ce_git_2
    Go to the Remotes section and ente your GitLab projectlink from step 1.
    vs2015_ce_git_3
    Go to the Changes section and make a comment to the included files.
    vs2015_ce_git_4
    If all is successfully configured you can now go to the Synchronization section and sync, fetch, pull or push your project.
    vs2015_ce_git_5
Congratulation! You managed to use Visual Studio 2015 CE with your GitLab repository!

TortoiseGit and GitLab

Here are the steps to use TortoiseGit with GitLab:

  1. Create a new project or use an existing one und notice the SSH link, e.g.
    git@SERVER:user/test.git
  2. Create secret keys with puttygen
    C:\Program Files\TortoiseGit\bin\puttygen.exe
    puttygen_1
    a) Press Generate
    b) Move mouse in the empty area until key has been generated
    c) Save public and private key (fill out Key passphrase)
    d) Copy public key from the Public key for pasting into OpenSSH… area
  3. Log into your GitLab site and go to your Profile settings menu, select the SSH Keys button and paste your copied public key in the empty area. Save your profile.
  4. Select local repository folder, right click and select Git clone. Fill out the form like this example below:
    Gitclone_1
    Press OK (and enter your Key passphrase from your private key)
Congratulation! You successfully configured your TortoiseGit with GitLab!

Linux OpenSSL Certificate for Gitlab

This is a small tutorial of creating a self-signed OpenSSL certificate.

Create a private key:
>> openssl genrsa -des3 -out gitlab.domain.key 2048

Create request:
>> openssl req -new -key gitlab.domain.key -out gitlab.domain.csr
Fill out form:
--> 'Server Hostname': your gitlab.domain
--> skip 'Challenge Password'
--> skip 'Optional Company Name'

Clear pass phrase:
>> cp -v gitlab.domain.{key,original}
>> openssl rsa -in gitlab.domain.original -out gitlab.domain.key
>> rm -v gitlab.domain.original

Create certificate:
>> openssl x509 -req -days 1460 -in gitlab.domain.csr -signkey gitlab.domain.key -out gitlab.domain.crt
>> rm -v gitlab.domain.csr

Change file permissions:
>> chmod 600 gitlab.domain.*

Windows 10 – Linux Samba Access Error

After installing the RTM Version of Windows 10 on my system I recognized that my Samba shares from my Ubuntu (14.04 LTS) server are not accessable anymore. I was looking around the internet for hours, tried registry hacks and various network security settings until I found a solution. It is very simple and doesn’t need any changes on the Windows system.

First here ist the error message I got from connect to my Linux Server from the Explorer:

\\Remote-Server is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions.

The account is not authorized to log in from this station.

Solution:
The solution is based on the error message code that I got from using the net use * \\Remote-Server command from the Windows system. It seems to be that Windows needs a domain user on the Linux system, so I created a local user that had the same username that I have in the Windows system. Here are the steps.

Linux

>> useradd winuseraccount@outlook.com
>> passwd winuseraccount@outlook.com
>> usermod -G users winuseraccount@outlook.com [the group users is configured in Samba as valid access group]
>> service samba restart

Windows
Add the network share to your system.

Open the Control Panel – User Accounts – Windows Account Information – Add new Windows Account Information like:

Internet- or Network address:     \\Remove-Server
Username:                                  winuseraccount@outlook.com
Password:                                   userpassword

Now you can try it out by opening the Explorer and entering \\Remote-Server in your address bar. For me it worked on my desktop and my tablet.

RaspberryPi 2 Webserver

This WordPress blog (and also ownCloud) is running on my new RaspberryPi 2! Awesome for this price and the power consumtion is very low (<15W inclusive my router) measure by a simple electric socket wattmeter. That means in Euros:

15W * 24h * 365d / 1000 = 131.4kWh
131.4kWh * 0.18€ = 23.65€/year

I’m going to try it out and see how long the RaspberryPi will work. If there are any problems I will give an update about my experiences.

See my RaspberryPi section if you want to build your own small and userfriendly webserver!