Wednesday, October 31, 2012

Save a CD/DVD - Use a USB flash drive and dd

If you use Linux for ethical reasons then that may be a reason to be consious of our limited and dwindling resources, if you are interested in saving the environment you can refrain from burning a CD or DVD to install your favorite linux distribution. The vast majority of Linux distributions come out with newer versions on a prescheduled timeframe called a release cycle, The exception being Linux distributions that are semi-rolling or rolling release.

If you are like me you enjoy experiencing all that the Linux world has to offer, Choosing a single distrubtion as your main distribution but still dabbling in other distributions as well either through a dual/multi boot or via virtualization if your system is powerful enough. If you are using virtualization then you can simply mount the image upon install. However if you are configuring your to boot with multiple operating systems or simply testing one and reinstalling over the previous partition then this can eat up a lot of CD's or DVD's and waste a lot of money and resources.

You mean to tell me there is an alternative that is both more environmental and saves me money? Yes, The solution is using a USB flash drive in combination with the dd command.

There are a couple of ways to find the name of the device file associated with your USB flash drive, device file names are dynamically created in the order they are connected. Your hard drives show up first, followed by the USB flash drive. I personally have 2 hard drives and 1 USB flash drive so my USB Flash drive shows up as /dev/sdc.

Option 1 - fdisk

$ sudo fdisk -l
                                                                                                                                                                                                                               
Disk /dev/sda: 120.0 GB, 120034123776 bytes                                                                                                                                                                                    
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors                                                                                                                                                          
Units = sectors of 1 * 512 = 512 bytes                                                                                                                                                                                         
Sector size (logical/physical): 512 bytes / 512 bytes                                                                                                                                                                          
I/O size (minimum/optimal): 512 bytes / 512 bytes                                                                                                                                                                              
Disk identifier: 0x000d60b7                                                                                                                                                                                                    
                                                                                                                                                                                                                               
   Device Boot      Start         End      Blocks   Id  System                                                                                                                                                                 
/dev/sda1              63    83971754    41985846   83  Linux                                                                                                                                                                  
/dev/sda2        83971755   105418529    10723387+  82  Linux swap / Solaris                                                                                                                                                   
/dev/sda3       105418530   234436544    64509007+   5  Extended                                                                                                                                                               
/dev/sda5   *   105418593   148424534    21502971   83  Linux                                                                                                                                                                  
/dev/sda6       148424598   191430539    21502971   83  Linux
/dev/sda7       191430603   234436544    21502971   83  Linux

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004f221

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              63   417523711   208761824+   7  HPFS/NTFS/exFAT
/dev/sdb2       417523712  1441523711   512000000    7  HPFS/NTFS/exFAT
/dev/sdb3      1441525758  1543925759    51200001    5  Extended
/dev/sdb4      1543925760  1953523711   204798976   83  Linux
/dev/sdb5      1441525760  1457909759     8192000   82  Linux swap / Solaris
/dev/sdb6      1457911808  1498861567    20474880   83  Linux

Disk /dev/sdc: 8103 MB, 8103395328 bytes
47 heads, 21 sectors/track, 16035 cylinders, total 15826944 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005e84f

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048    15826943     7912448    b  W95 FAT32

Option 2 - ls + verification.
$ ls /dev/sd*
/dev/sda  /dev/sda1  /dev/sda2  /dev/sda3  /dev/sda5  /dev/sda6  /dev/sda7  /dev/sdb  /dev/sdb1  /dev/sdb2  /dev/sdb3  
/dev/sdb4  /dev/sdb5  /dev/sdb6  /dev/sdc  /dev/sdc1
$ sudo mkdir -p /mnt/usb; sudo mount /dev/sdc1 /mnt/usb; df -h | grep sdc; ls /mnt/usb
/dev/sdc1       7.6G  4.0K  7.6G   1% /mnt/usb
clean!*  files_that_dont_matter*
$ sudo umount /mnt/usb
This way may take a little more typing to do the verification that the drive is of the correct size and that you are not erasing important data, If you happen to see a directory structure that looks in any way important to you, either you are targetting the incorrect device or you need to back up your data before running dd. Of course if you are sure the proper device is /dev/sdc after looking you can skip the second and third commands.

The dd command works on the bit level so should be run on the base device and not a partition of the device. I choose /dev/null as my device because at this particular time I had no particular reason to write a CD or DVD image. Depending on the speed of the USB flash drive (mine is slow) and the size of the image it could take a while to perform the write operation.

Warning - make sure the USB flash drive is not mounted prior to running the dd command or damage to your equipment may result, Running DD on the wrong device will cause the device to be erased and written over with the ISO.

$ sudo dd if=./chakra-2012.09-Claire-x86_64.iso  of=/dev/null 
 3254272+0 records in
 3254272+0 records out
 1666187264 bytes (1.7 GB) copied, 0.94725 s, 1.8 GB/s

At this point you should have a fully operational USB drive that shows up exactly like a CD or DVD would. The only other configuration you may have to perform is to access the BIOS and allow the USB drive to boot before the CD/DVD drive and hard drives. Once that is set when you boot your computer you should see the USB act as if it were a CD or DVD.

Congratulations, You have done your best to save the environment and successfully installed your Linux distribution.

chroot - access another Linux from your current Linux

If you need to access one Linux distribution from another chroot is an excellent choice. A couple common usage examples are resetting a forgotten password and reinstalling the bootloader.

