Linkshare rotating banner

Friday, October 19, 2012

Bonsai Rock, Lake Tahoe, IV

Bonsai Rock Lake Tahoe IV

A serene scene of the Lake Tahoe with the nice natural blend of water, rock, distant forest and clear sky. Vivid blue and soft red present the viewer with pleasing contrast of color and the elliptical rocks on water are pleasant to watch.

Bonsai

Bonsai

A wonderful picture of bonsai that presents a miniaturized view of evergreen pine tress over a cliff.

Bonsai Rock, Lake Tahoe, Nevada, USA

A Tribute to Our Unknown Heroes - Bonsai Rock Study #2 - Lake Tahoe, Nevada, USA

What can I say? Simply hypnotic. Otherworldly. Nice presentation of light and darkness in a serene setting.

Bokeh wallpaper


A bokeh wallpaper in a 2560x1600 pixel format from v3wall.com.

Thursday, October 11, 2012

Aria2 shell script and batch file

I wrote a BASH shell script and a DOS batch file that can be used to download files using aria2 — Aria2 is a command-line tool for downloading files. The script and the batch file take 2 arguments; the first one is for the bittorrent hash in 40-digit hexadecimal number and the second one is for arbitrary one-word description.





aria2.bat can be used on Windows, and aria2.sh can be used on Linux and *BSD. Make sure that aria2c is in PATH. For example, if you want to download an ISO file for the OpenSUSE DVD, you would type something like:



aria2.bat 198472f5217d843cceb1a4c82233f009ed6608af opensuse-dvd-586


To find the value of a bittorrent hash (that long hex number), you can cut it from a magnet link you find on a Web site — Magnet links allow you to download actual files without first having to download bittorrent files (*.torrent). When you see a magnet sign, right-click on it to display the shortcut menu and select Copy Link Location.



btih-demo1

Then, paste it somewhere, for example, inside the URL address bar. The hash value comes after the btih: string.



btih-demo2

After you find the bittorrent hash, use it as the first argument to the script and make up anything for the second argument, as shown in the example above.


Friday, October 5, 2012

Setting the Locale on Linux

A locale is a system setting that allows users to configure the operating system for their own language, date, currency, etc. on Linux. There are slightly different ways to set up locales on different Linux distributions. Here I write how I would normally set up locales on Linux.



To set the system-wide default locale, I would append the LANG= variable to the Linux kernel. The kernel will happily accept the LANG= variable and pass it to the operating system. With syslinux, I would have an entry in syslinux.cfg as follows.



LABEL debian
KERNEL vmlinuz-3.6.0
INITRD /boot/initramfs.lzma
APPEND LANG=en_US.UTF-8 TERM=vt100 root=/dev/sda9


On Debian, Ubuntu, Mint and MEPIS, the system-wide locale may be specified in /etc/environment or /etc/default/locale.



LANG=C.UTF-8


To set your own locale different from the system-wide locale, just add a line to your .bashrc or .xsession:



export LANG=zh_CN.UTF-8


Generating locale-archive Again



The number of locales available on the system may be incomplete in order to save disk space. To see which locales are available, run the following command:



locale -a


If you want to add or remove locales, edit /etc/locale.gen. The following is a sample locale.gen.



ar_SA.UTF-8 UTF-8
bn_IN UTF-8
de_DE.UTF-8 UTF-8
en_US ISO-8859-1
en_US.UTF-8 UTF-8
es_MX.UTF-8 UTF-8
fa_IR UTF-8
fr_FR.UTF-8 UTF-8
gu_IN UTF-8
hi_IN UTF-8
id_ID.UTF-8 UTF-8
it_IT.UTF-8 UTF-8
ja_JP.UTF-8 UTF-8
kn_IN UTF-8
ko_KR.UTF-8 UTF-8
ml_IN UTF-8
mr_IN UTF-8
or_IN UTF-8
pa_PK UTF-8
pt_BR.UTF-8 UTF-8
ru_RU.UTF-8 UTF-8
ta_IN UTF-8
te_IN UTF-8
th_TH.UTF-8 UTF-8
tr_TR.UTF-8 UTF-8
vi_VN UTF-8
zh_CN.UTF-8 UTF-8
zh_TW.UTF-8 UTF-8


After changing the file locale.gen, you need to run locale-gen to regenerate the file /usr/lib/locale/locale-archive.



locale-gen


Enabling All Possible Locales


If you have plenty disk space, then you can enable all locales supported by the current glibc implementation. The list of supported locales is at /usr/share/i18n/SUPPORTED. Just copy it to /etc/locale.gen and rebuild the locales. It will regenerate the file /usr/lib/locale/locale-archive to about 100MB.



cp /usr/share/i18n/SUPPORTED /etc/locale.gen
locale-gen


Running Applications In Different Locales



Use the env command to run an application in a different locale. For example, to run pidgin in Chinese on an English desktop, I would issue:



env LANG=zh_CN.UTF-8 pidgin

Thursday, October 4, 2012

Disk Cloning / Imaging over Network with SSH, Netcat, DD and XZ

Today we have affordable, ample storage and faster bandwidth to facilitate partition imaging and disk cloning over network. Nowadays, it's common and feasible to take the image of a whole partition for various reasons. Compared to file-based backups using tar, disk imaging provides the following advantages.




  • The boot sector is preserved so that it's easy to make it bootable after the restore.
  • Information such as UUID and LABEL is presered, which helps identify the partition in booting and mounting.
  • Information such as ACL and XATTR is preserved, which helps restrict file access and secure the system.
  • Every bit in the unused sectors is preserved, which may assist in digital forensics to uncover deleted or hidden information.


