Thursday, November 17, 2011

Erase the rw & write the iso image via command line in linux

Howto: Linux write (burn) data to DVD or DVD/RW

In order to write DVD/DVD-RW from shell prompt you need to install a package called dvd+rw-tools.

DVD is another good option for backup, archiving, data exchange etc. You can install dvd+rw-tools with following commands. Also note that this package works under *BSD, HP-UX, Solaris and other UNIX like operating systems.

Debian installation:
# apt-get install 'dvd+rw-tools'

Fedora Core Linux installation:
# yum install 'dvd+rw-tools'

RedHat Enterprise Linux installation:
# up2date 'dvd+rw-tools'

In order to write DVD you need to install cdrecord tools.

How do I write DVD?

You need to use growisofs command, which combined mkisofs frontend/DVD recording program. From growisofs man page, "growisofs was originally designed as a frontend to mkisofs to facilitate appending of data to ISO9660 volumes residing on random-access media such as DVD+RW, DVD-RAM, plain files, hard disk partitions. In the course of development general purpose DVD recording support was implemented, and as of now growisofs supports not only random-access media, but even mastering of multiession DVD media such as DVD+R and DVD-R/-RW. In addition growisofs supports first-/single-session recording of arbitrary pre-mastered image (formatted as UDF, ISO9660 or any other file system, if formatted at all) to all supported DVD media types."

First create the ISO image
# mkisofs -r -o /tmp/var-www-disk1.iso /var/www

Now use the growisofs command to write the ISO onto the DVD:
# growisofs -Z /dev/dvd=/tmp/var-www-disk1.iso

To append more data for same DVD:
# growisofs -M /dev/dvd /tmp/file.1

To format (erase) a DVD:
# dvd+rw-format -force /dev/dvd
OR
# dvd+rw-format -force=full /dev/dvd

The dvd+rw-format command formats dvd disk in the specified dvd drive.

To display information about dvd drive and disk using dvd+rw-mediainfo command:
# dvd+rw-mediainfo /dev/dvd

Erase the rw & write the iso image via command line in linux

Howto: Linux write (burn) data to DVD or DVD/RW

In order to write DVD/DVD-RW from shell prompt you need to install a package called dvd+rw-tools.

DVD is another good option for backup, archiving, data exchange etc. You can install dvd+rw-tools with following commands. Also note that this package works under *BSD, HP-UX, Solaris and other UNIX like operating systems.

Debian installation:
# apt-get install 'dvd+rw-tools'

Fedora Core Linux installation:
# yum install 'dvd+rw-tools'

RedHat Enterprise Linux installation:
# up2date 'dvd+rw-tools'

In order to write DVD you need to install cdrecord tools.

How do I write DVD?

You need to use growisofs command, which combined mkisofs frontend/DVD recording program. From growisofs man page, "growisofs was originally designed as a frontend to mkisofs to facilitate appending of data to ISO9660 volumes residing on random-access media such as DVD+RW, DVD-RAM, plain files, hard disk partitions. In the course of development general purpose DVD recording support was implemented, and as of now growisofs supports not only random-access media, but even mastering of multiession DVD media such as DVD+R and DVD-R/-RW. In addition growisofs supports first-/single-session recording of arbitrary pre-mastered image (formatted as UDF, ISO9660 or any other file system, if formatted at all) to all supported DVD media types."

First create the ISO image
# mkisofs -r -o /tmp/var-www-disk1.iso /var/www

Now use the growisofs command to write the ISO onto the DVD:
# growisofs -Z /dev/dvd=/tmp/var-www-disk1.iso

To append more data for same DVD:
# growisofs -M /dev/dvd /tmp/file.1

To format (erase) a DVD:
# dvd+rw-format -force /dev/dvd
OR
# dvd+rw-format -force=full /dev/dvd

The dvd+rw-format command formats dvd disk in the specified dvd drive.

To display information about dvd drive and disk using dvd+rw-mediainfo command:
# dvd+rw-mediainfo /dev/dvd

Monday, November 14, 2011

NIC's Bonding in rhel

RHEL: Linux Bond / Team Multiple Network Interfaces (NIC) Into a Single Interface

Finally, today I had implemented NIC bounding (bind both NIC so that it works as a single device). Bonding is nothing but Linux kernel feature that allows to aggregate multiple like interfaces (such as eth0, eth1) into a single virtual link such as bond0. The idea is pretty simple get higher data rates and as well as link failover. The following instructions were tested on:

  1. RHEL v4 / 5 / 6 amd64
  2. CentOS v5 / 6 amd64
  3. Fedora Linux 13 amd64 and up.
  4. 2 x PCI-e Gigabit Ethernet NICs with Jumbo Frames (MTU 9000)
  5. Hardware RAID-10 w/ SAS 15k enterprise grade hard disks.
  6. Gigabit switch with Jumbo Frame

