Thursday, January 26, 2012

How to add a swap file in Fedora 16


Adding extra swap is sometimes required to meet and fulfill the hunger of resource hungry applications. Below are a few easy simple steps to do it.

As you can see we have total 1503mb of swap.



Type following command to create 512MB swap file.
$ sudo dd if=/dev/zero of=/swapfile1 bs=1024 count=524288

Set up a Linux swap area:
$ sudo mkswap /swapfile

Activate /swapfile1 swap space immediately:
$ sudo swapon /swapfile

To make the changes permanent and active even after reboot we have to add an entry to the /etc/fstab file. Open this file using text editor such as vi or gedit.
$ sudo vi /etc/fstab

Append following line:
/swapfile1 swap swap defaults 0 0

Below shown is my /etc/fstab file.


Verify swap space using free command
$ free -m

As you can see below that the total swap space has increased by 512mb i.e. 2015mb.


Try rebooting to verify.



Wednesday, January 25, 2012

Web Access via Terminal in Ubuntu 11.10


Most people using Linux just wonder about the ease of use in terminal with the help of commands. Sometimes we wish if we could use Internet too using terminal with such ease. Well, yes it is possible to browse internet using terminal. The terminal can display everything HTML. And heres how we can do it.

Open your terminal and type the below command.

$ sudo apt-get install elinks

After the installation is complete type elinks in terminal to access Internet through terminal.
Below are some screen-shot of Google web-page in terminal.




Gmail webpage


This works faster than the any browser. Go on try out other sites with whole lot of configurations in the terminal that you can use to make it look pretty neat.

Root login from GUI in Fedora16


Fedora16 by default does not allow root login from GUI login screen. The user can use su to switch to root. It is highly not recommended to login directly as root as it is too dangerous to do so. But still some root lovers prefer direct root login. Heres how we can accomplish the task.
First we have to put the normal user in sudoers file so that we can use sudo commands with ease.
Since sudo does not work as of now, so we switch to root using su command.

$ su – root

Give the password for root and we see a hash prompt. Then we go for editing /etc/sudoers file.

# gedit /etc/sudoers

Search for the below mentioned line and copy it to the next line replacing root with your username.
root     ALL=(ALL)              ALL
username        ALL=(ALL)              ALL

Save and quit. Logout root and try doing sudo. It should work.

Next thing we have to do is to edit /etc/pam.d/gdm and /etc/pam.d/gdm-password. Comment the line in both the files that contains
auth                required                     pam_succeed_if.so user != root quiet

Below are the screenshots of my /etc/pam.d/gdm and /etc/pam.d/gdm-password files.






Now go ahead logout your normal user and login again as root from GUI login screen.

Creating RAID1 Using the FCODE Facility (from OBP) in Oracle SPARC T3-2 Server


1. List the device paths on the server
ok show-devs
Look for lines ending with scsi@0. We had only one controller.
/pci@400/pci@2/pci@0/pci@e/scsi@0

2. Select the controller:
ok select /pci@400/pci@2/pci@0/pci@e/scsi@0

ok show-volumes
No volumes to show

If volumes are present then can be removed by selecting the appropriate controller and using delete-volume. In case there are two controllers you need to delete volumes on both.

3. To create a RAID1 volume to mirror the boot disks, show-children command was used to list the physical drives on the selected controller:
ok show-children
FCode Version 1.00.54, MPT Version 2.00, Firmware Version 5.00.17.00

Target 9
  Unit 0   Disk   HITACHI  H106030SDSUN300G A2B0    585937500 Blocks, 300 GB
  SASDeviceName 5000cca012c84f98  SASAddress 5000cca012c84f99  PhyNum 0
Target a
  Unit 0   Removable Read Only device   ###TEAC    DV-W28SS-R      1.0C                    ########################################
  SATA device  PhyNum 7
Target b
  Unit 0   Disk   HITACHI  H106030SDSUN300G A2B0    585937500 Blocks, 300 GB
  SASDeviceName 5000cca01298f514  SASAddress 5000cca01298f515  PhyNum 1

4. Create a RAID 1 volume with (in our case) targets 9 & b:
ok 9 b create-raid1-volume
Target 9 size is 583983104 Blocks, 298 GB
Target b size is 583983104 Blocks, 298 GB
The volume can be any size from 1 MB to 285148 MB
What size do you want?  [285148 #]
Volume size will be 583983104 Blocks, 298 GB
Enter a volume name:  [0 to 15 characters] RAID1
Volume has been created

5. Verify creation of the volume:
ok show volumes
Volume 0 Target 389  Type RAID1 (Mirroring)
  Name RAID1  WWID 0d794abefd76899a
  Optimal  Enabled  Background Init In Progress
  2 Members                                         583983104 Blocks, 298 GB
  Disk 0
    Primary  Optimal
    Target 9      HITACHI  H106030SDSUN300G A2B0
  Disk 1
    Secondary  Optimal
    Target b      HITACHI  H106030SDSUN300G A2B0

ok show-children

FCode Version 1.00.54, MPT Version 2.00, Firmware Version 5.00.17.00

Target a
  Unit 0   Removable Read Only device   TEAC    DV-W28SS-R      1.0C
  SATA device  PhyNum 7
Target 389 Volume 0
  Unit 0   Disk   LSI      Logical Volume   3000    583983104 Blocks, 298 GB
  VolumeDeviceName 3efd2bb69ef55490  VolumeWWID 0efd2bb69ef55490
{0} ok

The hardware RAID1 volume was successfully created. Notice that show-volumes still displays (Mirroring) with both disks as 'Optimal'. Now we can go ahead with the OS installation on the created RAID1 volume.

Monday, January 02, 2012

Open a File Browser from the Present Working Directory in Terminal


There has been a lot many times when I just felt the need to check things simultaneously in GUI while I was working in a terminal.

Well, it's just a simple command that you need to type wherever you are in your terminal to get a file browser for the current location.
$ nautilus .

Yes, this simple command works.

Empty Trash from Command Line in Ubuntu 11.10


Though we are so fond of GUI but still there are a few who just love being in the terminal forever and perform all our common tasks from the terminal itself that most of GUI lovers love to do graphically.

To empty our trash from terminal through command line, first of all we need to know the path to our trash and after that everything is just easy.
The 'Trash' to our 'Home Folder' normally resides in /<Home Directory>/.local/share/Trash/
This 'Trash' folder contains three directories expunged, files and info. They are not much of our concern.

So to empty the trash you can fire the below command
rm -rf ~/.local/share/Trash/

This will immediately delete your 'Trash' from terminal. That's really quick.

Note: You should be very careful while using 'rm -rf' as it deletes the files and directories permanently like a Shift+Del in Windows.