Tuesday, May 15, 2007

Difference between df and du

Under Linux / UNIX we have the du and the df command. The du command display disk usage statistics and the df command is to display free disk space.

In some cases it is possible that there is a difference between the outcome of df and du. In 99.9% of the cases this is caused by a lock on the file system. Meaning, if an application opens a file or files and an other application deletes these files while they are opened they will still be calculated by df.

The df command calculates this by looking at the inode table and the inode table has not yet released those files, meaning that, according to the inode table, the files are still using space on the disk.

Generally the solution is to stop/start the process that has a lock on those non existing files and the results returned by df and du will be the same again.

Friday, May 11, 2007

Nasa unveils Hubble's successor

he US space agency Nasa has unveiled a model of a space telescope that scientists say will be able to see to the farthest reaches of the universe.

The James Webb Space Telescope (JWST) is intended to replace the ageing Hubble telescope.

It will be larger than its predecessor, sit farther from Earth and have a giant mirror to enable it to see more.

Officials said the JWST - named after a former Nasa administrator - was on course for launch in June 2013.

The full-scale model is being displayed outside the Smithsonian National Air and Space Museum in the US capital, Washington DC.

The $4.5bn (£2.27bn) telescope will take up a position some 1.5 million km (930,000 miles) from Earth.

It will measure 24m (80ft) long by 12m (40ft) high and incorporate a hexagonal mirror 6.5m (21.3ft) in diameter, almost three times the size of Hubble's.

Hubble, launched in 1990, has sent back pictures of our solar system, distant stars and planets, and remote fledgling galaxies formed not long after the Big Bang.

But scientists say the JWST will enable them to look deeper into space and even further back at the origins of the universe. "Clearly we need a much bigger telescope to go back much further in time to see the very birth of the universe," said Edward Weiler, director of Nasa's Goddard Space Flight Centre.

Martin Mohan of Northrop Grumman, the contractor building the telescope, said that the team was making excellent progress. "There's engineering to do, but invention is done, more than six years ahead of launch," he said.

When ready, the JWST will be launched by a European Ariane V rocket. It is expected to have a 10-year lifespan.Until then, the 17-year-old Hubble telescope will continue to do its work. Nasa plans to send astronauts on the space shuttle to service it in 2008.

JWST is named after James E Webb, Nasa Administrator during the Apollo lunar exploration era; he served from 1961 to 1968 It will be placed 1.5m km from Earth, at Lagrange Point 2, an area of gravitational balance that keeps it in a Sun-Earth line The telescope will be shaded from sunlight by a shield, enabling it to stay cold, increasing its sensitivity to infrared radiation Three principal instruments will gather images of the Universe in the infrared region of the spectrum
These will yield new information about how stars and galaxies first formed a few hundred million years after the Big Bang

Thursday, May 10, 2007

Restore using mtx tar cat and grep

Quick and dirty,.... you have a taperobot and you would like to restore some things from the tar backup to you local file system.

The first step is to load the tape where the backup is located. To do so we have to give the tape robot the order to get the tape out of the slot and put it into the correct tapedrive. To do so we make use of mtx which can be used to control SCSI media changer devices.

pmeflr01 tape0 # mtx -f /dev/changer load 10 0

Where /dev/changer is the scsi location of the media changer, 10 is number of the disc and 0 is the number of the target tapedrive.

Now we have the correct tape in the tapedrive and we go to the location of the tapedrive in /dev/tapes/tape0 where we find “mt”.

pmeflr01 tape0 # ls -rtl
total 0
crw-rw-rw- 1 root root 9, 128 Jan 1 1970 mtn
crw-rw-rw- 1 root root 9, 192 Jan 1 1970 mtmn
crw-rw-rw- 1 root root 9, 64 Jan 1 1970 mtm
crw-rw-rw- 1 root root 9, 160 Jan 1 1970 mtln
crw-rw-rw- 1 root root 9, 32 Jan 1 1970 mtl
crw-rw-rw- 1 root root 9, 224 Jan 1 1970 mtan
crw-rw-rw- 1 root root 9, 96 Jan 1 1970 mta
cr-xr-xr-x 1 root root 9, 0 Jan 1 1970 mt
crw-r----- 1 root root 21, 7 Jan 1 1970 generic
pmeflr01 tape0 #

because we like to know what is on the tape and we like to have a list so we can later find all the files we like to restore we generate a list of all the items in the tar.

pmeflr01 tape0 # tar -tzf mt > /tmp/johan_restore

This will generate a file named johan_restore in /tmp which contains the complete index of all the files in the tar on the tape. We can now use cat and grep to pipe only the files we like to restore to a new file. For example if we only would like to have the files in /shares0/project-01 we execute the following command to generate a new file named johan_restore_grep in /tmp

pmeflr01 tape0 # cat /tmp/johan_restore | grep /shares0/project-01 > /tmp/johan_restore_grep

having this file we can now use this as a “restore index” in tar. The –T option with the tar command gives you the option to specify a file containing all the files that should be extracted. We issue the following command to restore all the data to /shares0/temprestore so we can review the restored data before we place it back to the original location on the file system and inform the users that the data is restored.

pmeflr01 tape0 # tar -xzf mt -v -T /tmp/johan_restore_grep -C /shares0/temprestore/

After this we will have a complete restore of the data in /shares0/temprestore, first check if everything is there and if that is the case move it to the original location and inform the users.