Saturday, February 27, 2010

Creating iso images in linux

In windows XP, you would most probably use DVD/CD burning software such as Nero or Deep Burner to make ISO images, and software like alcohol 120% or daemon tools to mount the images.

In Linux, you can use the command line to both make and mount ISO images.

Firstly, the program ‘dd’ which comes standard on any Linux distro can be used to make an ISO image.

the program syntax is relatively simple, here is an example that would make an ISO image of my cdrom0 drive and save it in my home folder as backup_image.iso:
dd if=/dev/cdrom0 of=~/backup.iso
now to explain the command,

the first bit “dd” is the program name (note: dd stands for dataset definition, not data dump as it is mistakenly known as).

the next part of the command “if=/dev/cdrom0″ specifies the input for the program, in this case it is the device cdrom0 (my first CD/DVD drive)

the last bit of the command “of=~backup.iso” specifies the output path and name for the program, in this case the output is a file named backup.iso that is stored in my home directory. the tilde (~) specifies the home directory.

so there you go, a relatively simple method of creating an iso file in linux. You can even put this in a bash script and have the iso file tarballed and gziped and sent off to your file server for archiving, but thats for another article to cover.

the command dd has many more options than what I have shown such as the ability to select block size and write at a certian number of bytes at a time, all these options grant dd great flexibility. Infact, you could use dd to backup entire harddrives and make 1:1 copies of their filesystems. Even damaged drives can be recovered somewhat using dd as it is low-level and works with the raw data on the drive.

Now that you know how to make iso images using dd, you will want to know how to mount them. In linux this is easily achieved using the ‘mount’ command. The first thing you will want to do however, is to create a mount point for your iso image, so as root go ahead and create a directory named iso in /mnt. try using this command if your distro supports sudo -
sudo mkdir /mnt/iso
this creates a directory named iso in your /mnt directory , we will use this directory as a mount point for out iso image.

now mount the image -
sudo mount -o loop ~backup.iso /mnt/iso
this command mounts the backup.iso file found in your home directory to the mount point /mnt/iso the -o loop part of the command allows the iso file to be treated as a block device.

now that you have mounted the iso, go to your /mnt/iso directory and you should see that the iso contents are readable and usable. :D

to unmount the iso image, type in this command :
umount ~backup.iso

Thursday, February 25, 2010

X-CD-Roast 0.98alpha14 Manual

Content:

1 Prolog
2 The first start
3 How to duplicate a CD
4 How to rip a CD
5 How to create a data CD
6 How to create an audio CD
7 How to burn DVDs
8 Appendix A: GNU Free Documentation License
9 Appendix B: Glossary
10 Appendix C: Reference

Tuesday, February 23, 2010

How to change the default run level of a RedHat 9.0 or Fedora Core Linux system

During the boot process for Redhat 9.0 and Fedora Core systems the init command opens the /etc/inittab file to decide what "runlevel" the system should be booted to. The /etc/inittab file is a plain text file that can be opened with your favorite text editor.

The relavent section of a sample /etc/inittab file is as follows:

# Default runlevel. The runlevels used by RHS are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:3:initdefault:

The key line in the example above is:

id:3:initdefault:

This tells the init process that the default run level for the system is run level 3. To change to a different run level simply change the number and save the /etc/inittab file. Before doing this, however, be absolutely sure you know which run level you want. Selecting the wrong runlevel can have serious consequences. To help with this a detailed description of the individual run levels is outlined in the table below:
Runlevel 0---> The halt runlevel - this is the runlevel at which the system shuts down. For obvious reasons it is unlikely you would want this as your default runlevel.
Runlevel 1---> Single runlevel. This causes the system to start up in a single user mode under which only the root user can log in. In this mode the system does not start any networking or X windowing, X or multi-user services. This run level is ideal for system administrators to perform system maintenance or repair activities.
Runlevel 2---> Boots the system into a multi-user mode with text based console login capability. This runlevel does not, however, start the network.
Runlevel 3---> Similar to runlevel 2 except that networking services are started. This is the most common runlevel for server based systems that do not require any kind of graphical desktop environment.
Runlevel 4---> Undefined runlevel. This runlevel can be configured to provide a custom boot state.
Runlevel 5---> Boots the system into a networked, multi-user state with X Window System capability. By default the graphical desktop environment will start at the end of the boot process. This is the most common run level for desktop or workstation use.
Runlevel 6---> Reboots the system. Another runlevel that you are unlikely to want as your default.

