Determining if your kernel and hardware is 32bit or 64bit

I’m often asked by end-users, developers, and fellow system administrators, how to determine if the installed OS is 32bit or 64bit.   I’m also asked if the hardware is capable of 64 bit, 32 bit, or both.   Here is how to tel by OS:

HPUX

# getconf KERNEL_BITS
64

This will tell you if your currently running kernel is 64 bits or 32 bits.  It returns the number of bits used by the kernel for pointer and long data types.  Current values include 32 and 64.

# getconf HW_32_64_CAPABLE
1

Returns which kernel is supported on the hardware.

You can also test this with a short C program:

# cat check3264.c
#include <stdio.h>
#include <unistd.h>

main()
{
long ret = sysconf(_SC_HW_32_64_CAPABLE);

if (_SYSTEM_SUPPORTS_ILP32OS(ret) != 0) {
printf(”system supports 32-bit OS\n”);
}

if (_SYSTEM_SUPPORTS_LP64OS(ret) != 0) {
printf(”system supports 64-bit OS\n”);
}
}
# cc check3264.c
# ./a.out
system supports 64-bit OS
#

In this example, we see the test system, an HP L2000-36 running HPUX 11.11, only supports a 64 bit HPUX Kernel.

# getconf HW_CPU_SUPP_BITS
64

This will show you if the CPU’s are capable of running 32, 64, or 32/64 bit kernels.

Solaris

For solaris, the isainfo -v should, at least for versions past 2.6,  show you want you need:

# isainfo -v
32-bit i386 applications

This may also say “sparc” if you are running on the sparc architecture. If you were on a 64 bit system, you would see something like this:

64-bit sparcv9 applications
32-bit sparc applications

This would be telling you that you are running a 64 bit kernel and can run either 64-bit sparcv9 applications, or 32-bit sparc applications.

To determine the cpu’s bit size capabilities, isainfo -b does the trick here too:

# isainfo -b
64

AIX

For AIX, we will use the bootinfo command.

bootinfo -y
32

This show is the hardware is 32 bit or 64 capable.

bootinfo -K
32

Shows the running kernel’s bit size.

Linux

For linux, we will look at the cpuinfo from /proc. Here, we are mainly interested in the “flags” for the CPU’s:

# cat /proc/cpuinfo | grep -i flags
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm sse4_1 lahf_lm

We are interested in three values in the output, as they indicate the bit size capabilities of the CPU:

16 Bit = rm (Real Mode)
32 Bit = tm (Transparent Mode)
64 Bit = lm (Long Mode)

This doesn’t necessarily mean the Motherboard is capable of 64 bit.

To determine the bit size of your running kernel, you can also use getconf, similar to HPUX, to find this info:

# getconf LONG_BIT
64

This shows that my kernel is running 64 bit.

Post a Comment

Your email is never shared. Required fields are marked *

*
*