There are commercial programs for disk imaging and backup (Norton Ghost, Acronis True Image). However, Linux users can use readily available tools to get things done. For disk cloning/imaging, we can use ssh, netcat, dd and xz. Note that dd will fail on physically damaged disks. For such disks, use ddrescue instead.



For security and compression, we are going to use ssh and xz in this tutorial. If you don't like xz, feel free to substitute xz with gzip, bzip2 or lzop. Also, netcat is used to stream the dd output over the network. On Debian and Ubuntu derivatives, you need the following packages.




  • bzip2, gzip, lzop, lzma OR xz-utils
  • dd
  • netcat
  • ssh


We are making these assumptions in the following scenarios.




  • Sending computer S

    This computer has IP address 192.168.1.1 and needs to back up partition /dev/sda1.
  • Sending Port

    We'll send using port 5525.
  • Receiving computer T

    This computer has IP address 192.168.1.2 and needs to restore partition /dev/sda2.
  • Receiving Port

    We'll receive at port 7749.


Disk Cloning using dd, xz, netcat and ssh


In this scenario, we will clone a disk partition, simultaneously sending an image of the source partition /dev/sda1 from computer S (192.168.1.1) and restoring it at /dev/sda2 on computer T (192.168.1.2). Make sure that the source partition is not mounted or is mounted read-only. Also, make sure that the target partition size is greater than or equal to the source partition size.




  1. At the sending computer, compress the source partition /dev/sda1 with xz and set up netcat to send it at port 5525:

    dd if=/dev/sda1 bs=16M | xz | nc -l 5525

  2. At the receiving computer, set up a SSH tunnel to the sending computer (192.168.1.1):

    ssh -f -N -L 7749:127.0.0.1:5525 username@192.168.1.1

  3. At the receiving computer, type the following command to receive the partition image and restore it at /dev/sda2:

    nc 127.0.0.1 7749 | xz -d | dd of=/dev/sda2 bs=16M



Alternatively, we could take the following steps to achieve the same thing. However, we start at the receiving computer.




  1. At the receiving computer with the target partition /dev/sda2, type the following command to receive the partition image:

    nc -l 7749 | xz -d | dd of=/dev/sda2 bs=16M

  2. At the sending computer with the source partition /dev/sda1, set up a SSH tunnel to the receiving computer (192.168.1.2):

    ssh -f -N -L 5525:127.0.0.1:7749 username@192.168.1.2

  3. At the sending computer, type the following command to compress the source partition /dev/sda1 and transmit it over the SSH tunnel:

    dd if=/dev/sda1 bs=16M | xz | nc 127.0.0.1 5525

    Note that the transfer may take many hours for a large partition.




Disk Imaging using dd, xz, netcat and ssh


In this scenario, we will just send an image of the source partition /dev/sda1 to the receiving computer T (192.168.1.2) without restoring it. Make sure that the source partition is not mounted or is mounted read-only. A question remains whether to compress the image at the sending or receiving computer. The answer depends on which computer is more powerful. For this example, we'll compress at the sending computer (for network bandwidth reason).




  1. At the sending computer, compress the source partition /dev/sda1 with xz and stream it using netcat:

    dd if=/dev/sda1 bs=16M | xz | nc -l 5525

  2. At the receiving computer, set up a SSH tunnel to the sending computer (192.168.1.1):

    ssh -f -N -L 7749:127.0.0.1:5525 username@192.168.1.1

  3. At the receiving computer, type the following command to receive the file:

    nc 127.0.0.1 7749 > partimg.xz



Alternatively, we could take the following steps to achieve the same thing.




  1. At the receiving computer, set up netcat to listen at port 7749 and save the incoming data to a file partimg.xz.

    nc -l 7749 | dd of=partimg.xz bs=16M

  2. At the sending computer, establish a SSH tunnel to the receiving computer (192.168.1.2) first:

    ssh -f -N -L 5525:192.168.1.2:7749 username@192.168.1.2

  3. At the sending computer, type the following command to compress the source partition /dev/sda1 and transmit it over the SSH tunnel:

    dd if=/dev/sda1 bs=16M | xz | nc 127.0.0.1 5525

    Note that the transfer may take many hours for a large partiiton.




Alternative Simple Commands for Disk Cloning / Imaging


I don't like these methods for some reason, but here I show the simpler methods where netcat is not needed. For disk cloning, type something like this:



dd if=/dev/sda1 bs=16M | xz | ssh username@192.168.1.2 "xz -d | dd of=/dev/sda2 bs=16M"


Just to send an image file, run a command as follows:



dd if=/dev/sda1 bs=16M | xz | ssh username@192.168.1.2 "dd of=partimg.xz bs=16M"


Also Read:


Monday, October 1, 2012

Bittorrent Info Hash Values for Windows 8 ISO

Windows 8 ISO files have the following BTIH hash values. Use them with my aria2 script to download Windows 8.




  1. en_windows_8_x86_dvd_915417.iso

    C5D92B32277685436DEDE9957B80083D26062C03
  2. en_windows_8_x64_dvd_915440.iso

    144C7E2B46103FF84F83A1E6A12D66B740F00CF6

About This Blog

KBlog logo This blog seeks to share useful information on hottest movies available on the Internet. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

icon
Powered By Blogger