Monday, December 27, 2010

To Create a New logical volume in Linux

Execute the below command to create the new logical volume “netcoolvol01” from “systemvg” Volume group. Please use “vgs” & “lvs” command to know the free space in a volume group


===========================================

lvcreate -L10000 -n netcoolvol01 systemvg


Execute the below command to format the new file system

===========================================

mkfs -t ext3 /dev/mapper/systemvg-netcoolvol01

Mount the new file system
============================================

mount /dev/mapper/systemvg-netcoolvol01 /mnt

[root@dbserver /]# df –h /mnt

/dev/mapper/systemvg-netcoolvol01 9.7G 55M 9.1G 1% /mnt

[root@dbserver /]#

How to extend a Logical volume in Linux (LVM)

Execute the lvextend and resize2fs commands to increase the size of a logical volume. Some Linux version we need to use ext2online command instead of resize2fs



lvextend -L + G

resize2fs

ext2online

Eg:

dbserver:/etc # lvextend -L +2G /dev/mapper/sysvg-var

Extending logical volume var to 5.00 GB

Logical volume var successfully resized


dbserver:/etc # resize2fs /dev/mapper/sysvg-var

resize2fs 1.41.1 (01-Sep-2008)

Filesystem at /dev/mapper/sysvg-var is mounted on /var; on-line resizing required

old desc_blocks = 1, new_desc_blocks = 1

Performing an on-line resize of /dev/mapper/sysvg-var to 1310720 (4k) blocks.

The filesystem on /dev/mapper/sysvg-var is now 1310720 blocks long.



dbserver 1:/etc # df -h /var

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/sysvg-var

5.0G 1.2G 3.6G 24% /var

dbserver:/etc #

Change Time Zone in Linux

Check the /usr/share/zoneinfo directory. Hopefully, it will contain a UTC or


GMT file timezone file. You can then simply link that file to /etc/localtime:



# cp /etc/localtime /etc/localtime.backup ;ln -s /etc/localtime /usr/share/zoneinfo/UTC /etc/localtime



Are you sure you don't have a TZ variable set in your user ENV? Regardless of

system time zone, the TZ variable will over-ride that on a per user basis.



# date

Mon Apr 19 19:39:04 CEST 2004

# mv /etc/localtime /etc/localtime.save

# date

Mon Apr 19 17:39:11 UTC 2004

Change Date and Time in Linux

Please execute the “date” command in order to see the current time and date settings

[root@racnode-2 ~]# date

Thu Aug 14 17:49:04 BDT 2008

So current time is month 8 day 17, year 2008, time 17:49:04.



Now to change only time to 11:51.30 execute



[root@racnode-2 ~]# date 08141151.30

Thu Aug 14 11:51:30 BDT 2008



[root@racnode-2 ~]# date

Thu Aug 14 11:51:32 BDT 2008



Note that setting date in this way will not cause the date to remain after a reboot. The date command sets the Linux system clock which is separate from the hardware clock.

We can check linux hardware clock by,



[root@racnode-2 ~]# hwclock

Thu 14 Aug 2008 05:57:01 PM BDT -0.788181 seconds



To make date setting persistent update the hardware clock with the date from the Linux system clock.



[root@racnode-2 ~]# /sbin/hwclock --systohc

If you are using universal time then use,

hwclock --utc --systohc



An alternative way is if you want to set the hardware(BIOS) clock so the system will keep the time when it reboots using,



clock -w

or

setclock

after changing date and time by date command.



To set date and time we can also use,



# date -s "2 OCT 2008 8:00:00"



If you wanted to change the year as well, for example to change year to 2007 of 30th April time 11:16pm you could type



#date 043023162007



To change only the time to 10:10 am you also can use,



#date -s 10:10



Using NTP (Network Time Protocol)



This is simple process. Just adding the time server to /etc/ntp.conf and to /etc/ntp/step-tickers Here I use time server as 192.168.1.91.



#vi /etc/ntp.conf

server 192.168.1.91

#vi /etc/ntp/step-tickers

192.168.1.91

Then of course make sure that ntp will start at boot time by,

chkconfig --level 2345 ntpd on

