Wednesday, 25 March 2009

How to Repair a corrupted filesystem in Ubuntu

You can repair a corrupted filesystem with the program "fsck".The system utility fsck (for "file system check" or "file system consistency check") is a tool for checking the consistency of a file system in Unix and Unix-like operating systems such as Linux.


Note:-File systems must be unmounted, you cannot repair them while they are running.So fsck must ALWAYS be run on an UNmounted filesystem.Running fsck on a mounted filesystem can do SEVERE damage.

A quick fsck options overview:

Many options for fsck exist, but the most important are:
-f which performs a FAST check
-p which fixes minor problems without user interaction
-y which gives permission to correct every problem found
-n which indicates to only search (and not correct) problems

The most simple variant to run fsck is to force fsck on restart, and then restart your system:

sudo touch /forcefsck

The other option is to swich the system to runlevel 1 (logs-out any userRunning fsck on a mounted filesystem can do SEVERE damage), unmount all partitions. run fsck & repair, remount all drives, increase the runlevel to 3 and continue.

1) Take system down to runlevel one (make sure you run all command as root user):
# init 1

2)Unmount file system, for example if it is /home (/dev/sda3) file system then type command:

# umount /home

OR

# umount /dev/sda3

3) Now run fsck on the partition:

# fsck /dev/sda3

However be sure to specify the file system type using -t option. Recenly one of our sys admin run the command on ext3 file system w/o specifying file system. Result was more corruption as fsck by default assumes ext2 file system.

# fsck -t ext3 /dev/sda3

OR

# fsck.ext3 /dev/sda3

Tip if you don't know your file system type then typing mount command will display file system type.

fsck will check the file system and ask which problems should be fixed or corrected. If you don't wanna type y every time then you can use pass -y option to fsck.

# fsck -y /dev/sda3

Please not if any files are recovered then they are placed in /home/lost+found directory by fsck command.

4) Once fsck finished, remount the file system:

# mount /home

5) Go to multiuser mode

# init 3

Read man page of fsck for more information. Make sure you replace /dev/sda3 with your actual device name.
__________________

Read More......

Monday, 16 March 2009

Persistent monitor rotation Script

This is a fix that allows for persistent configuration of tho monitor's pivot rotation. You most create two scripts:


screen-rotate

sudo gedit screen-rotate

add following lines save and exit


#!/bin/bash
if [ "$1" = "right" ]
then
rotate="right"
else
rotate="left"
fi


if xrandr | grep "$rotate ("

then
rotate="normal"
fi
xrandr -o "$rotate"

echo $rotate > ~/.screen-orientation

screen-rotate-setup

sudo gedit screen-rotate-setup

add following lines save and exit
#!/bin/bash
rotate=`cat ~/.screen-orientation`
xrandr -o $rotate

save both scripts to /usr/bin and give them execution permissions to everyone (chmod +x)

Now go to System>Preferences>Sessions, click add and put screen-rotate-setup as the command. Name it as you see fit.

Now create a shortcut somewhere (the taskbar, perhaps?) put as a the command screen-rotate(in case your monitor rotates clockwise) or screen-rotate right(in case your monitor rotates counter-clockwise).

New click on the shortcut, log out and then login again.

Read More......

Monday, 9 March 2009

Howto Make an MPEG Picture Slideshow with digiKam in Ubuntu

If you only install digiKam, you will not be able to encode and render the mpeg slideshow.


Install the required packages

sudo apt-get install imagemagick mjpegtools music123 ffmpeg digikam

2. Open digiKam, select Tools -> Create MPEG Slideshow

3. From here on out, just select the file you want to save as (output file), add the pictures you want in the slideshow using the giant 'Add' button, and include an audio track if you're so inclined.

Note: If you just install digikam, it will not install mjpegtools or music123 which it needs to do the encoding. Also, this installs the full imagenagick, as opposed to the compact libraries.

Read More......

How to Speedup Firefox using SQLite VACUUM command

Firefox can run faster if it's database is purged of empty entries. Firefox database is using SQLite to manage its database.


Requirements

SQLite >=3.0

You can install using the following command

sudo apt-get install sqlite3

Now you need to open file ffast(you can give any name) using the following command

gedit ffast

copy and paste the following script

#!/bin/bash

username=$(whoami)
proc="$(ps aux | grep $username | grep -v $0 | grep firefox | grep -v grep)"
if [ "$proc" != "" ]
then
echo "shutdown firefox first!"
exit 1
fi

curdir=$(pwd)