This server act as an heavy duty ftp, and nfs file server. Each, night a perl script will transfer lots of data from this box to a backup server. Therefore, the network would be setup on a switch using dual network cards. I am using Red Hat enterprise Linux version 4.0. But, the inductions should work on RHEL 5 and 6 too.

Say Hello To bounding Driver

Linux allows binding of multiple network interfaces into a single channel/NIC using special kernel module called bonding. According to official bonding documentation:

The Linux bonding driver provides a method for aggregating multiple network interfaces into a single logical "bonded" interface. The behavior of the bonded interfaces depends upon the mode; generally speaking, modes provide either hot standby or load balancing services. Additionally, link integrity monitoring may be performed.

Step #1: Create a Bond0 Configuration File

Red Hat Enterprise Linux (and its clone such as CentOS) stores network configuration in /etc/sysconfig/network-scripts/ directory. First, you need to create a bond0 config file as follows:
# vi /etc/sysconfig/network-scripts/ifcfg-bond0
Append the following linest:

  DEVICE=bond0 IPADDR=192.168.1.20 NETWORK=192.168.1.0 NETMASK=255.255.255.0 USERCTL=no BOOTPROTO=none ONBOOT=yes  

You need to replace IP address with your actual setup. Save and close the file.

Step #2: Modify eth0 and eth1 config files

Open both configuration using a text editor such as vi/vim, and make sure file read as follows for eth0 interface
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Modify/append directive as follows:
DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

Open eth1 configuration file using vi text editor, enter:
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
Make sure file read as follows for eth1 interface:
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

Save and close the file.

Step # 3: Load bond driver/module

Make sure bonding module is loaded when the channel-bonding interface (bond0) is brought up. You need to modify kernel modules configuration file:# vi /etc/modprobe.conf
Append following two lines:alias bond0 bonding
options bond0 mode=balance-alb miimon=100

Save file and exit to shell prompt. You can learn more about all bounding options by clicking here).

Step # 4: Test configuration

First, load the bonding module, enter:
# modprobe bonding
Restart the networking service in order to bring up bond0 interface, enter:
# service network restart
Make sure everything is working. Type the following cat command to query the current status of Linux kernel bounding driver, enter:
# cat /proc/net/bonding/bond0
Sample outputs:

Bonding Mode: load balancing (round-robin) MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 200 Down Delay (ms): 200 Slave Interface: eth0 MII Status: up Link Failure Count: 0 Permanent HW addr: 00:0c:29:c6:be:59 Slave Interface: eth1 MII Status: up Link Failure Count: 0 Permanent HW addr: 00:0c:29:c6:be:63

To kist all network interfaces, enter:
# ifconfig
Sample outputs:

bond0     Link encap:Ethernet  HWaddr 00:0C:29:C6:BE:59  inet addr:192.168.1.20  Bcast:192.168.1.255  Mask:255.255.255.0  inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link  UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1  RX packets:2804 errors:0 dropped:0 overruns:0 frame:0  TX packets:1879 errors:0 dropped:0 overruns:0 carrier:0  collisions:0 txqueuelen:0  RX bytes:250825 (244.9 KiB)  TX bytes:244683 (238.9 KiB) eth0      Link encap:Ethernet  HWaddr 00:0C:29:C6:BE:59  inet addr:192.168.1.20  Bcast:192.168.1.255  Mask:255.255.255.0  inet6 addr: fe80::20c:29ff:fec6:be59/64 Scope:Link  UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1  RX packets:2809 errors:0 dropped:0 overruns:0 frame:0  TX packets:1390 errors:0 dropped:0 overruns:0 carrier:0  collisions:0 txqueuelen:1000  RX bytes:251161 (245.2 KiB)  TX bytes:180289 (176.0 KiB)  Interrupt:11 Base address:0x1400 eth1      Link encap:Ethernet  HWaddr 00:0C:29:C6:BE:59  inet addr:192.168.1.20  Bcast:192.168.1.255  Mask:255.255.255.0  inet6 addr: fe80::20c:29ff:fec6:be59/64 Scope:Link  UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1  RX packets:4 errors:0 dropped:0 overruns:0 frame:0  TX packets:502 errors:0 dropped:0 overruns:0 carrier:0  collisions:0 txqueuelen:1000  RX bytes:258 (258.0 b)  TX bytes:66516 (64.9 KiB)  Interrupt:10 Base address:0x1480