I have also used a chroot environment in order to install neccesary packages in order to get the operating system where it is X capable, This is very useful in more advanced Linux systems such as Arch Linux or Gentoo where you start in a command line interface, allowing you access to useful graphical tools such as web browsers to look up information while you work on the system.

Here is a bash script that needs to be run as root, administrator or superuser, it tells you what it is doing while it is doing it. Copy and Paste this into a text file and save. Upon saving the file you need to make it executable, run chmod a+x as root. Then to run the script sh ./

#!/bin/bash
#Written by Edge226.

#Mount Guest Linux Partitions
#modify  with the / partition of the guest system. 

echo "Mounting Guest Operating System."
mount  /mnt/chroot 

#Mount the home partition 

echo "Mounting Home Drive."
mount -o bind /home /mnt/chroot/home 

#Mount Operating system devices.

echo "Mounting System Devices." 
mount -o bind /proc /mnt/chroot/proc 
mount -o bind /dev /mnt/chroot/dev 
mount -o bind /sys /mnt/chroot/sys 
mount -t devpts devpts /mnt/chroot/dev/pts

#Enable Network Access. 

echo "Enabling Network Access." 
cp /etc/resolv.conf /mnt/chroot/etc/resolv.conf
  
#Enter the Chroot Environment. 

echo "Entering the chroot environment." 
env NAME=chroot chroot /mnt/chroot /bin/bash

#Clean up after exiting the environment. 
#Unmount devices.

echo "Unmounting System Devices." 
umount /mnt/chroot/dev/pts
umount /mnt/chroot/sys 
umount /mnt/chroot/dev
umount /mnt/chroot/proc
echo "Done."

echo "Unmounting Home drive."
umount /mnt/chroot/home
echo "Done." 

echo "Unmounting Guest Operating System."
umount /mnt/chroot
echo "Returned to Host System Successfully!"

AMD Graphics Card Overclocking Guide

Any gamer or fan of distributed computing would tell you that a powerful graphics card is key to a high performing computer. That same gamer would also tell you that a sign of a good graphics card is the ability to overclock it. After all, overclocking means greater performance and greater value. For Windows, overclocking a graphics card is common practice. It's no small wonder with the plethora of overclocking utilities available. GNU/Linux, it would seem, got shafted in this department. However, if you're an AMD card owner, things aren't always as they seem. Thanks to the AMDOverdriveCtrl utility, overclocking an AMD graphics card in GNU/Linux is just as easy as in Windows.
To start, head over to Sourceforge and pick up the source. The exact url is; http://sourceforge.net/projects/amdovdrvctrl/. If you're running a Debian based distro like Ubuntu, Mint, Trisquel, or any other Debian based distribution, you're in luck. There will be a pre-compiled .deb package waiting for you. Download it, install, and skip ahead to the overclocking part. For everyone else, browse to the “all files” section. Click on C++ sources and download the newest version. At the time of writing this, it's 1.2.1. The rest of this guide will focus on Red Hat based distributions, but should work with Arch, Gentoo, Slackware, or any other distribution, save the Red Hat specific package management commands.
Once the source tar.bz2 is downloaded, extract it wherever you'd like. The AMDOverdriveCtrl folder is the important one, so select it to extract, not the one named “.” Now that the folder's set up, it's time to download the second set of files. They can be found on AMD's website at http://developer.amd.com/tools/gpu/ADLSDK/Pages/default.aspx. Download the ADL_SDK.zip at the bottom of the page under the downloads section. Extract the the files to /location/of/AMDOverdriveCtrl/ADL_SDK/, obviously replacing the /location/of/ with the path to the actual folder.
With all of the files in place, it's time to open up a terminal and get the build underway. Before you can build, you have to download the required build packages. For a Red Hat distribution, type:


su
yum install gcc gcc-c++ make automake autoconf bison wxGTK-devel -y



Now that the required packages are in place, you can change to the right directory to start building.


cd /location/of/AMDOverdriveCtrl/



Since your system will probably not allow execution of the configure file by default. Type:


chmod +x configure



This will amend the permissions to allow execution of the file. Finally, it's time to configure and build.


./configure
 make
 make install



Some users may get an error in the make process stating that the option “-mwindows” is not valid. If that should happen, don't worry. The fix is as simple as removing the option from the makefile. It is not necessary for a successful GNU/Linux build. If you did get that error, follow these next instructions, if not, keep going.


nano makefile

In the line, “LDFLAGS = -mwindows -s $(shell wx-config...,” delete the -mwindows option. Then simply repeat the steps above. Your build should be successful.
That's it. AMDOverdriveCtrl is installed on your machine. Debian users should pick back up here(Yes it's that easy). It provides a fully functional overclocking utility complete with GUI. Now it is accessible through the application menu of the desktop of your choice. It is usually filed under System or Utilities.

From the interface, it is simple to increase and tweak GPU clock speed, memory speed, voltages and fan speed. It also provides real time monitoring of the graphics card's temperatures to ensure that nothing goes out of control. This method is tested and working with Radeon HD 4XXX – 7XXX series graphics cards. As you experiment, it is important to remember that the maximum temperature for these cards is around 90 degrees Celsius and depending on the card, 1 – 1.18V. Anything above that could seriously endanger your hardware.

That being said, enjoy! You have a fully unlocked and overclockable AMD graphics card!
http://goo.gl/BGVrJP

MY Motto

My photo
giving amenity to all visitor.

Total Pageviews