for dir in $(cat ~/.mozilla/firefox/profiles.ini | grep Path= | sed -e 's/Path=//')
do
cd ~/.mozilla/firefox/$dir 2>/dev/null
if [ $? == 0 ]
then
echo "i'm in $(pwd)"
echo -e " running...\n"

for F in $(find . -type f -name '*.sqlite' -print)
do
sqlite3 $F "VACUUM;"
done

echo -e "done in $(pwd) ...\n"
else
echo -e "\n !!!! Error while entering directory $dir !!!!\n"
fi
done
echo "Job finished";

cd $curdir

Save and exit the file

Now you need to open your home folder select your file in this case ffast right-click on it, select properties. Then select Permissions tab and check the "Allow executing file as program" click Close.

Then close Firefox and run your script from terminal using

./ffast

when script done it's work start Firefox and you should see how fast your firefox will run.

Read More......

Wednesday, 4 March 2009

Howto setup Pulseadio and VMWare with 2 soundcards

You need a free PCI (or PCIe 1x) slot, so this is not for laptops.
This will cost you between 20 and 0 bucks depending on how much extra hardware you have lying around and how cheap you can get stuff.

You are going to need one extra soundcard and a cable to loop the audio-out (green) of one of the cards to the line-in (blue) of the other. This cable has 2 identical audio jacks at both ends.

1. Install the extra soundcard.

2. Boot back into your system and check what you have when you type 'ls /dev/dsp*' into the console. You should have a dsp and a dsp1 or some such.
If you don't see 2 audio devises, your other card is not recognized yet and you'll have to figure out why.

3. Go to your package manager and install the 'pavucontrol' and 'padevchooser' packages if they aren't there already.
Close the package manager window.

4. Start padevchooser. You will have a little audio jack icon in your systray now. Click on it and go to the 'Configure Local Sound Server' option. You will have a window with 3 tabs. Uncheck all boxes in all tabs.
Close the window.
Close padevchooser.

5. Start pavucontrol and go to the 'Output Devises' tab. Set your primary audio card as default with the little down arrow icon.
Close pavucontrol.

6. Close all apps that make sound and kill Pulseaudio with with the 'killall pulseaudio' command.

7. Start VMWare. Now you can figure out witch of your cards is dsp or dsp1 with directing the virtual sound to either dsp or dsp1 and checking it with your speakers when you play a sound inside your virtual machine.
Leave the settings directing the sound to your secondary soundcard.

8. Now use the audio loop cable to loop from the audio-out of your secondary card to the line-in of your primary one.
Leave the mic-in and audio-out cables of your primary card just the way they were when you started this guide.

9. Start 'pulseadio' while your VM is still playing music. Pulseadio will fail to hook on your secondary soundcard and just uses the primary one.
(Don't close the console window you started Pulseadio in until you reboot)

10. It should all work now. Pulse only hooks on your primary card and the sound feed from the VM goes to your secondary (and is looped to your primary one though the line-in).Even after reboot, Pulseadio should leave your secondary card alone now.

11. If your virtual OS is Windows, go to Control Panel>Sound and Audio> Audio>Sound Playback>Advanced>Performance
Set the hardware acceleration to None and the Sample rate conversion quality to Low. This should remove/reduce the sound stutter.

Read More......

How to fix your Audio EQ in Audacious

For all Users who is having trouble with audacious in Ubunutu, this seemed to work to fix the EQ

1. Download the Winamp preset EQ's
2. Open up terminal
3. wget http://www.xmms.org/misc/winamp_presets.gz
4. To install the presets for the Audacious media player type:
gunzip -c winamp_presets.gz > ~/.config/audacious/eq.preset

Restart Audacious. Now heres the sticker. What I think happens is Audaciou's Pre-Amp (to the left on EQ), is pushing too much Hz through the audio channel. Now, I do use the ALSA mixer, as nvidia's fails to work by default on my 8.04 machine.

Select a Winamp preamp, and turn on the EQ to ON. I am quite certain the preamp messes with the EQ in terms of the Base dB's (decibel) frequency. Think of if you've ever used Adobe Premiere, raising the dB too high and what, tiny crackly , or fuzzy audio! The same goes for a guitar amp, turn up the pre-amp (your amp) too high, then plug in a external effect pedal and turn up the sound and voila, crackly shitty audio.

Note!!!: If you use Ubuntu / Debian, I specially added the "Gnome-Alsamixer" to my arsenal as well. This allows you to change Master, and sub level audio tracks without the terminal. This will let you bump up you base master volume without destroying anything. The default audio applet on the top gnome panel bar only raises it so much. Find this program in Add/Remove Programs, or do "sudo apt-get install gnome-alsamixer "

Read More......