Migrate Windows 10 HDD to SSD using Clonezilla


Important Note: Ensure you backup any important data before you proceed. Consider doing a windows system backup. I will not be held responsible if you wreck your windows installation or lose data following this post.

 

Things you need:

Windows Installation DVD

Clonezilla – Burn to DVD or USB ; https://clonezilla.org/

GParted – Burn to DVD or USB ; https://gparted.org/

External Sata Cable to connect HDD via USB

 

Step 1 – Resize Windows Partition

[Only if you SSD is smaller than your HDD]

You need to make sure that the partition where your windows is installed is smaller than the SSD size. E.g in my case 256GB SSD, my C: drive had to be downsized to 200GB.

Proceed using gparted. This is fairly simple and well documented on https://www.howtogeek.com/howto/windows-vista/using-gparted-to-resize-your-windows-vista-partition/

Step 2 – Install Windows on SSD

Once your partition is downsized, you can shutdown your Windows and replace the HDD with the new SSD.

Install the same version of Windows, skip all to defaults during installation – Network setup etc is not required.

Once done, you can safely shut it down.

Step 3 – Clone windows partition

  1. Boot to clonezilla.
  2. Connect your HDD via USB Sata Connector to the PC
  3. Go to “Start Clonezilla”
  4. device-device Clone
  5. Select beginner mode
  6. Select Part_to_local_part clone
  7. Select the source as /dev/sdbX(select your windows C: partition from the HDD)
  8. Select the target as /dev/sda2 (Select your new windows C: partition on the SSD)
  9. Proceed with the cloning
  10. When clone is done, disconnect the USB external HDD
  11. Remove clonezilla DVD and reboot.

Voila.

You should now be able to boot into your SSD partition with your migrated windows.

 

Read More

Linux: Sudoers


What is it?

Sudoers is a list of users which may execute root commands. A sudoers file is made up of two types of entries, aliases and user specifications

How to set it up?

Do a visudo on command line, then add the user to the list as below.

If you want to enter the user’s password before executing the command:

myuser ALL=(ALL) ALL

And without a password:

myuser ALL=(ALL) NOPASSWD: ALL

 

Read More

How-to: Local Backup with rsync


A backup using the rsync command can be very useful because it:

Takes less time to replicate

rsync will replicate the whole content between the source and the destination directory only once. Consecutive rsync’s will transfer only the changed blocks or bytes, which makes it very fast

uses Less bandwidth usage

rsync will use compression of data block by block at the sending end and decompress at the receiving end

is Secure

rsync uses ssh protocol during transfers and hence allows encryption of data.

The script broken down

I will create a script which will backup my current web directory /data to the same server on a disk mounted at /backup. The script if broken down, can be viewed as:

rsync -azvu –progress /data/ /backup

wher options

  • z is for compress mode
  • v is for verbose mode
  • a is to preserve symbolic links, permissions, timestamp and to be recursive
  • u is to preserve unmodified files at the destination
  • progress is to show the progress during transfer

An extract of the transfer start is:

sending incremental file list
data/
data/log/
data/log/gulshan.beejan.log
8713 100%    0.00kB/s    0:00:00 (xfer#1, to-check=1004/1010)
data/lost+found/

ending with:

sent 284122142 bytes  received 230478 bytes  1914832.46 bytes/sec
total size is 379003084  speedup is 1.33

Now, if I perform a second transfer, the result at the end will be much faster. Here’s a extract of that transfer:

[root@sdb backup]# rsync -avzu –progress /data /backup
sending incremental file list

sent 278200 bytes  received 1778 bytes  50905.09 bytes/sec
total size is 379003084  speedup is 1353.69

 The script

Let’s convert that into a nice and clean script, shall we?

Create a file in

vi /scripts/localrsync.sh

Paste the following:

#!/bin/bash

# declare variables

SOURCE_DIR=/data

DESTINATION_DIR=/backup

#rsync command, make sure the user you run this file as has the required permissions to the source/dest folder

#we dont need progress or verbose, this runs in background mode

rsync -azu  $SOURCE_DIR $DESTINATION_DIR

Chmod 777 the sh file

chmod 777 /scripts/localrsync.sh

Test the file

sh /scripts/localrsync.sh

[root@sdb ~]# sh /scripts/localrsync.sh
sending incremental file list

sent 278200 bytes  received 1778 bytes  62217.33 bytes/sec
total size is 379003084  speedup is 1353.69

Add it to crontab,

 crontab -e

Add this line at the end to run it daily, every 2AM

*    2    *    *    *    sh /scripts/localrsync.sh

 

Read More

How-to: Null Route IP in Linux


It does get quite annoying when you are trying to work(which most of the time, my work involves a lot of research online) and someone(Mr. X) in your network is hogging everything down by his movie downloads. Now, our network is secured by ClearOs, which in my opinion is a really good solution. But.. it does not work when Mr. X is using IDM via an SSH Tunnel, which is not really easy to detect.

So today, after the pain of waiting for 5minutes to wait for my OWN web site to load.. I decided to null route the SSH Tunnel’s IP to the gateway.

[root@clearos ~]# cat /etc/redhat-release
CentOS release 5.4 (Final)

ClearOS is running on CentOS 5.4 32-bit, which is great for the command below as root:

route add that_ip_that_i_hate gw 127.0.0.1 lo

use netstat -nr to verify

To delete the routing;

route delete that_ip_that_i_hate

VOILA! Mr.X is gone and my post is here!

Read More

How to Install & Configure FTP Server on CentOS 6.2


I recently upgraded the server to CentOS 6.2 x64, which involved backing up to another server, clean re-install with cherokee’s latest version and some other configurations. Among those, was the ftp configuration which has been made by vsftpd.

The installation is quite straight-foward, run the following in a terminal as root:

yum install vsftpd

You will need to modify a few parameters in your configuration file to get it running smoothly.

vi /etc/vsftpd/vsftpd.conf

 

Set the following:

anonymous_enable=NO

uncomment the following:

ascii_upload_enable=YES

ascii_download_enable=YES

chroot_local_user=YES

chroot_list_enable=YES

chroot_list_file=/etc/vsftpd/chrootlist

ls_recurse_enable=YES

 

In this process, the user’s home directory will become FTP home directory, which is what we want really.

You need to create an ftp chroot list in /etc/vsftpd/chrootlist by:

vi /etc/vsftpd/chrootlist

Add the ftp created user in this file.

service vsftpd start

 

Read More