Friday, February 19, 2010

Linux Bluetooth File Transfer (pc to mobile)

This is continuation from the previous Howto I wrote. This assumes that you have manged to successfully transfer files from the bluetooth (phone) to PC. So now you want a file transfered to the bluetooth phone. Lets try this the simple way and that you have a standard setting on the bluetooth phone.
Before you start, check the following packages are installed:
gnome-utils-2.14.0-5.
gnome-bluetooth-0.7.0-2
gnome-bluetooth-libs-0.7.0-2
libbtctl-0.6.0-5
openobex-1.1-1

1. Ensure bluetooth service is running and detect services your phone provides
Code:

service bluetooth start
hcitool scan

Scanning ...
00:16:75:85:82:12 Moto V360 Nicholas

sdptool browse 00:16:75:85:82:12

2. On the FC5 PC.
As normal user.
Right click "Panel bar" -> "Add to panel" -> "Create a new launcher"
Click "Add" button and fillin as follows:

Name: Send via bluetooth
Generic name: gnome-obex
Command: gnome-obex-send %f
Type: Application
Icon: (Select the bluetooth symbol..looks like two arrow pointing to right on a blue pebble)

Click "Close"
Then Click "Close" button

3. Start bluetooth on the phone (I am using Motorola V360)
Menu -> bluetooth -> Setup -> Find Me

On the FC5 open Nautilus and search for a file type that the phone recognise. I am using JPEG file. Drag the file to the bluetooth icon on the panel.

Wait until a Window "Choose Bluetooth device" appears with your phone name. Click on the phone name and click "OK". On the phone you should see it is connecting and an "Incoming transfer" box appear". Click on "Accept" and wait for the file to be sent to the phone. Then click on "Save"

Linux Bluetooth File Transfer (mobile to pc)

Firstly, transfering a file from a bluetooth device to Linux Fedora Core 5 is easy. The FC5 kernel is 2.6.18-1.2200 on a 32 bit machine.
I have the following: A Motorola V360 with Bluetooth. My PC is connected to a bluetooth doggle (blue thunder). My desktop is on the default GNOME 2.14.3.

[OPTIONAL]
Install usbutils-0.71-2 as it helps to detect the USB bluetooth doggle.
As root
Code:
yum install usbutils
1. Ensure that the bluetooth clients are installed:
gnome-bluetooth
gnome-bluetooth-libs
Code:
yum -y install gnome-bluetooth gnome-bluetooth-libs
Dependency: libbtctl-0.6.0-5 and openobex-1.1-1
2. Ensure the Bluetooth service is running. Since my PC does not have Bluetooth, I need to plugin the bluetooth doggle now. Display the end of the log file.
As root
Code:
cat /var/log/messages
This will display some HCI device messages. Mine shows the following:
Oct 29 14:20:27 xcitebox hcid[27885]: HCI dev 0 registered
Oct 29 14:20:27 xcitebox kernel: hci_cmd_task: hci0 command tx timeout
Oct 29 14:20:27 xcitebox hcid[1630]: HCI dev 0 registered
Oct 29 14:20:28 xcitebox hcid[27885]: HCI dev 0 up
Oct 29 14:20:28 xcitebox hcid[27885]: Starting security manager 0
Oct 29 14:20:28 xcitebox hcid[1630]: HCI dev 0 up
Oct 29 14:20:28 xcitebox hcid[1630]: Starting security manager 0


As root
Code:
service bluetooth start
3. Test the connection by the following command:
As user
Code:
hcitool scan
4. At the phone
Select bluetooth link menu
->Set up ->Find Me

You should see that the hcitool scanning is able to find the phone.

5. Start the bluetooth client.

Application -> System tools -> Bluetooth File Sharing

On the phone send the image or any other data via bluetooth.
Example: On the phone select the Picture
-> menu -> copy -> bluetooth -> [Look for devices]
Select the Bluetooth doggle device

6. On the PC
When the bluetooth request is received a pop up box will appear
"Accept a file from <......your phone name...> "

Click "Accept"

Finally, you should be able to find the file in your home directory. Hope it works for you as simple as I have found it.