Tuesday, January 22, 2013

Add 50 MB partition Linux

[root@rajcentos ~]# fdisk /dev/sde
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-51, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-51, default 51):
Using default value 51

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@rajcentos ~]# mkfs -t ext3 /dev/sde1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
13104 inodes, 52208 blocks
2610 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=53477376
7 block groups
8192 blocks per group, 8192 fragments per group
1872 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@rajcentos ~]# fdisk -l /dev/sde1

Disk /dev/sde1: 53 MB, 53460992 bytes
64 heads, 32 sectors/track, 50 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Add Virtual disk to VMware and create a partion with fdisk in Linux.

This is about How to add the new VM disk to the existing VMware player.
Make sure that the M is powed off else you will not be able to make changes.
Below are the screen shots and the CLI commands run:





Click Add.




Select Create a New Virtual Disk à Click Next


Accept Recommended à Click Next 



Allocate the size – I have selected Store virtual disk as a single file.

Click Next.




Click Finish.

Now go to the command line via putty.

And run the fdisk utility as follows.

[root@rajcentos dev]# fdisk -l
Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1044     8281507+  8e  Linux LVM
Disk /dev/sdb: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         512      524272   83  Linux
Disk /dev/sdc: 213 MB, 213909504 bytes
64 heads, 32 sectors/track, 204 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/sdd: 106 MB, 106954752 bytes
64 heads, 32 sectors/track, 102 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk /dev/sdd doesn't contain a valid partition table

[root@rajcentos dev]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-204, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-204, default 204):
Using default value 204
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@rajcentos dev]# fdisk -l /dev/sdc
Disk /dev/sdc: 213 MB, 213909504 bytes
64 heads, 32 sectors/track, 204 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         204      208880   83  Linux

[root@rajcentos dev]# mkdir /backupcenter
[root@rajcentos dev]# mount /dev/sdc1 /backupcenter/
[root@rajcentos dev]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      7.3G  1.2G  5.7G  18% /
/dev/sda1              99M   13M   81M  14% /boot
none                  125M     0  125M   0% /dev/shm
/dev/sdb1             496M   11M  460M   3% /remotebackup
/dev/sdc1             198M  5.8M  182M   4% /backupcenter
 

Thats it!

Friday, November 2, 2012

Assigning multiple IP's to RedHat Linux.

1. Create a file ifcfg-eth0-iprange.
2. Add the following content in the file depending on your requirement.
3. Change IPADDR_START & IPADDR_END as per the need.
4. save the file.
5. service network restart

ONBOOT=yes

IPADDR_START=192.168.217.129
IPADDR_END=192.168.217.132
CLONENUM_START=0
NETMASK=255.255.255.0
NO_ALIASROUTING=yes

[root@rajlinux network-scripts]# ifconfig

eth0 Link encap:Ethernet HWaddr 00:0C:29:B7:4F:7C

inet addr:192.168.217.128 Bcast:192.168.217.255 Mask:255.255.255.0

inet6 addr: fe80::20c:29ff:feb7:4f7c/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:44792 errors:0 dropped:0 overruns:0 frame:0

TX packets:32995 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:3933587 (3.7 MiB) TX bytes:5143510 (4.9 MiB)

Interrupt:5 Base address:0x2024


eth0:0 Link encap:Ethernet HWaddr 00:0C:29:B7:4F:7C

inet addr:192.168.217.129 Bcast:192.168.217.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

Interrupt:5 Base address:0x2024


eth0:1 Link encap:Ethernet HWaddr 00:0C:29:B7:4F:7C

inet addr:192.168.217.130 Bcast:192.168.217.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

Interrupt:5 Base address:0x2024


eth0:2 Link encap:Ethernet HWaddr 00:0C:29:B7:4F:7C

inet addr:192.168.217.131 Bcast:192.168.217.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

Interrupt:5 Base address:0x2024


eth0:3 Link encap:Ethernet HWaddr 00:0C:29:B7:4F:7C

inet addr:192.168.217.132 Bcast:192.168.217.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

Interrupt:5 Base address:0x2024


lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:13956 errors:0 dropped:0 overruns:0 frame:0

TX packets:13956 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:10042055 (9.5 MiB) TX bytes:10042055 (9.5 MiB)

Thanks.

Monday, July 9, 2012

Adding aliases, Allowing root login, changing PS1 value, Changing hostname on the fly - On X86

To add aliases in Solaris 10:

1. touch the .profile file in the home dir.

# touch .profile

-bash-3.2# more .profile

alias ll='ls -l'

---------------------------------

Enable ssh root login in Solaris 10

1. Change the file /etc/ssh/sshd_config with PermitRootLogin yes to replace PermitRootLogin no

2. restart the services

-bash-3.2# svcs -a | grep ssh

online 14:20:00 svc:/network/ssh:default

-bash-3.2# svcadm restart svc:/network/ssh:default

#svcadm restart svc:/network/ssh:default

----------------------------------

Changing the PS1 value in Solaris 10:

The PS1 value need to be added to the .bash_profile file.

PS1="\u@\h: \W $ "

to make the change to take immediate effect

# source .bash_profile

root@rajsolaris: / $

------------------------------------

Changing hostname on the fly:

1. /etc/hosts

2. cd /var/crash

# mv unknown

3. /etc/hostname.e1000g0 - Edit this file in the vi editor & add the desired hostname.

do ^ D

login again.

root@rajsolaris: / $

-------------------------------------

Wednesday, May 30, 2012

Finding WWN of HBA on Linux

/usr/sbin/hbanyware/hbacmd listhbas

[root@hqiqlrajdb01 ~]# /usr/sbin/hbanyware/hbacmd listhbas


Manageable HBA List

Port WWN : 10:20:00:00:c9:cc:52:08

Node WWN : 20:00:00:00:c9:cc:52:08

Fabric Name: 20:29:00:35:73:a1:15:01

Flags : 8010fe0d

Host Name : testdb01

Mfg : Emulex Corporation

Serial No. : 5CJKL11490ZD

Port Number: 0

Mode : Initiator


Port WWN : 10:00:99:00:c9:cc:52:09

Node WWN : 20:00:90:00:c9:cc:52:09

Fabric Name: 00:00:00:00:00:00:00:00

Flags : 8000fe0d

Host Name : testdb01

Mfg : Emulex Corporation

Serial No. : 5ZF11490ZD

Port Number: 1

Mode : Initiator




Thursday, May 3, 2012

TimeZone change (Permanent without reboot) on RedHat Linux 5.7.

Today I would like to share Time Zone chane on RHEL 5.7 - Simple
But need to have the info on time & quick. Four commnds! :-)

cd /etc
rm localtime
ln -s /usr/share/zoneinfo/America/New_York localtime
date

Thats it!

Thanks.