chkconfig --list ntpd



And let's start the service now by,

service ntpd start



It will display output as

ntpd: Synchronizing with time server: [ OK ]

Starting ntpd: [ OK ]

Posted by Arju at 10:53 PM

Labels: How to change date and time on Linux using hand and NTP

0 comments:

Friday, March 26, 2010

How to Find out HAB Firmware and Driver version in Linux server

We can use scli command to find out the HBA Information if the SANsurferCLI? is installed on the system. =======================================================================================================



suselinux10:~ #/opt/QLogic Corporation/SANsurferCLI/scli

Searching for QLogic FC HBA(s) and attached device(s) ...


SANsurfer FC HBA CLI

v1.7.0 Build 12


Main Menu


1: Display System Information

2: Display HBA Settings

3: Display HBA Information

4: Display Device List

5: Display LUN List

6: Configure HBA Settings

7: Boot Device Settings

8: HBA Utilities

9: Flash Beacon

10: Diagnostics

11: Help

12: Quit


Enter Selection: 3

SANsurfer FC HBA CLI

v1.7.0 Build 12

HBA Information Menu

1: Information

2: VPD


Note: 0 to return to Main Menu

Enter Selection: 1

SANsurfer FC HBA CLI

v1.7.0 Build 12

Information Menu

HBA Model QMH2562:

1: Port 1: WWPN: 50-01-43-80-06-2F-A2-28 Online

HBA Model QMH2562:

2: Port 2: WWPN: 50-01-43-80-06-2F-A2-2A Online

3: All HBAs

4: Return to Previous Menu

Note: 0 to return to Main Menu

Enter Selection: 3


Host Name : suselinux10

HBA Model : QMH2562

HBA Alias :

Port : 1

Port Alias :

Node Name : 50-01-43-80-06-2F-A2-29

Port Name : 50-01-43-80-06-2F-A2-28

Port ID : 07-CE-80

Serial Number :

Driver Version : 8.02.00-k6-SLES10-05

BIOS Version : N/A

Firmware Version : 4.03.02 [Multi-ID]

HBA Instance : 0

HBA ID : 0-QMH2562

Actual Connection Mode : Point to Point

Actual Data Rate : 4 Gbps

PortType? (Topology) : NPort

Total Number of Devices : 1

PCI Bus Number : 6

PCI Device Number : 0

HBA Status : Online



Hit to continue:


Host Name : suselinux10

HBA Model : QMH2562

HBA Alias :

Port : 2

Port Alias :

Node Name : 50-01-43-80-06-2F-A2-2B

Port Name : 50-01-43-80-06-2F-A2-2A

Port ID : 08-CE-80

Serial Number :

Driver Version : 8.02.00-k6-SLES10-05

BIOS Version : N/A

Firmware Version : 4.03.02 [Multi-ID]

HBA Instance : 1

HBA ID : 1-QMH2562

Actual Connection Mode : Point to Point

Actual Data Rate : 4 Gbps

PortType? (Topology) : NPort

Total Number of Devices : 1

PCI Bus Number : 6

PCI Device Number : 0

HBA Status : Online



Hit to continue:

============================================================================================================

We can collect the HBA information directly from OS in case scli (qlogic) & linlpcfg (Emulex) not installed

================================================================================================================



suselinux10:~ # cat /sys/class/scsi_host/host2/fw_version



4.03.02 [Multi-ID]



suselinux10:~ # cat /sys/class/scsi_host/host2/driver_version



8.02.00-k6-SLES10-05



suselinux10:~ # cat /sys/class/scsi_host/host2/model_name



HPAJ764A



suselinux10:~ # cat /sys/class/fc_host/host2/node_name



0x50014380062c94b1



suselinux10:~ #



suselinux10:~ # cat /sys/class/fc_host/host2/port_name



0x50014380062c94b0



suselinux10:~ #



suselinux10:~ # cat /sys/class/fc_host/host2/port_type



NPort (fabric via point-to-point)



suselinux10:~ #



suselinux10:~ # cat /sys/class/fc_host/host2/speed



4 Gbit



suselinux10:~ #