Tuesday, February 19, 2013
upgrade Ubuntu OS
sudo apt-get install update-manager-core
sudo vi /etc/update-manager/release-upgrades
change the line below from prompt=lts to prompt=normal.
sudo apt-get update && sudo apt-get upgrade
sudo do-release-upgrade
Thursday, December 13, 2012
Multiple interface on same network are using same NIC for communication
Multiple interfaces on the same subnet
In the Linux implementation of the IP stack a IP address belongs to the host event though the administrator configures it on a devices. This can cause somewhat unexpected behaviour when multiple interfaces are configured to use the same network.
The network
{network A}
\ +--------------+
-(eth0)| Linux server |
+--------------+
(eth2) (eth3)
| |
{Network B}
When multiple interfaces are configured for the same network you must use policy routing to make the internal IP stack route the packages out on the designated interface. This is done by using the "ip route" command.
Prerequisites
The following options must be enabled in the kernel.
CONFIG_IP_ADVANCED_ROUTER=y CONFIG_IP_MULTIPLE_TABLES=y CONFIG_IP_ROUTE_FWMARK=y CONFIG_IP_ROUTE_MULTIPATH=y CONFIG_IP_ROUTE_VERBOSE=y CONFIG_NETLINK_DEV=y
You also need the iproute suite, also known as iproute2. In Debian (and Debian derivatives) this is the iproute package.
Example configuration for two interfaces on the same IP subnet
In Debian (and Debian derivatives) the easiest way to add the additional routes on start-up is to use the up option in /etc/network/interfaces.
auto eth2 iface eth2 inet static address 192.168.1.20 network 1192.168.1.0 netmask 255.255.255.0 broadcast 192.168.1.255 up ip route add 192.168.1.0/24 dev eth2 proto kernel scope link src 192.168.61.20 table 20 up ip route add default via 192.168.1.1 dev eth2 table 20 up ip rule add from 192.168.1.20 lookup 20 auto eth3 iface eth3 inet static address 192.168.1.21 network 192.168.1.0 netmask 255.255.255.0 broadcast 192.168.1.255 up ip route add 192.168.1.0/24 dev eth3 proto kernel scope link src 192.168.61.21 table 30 up ip route add default via 192.168.1.1 dev eth3 table 30 up ip rule add from 192.168.1.21 lookup 30
Note:The table id is just a positive integer in the range 0-255 that identifies a unique table. When setting up multiple interfaces on the same subnet this id needs to be unique for each interface. In the example the interface number times 10 is used. Table id 0 and 253-255 are reserved for internal use and may not be used for this configuration.
For more information about advanced Linux routing please see read the Linux Advanced Routing & Traffic Control HOWTO.
Book tip: "Linux Network Internals"
another example:
Multiple interface on same subnet same machine can work fine.
we need to use advance routing concepts with arp_filter option, make table for each interface and configure default routes and lookups. following three magic lines solved my problem.
Code:
ip route add 10.209.192.0/22 dev eth1 proto kernel scope link src 10.209.193.131 table tlb_1 ip route add default via 10.209.192.1 dev eth1 table tlb_1 ip rule add from 10.209.193.131 lookup tlb_1 ip route flush cache
Thursday, November 29, 2012
install torque client
cd /software/
934 ls
935 cd torque/
936 ls
937 cd 4.1.2/
938 ls
939 ./torque-package-mom-linux-x86_64.sh --help
940 ./torque-package-mom-linux-x86_64.sh --listfiles
941 ls
942 ./torque-package-clients-linux-x86_64.sh --listfiles
943 ./torque-package-clients-linux-x86_64.sh --install
944 clear
945 qsub
946 exit
947 df -h
948 cd /software/
949 ls
950 cd torque/
951 la
952 ls
953 cd 4.1.2/
954 ls
955 ls -ltr
956 pwd
957 cd /software/toolss
958 cd /software/tools
959 ls
960 cd ..
961 ls
962 cd torque/
963 ls
964 cd 4.1.2/
965 ls
966 ls -ltr
967 sh ./torque-package-clients-linux-x86_64.sh
968 sh ./torque-package-clients-linux-x86_64.sh --install --verbose
969 ls
970 cd ..
971 ls
972 cd ..
973 ls
974 pwd
975 cd src/
976 ls
977 cd torque-4.1.2
978 ls
979 cd con
980 ls
981 cd contrib/
982 ls
983 cd init.d
984 ls
985 ls -l /etc/init.d|grep trq
986 cp -a trqauthd /etc/init.d/
987 cd /etc/init.d
988 ls -ltr
989 getent passwd
990 ls
991 service trqauthd start
992 qstat
993 pbsnodes -l
994 chkconfig --add trqauthd
995 chkconfig trqauthd
996 chkconfig --list|grep trqauthd
999 vim /etc/hosts
//modify the torquemaster, and add new host to the manager by "qmgr -c"
934 ls
935 cd torque/
936 ls
937 cd 4.1.2/
938 ls
939 ./torque-package-mom-linux-x86_64.sh --help
940 ./torque-package-mom-linux-x86_64.sh --listfiles
941 ls
942 ./torque-package-clients-linux-x86_64.sh --listfiles
943 ./torque-package-clients-linux-x86_64.sh --install
944 clear
945 qsub
946 exit
947 df -h
948 cd /software/
949 ls
950 cd torque/
951 la
952 ls
953 cd 4.1.2/
954 ls
955 ls -ltr
956 pwd
957 cd /software/toolss
958 cd /software/tools
959 ls
960 cd ..
961 ls
962 cd torque/
963 ls
964 cd 4.1.2/
965 ls
966 ls -ltr
967 sh ./torque-package-clients-linux-x86_64.sh
968 sh ./torque-package-clients-linux-x86_64.sh --install --verbose
969 ls
970 cd ..
971 ls
972 cd ..
973 ls
974 pwd
975 cd src/
976 ls
977 cd torque-4.1.2
978 ls
979 cd con
980 ls
981 cd contrib/
982 ls
983 cd init.d
984 ls
985 ls -l /etc/init.d|grep trq
986 cp -a trqauthd /etc/init.d/
987 cd /etc/init.d
988 ls -ltr
989 getent passwd
990 ls
991 service trqauthd start
992 qstat
993 pbsnodes -l
994 chkconfig --add trqauthd
995 chkconfig trqauthd
996 chkconfig --list|grep trqauthd
999 vim /etc/hosts
//modify the torquemaster, and add new host to the manager by "qmgr -c"
Tuesday, November 20, 2012
specified unpartitioned disk sda in partition command
When getting this error message in a kickstart;
The inforamation can be stored in different locations on the harddrive, to my knowledge its commonly in the end though. If you dont want to consider this further, you can delete the entire disk by running;
specified unpartitioned disk sda in partition commandIts possibly due to dmraid information still present on the disk from an earlier installation. Verify by running (press F2 after kickstart halts):
$ dmraid -r -D /dev/sdaYou should get information about the disk being member of a raidset.
The inforamation can be stored in different locations on the harddrive, to my knowledge its commonly in the end though. If you dont want to consider this further, you can delete the entire disk by running;
$ dd if=/dev/zero of=/dev/sdaIt will take some time as the entire disk is being written to. If you want to make a more surgical approach, just erase the last couple of sectors. First run fdisk;
$ fdisk -lThen run the following command. Adapt the values for ”bs” and ”seek” to suit your actual harddrive. You get the values from the fdisk output above. In the below example, i’m deleting the last 10 sectors of the disk (91201 – 10 = 91191):
Disk /dev/sda: 750.1 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 byte
dd if=/dev/zero of=/dev/sda bs=8225280 seek=91191 count=1Verify that the dmraid information is actually gone;
dmraid -r -D /dev/sdaThe output should now be different from before, saying the disk is not a member. If so, you should be able to use it to kickstart on.
specified unpartitioned disk sda in partition command
When getting this error message in a kickstart;
The inforamation can be stored in different locations on the harddrive, to my knowledge its commonly in the end though. If you dont want to consider this further, you can delete the entire disk by running;
specified unpartitioned disk sda in partition commandIts possibly due to dmraid information still present on the disk from an earlier installation. Verify by running (press F2 after kickstart halts):
$ dmraid -r -D /dev/sdaYou should get information about the disk being member of a raidset.
The inforamation can be stored in different locations on the harddrive, to my knowledge its commonly in the end though. If you dont want to consider this further, you can delete the entire disk by running;
$ dd if=/dev/zero of=/dev/sdaIt will take some time as the entire disk is being written to. If you want to make a more surgical approach, just erase the last couple of sectors. First run fdisk;
$ fdisk -lThen run the following command. Adapt the values for ”bs” and ”seek” to suit your actual harddrive. You get the values from the fdisk output above. In the below example, i’m deleting the last 10 sectors of the disk (91201 – 10 = 91191):
Disk /dev/sda: 750.1 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 byte
dd if=/dev/zero of=/dev/sda bs=8225280 seek=91191 count=1Verify that the dmraid information is actually gone;
dmraid -r -D /dev/sdaThe output should now be different from before, saying the disk is not a member. If so, you should be able to use it to kickstart on.
Tuesday, October 30, 2012
Predefined Macros
There are predefined macros that are used by most compilers, you can find the list [here]. GCC compiler predefined macros can be found [here].
http://sourceforge.net/p/predef/wiki/OperatingSystems/
http://gcc.gnu.org/onlinedocs/cpp/Predefined-Macros.html
http://sourceforge.net/p/predef/wiki/OperatingSystems/
http://gcc.gnu.org/onlinedocs/cpp/Predefined-Macros.html
#ifdef _WIN64
//define something for Windows (64-bit)
#elif _WIN32
//define something for Windows (32-bit)
#elif __APPLE__
#include "TargetConditionals.h"
#if TARGET_OS_IPHONE
// iOS device
#elif TARGET_IPHONE_SIMULATOR
// iOS Simulator
#elif TARGET_OS_MAC
// Other kinds of Mac OS
#else
// Unsupported platform
#endif
#elif __linux
// linux
#elif __unix // all unices not caught above
// Unix
#elif __posix
// POSIX
#endif
Thursday, October 11, 2012
centos 6.3 enter single user mode and fix lvm partiton
1) enter grub.
2) add "single" as kernel paramters
3) boot into single user mode.
4) if file system is read-only, do:
mount -o remount,rw /
5) recreate the volume group:
vgcreate new_vol_name /dev/sd*
6) create logical volume and use full volume groupt
lvcreate -l 100%FREE -n new_lv_name your_vg_name
7)format the logical volume
a, http://blog.tsunanet.net/2011/08/mkfsxfs-raid10-optimal-performance.html
b,http://wikihelp.autodesk.com/Creative_Finishing/enu/2012/Help/05_Installation_Guides/Installation_and_Configuration_Guide_for_Linux_Workstations/0118-Advanced118/0194-Manually194/0199-Creating199
//comment: use the second (autodesk one) method is fast and stable.
remeber, if your disk has BBU setup. you need to disable barrier.
just do it while mount the xfs partion with "-o nobarrier". please google centos documents.
reference:
1) http://www.centos.org/docs/5/html/Cluster_Logical_Volume_Manager/LV_create.html
2:
2) add "single" as kernel paramters
3) boot into single user mode.
4) if file system is read-only, do:
mount -o remount,rw /
5) recreate the volume group:
vgcreate new_vol_name /dev/sd*
6) create logical volume and use full volume groupt
lvcreate -l 100%FREE -n new_lv_name your_vg_name
7)format the logical volume
a, http://blog.tsunanet.net/2011/08/mkfsxfs-raid10-optimal-performance.html
b,http://wikihelp.autodesk.com/Creative_Finishing/enu/2012/Help/05_Installation_Guides/Installation_and_Configuration_Guide_for_Linux_Workstations/0118-Advanced118/0194-Manually194/0199-Creating199
//comment: use the second (autodesk one) method is fast and stable.
remeber, if your disk has BBU setup. you need to disable barrier.
just do it while mount the xfs partion with "-o nobarrier". please google centos documents.
reference:
1) http://www.centos.org/docs/5/html/Cluster_Logical_Volume_Manager/LV_create.html
2:
Root your box, and mount LVM partitions
I was teaching a friend how to root a box by adding:
Posted by
Shannon Eric Peevey
at
1:53 PM
init=/bin/bashto the kernel line in grub, and then wanted to show him how to install some apps from the command line. I had never done this with LVM partitions, and was surprised when I got the following error:
File based locking initialization failedDoh! I forgot to remount root read/write:
mount -o remount,rw /Finally, I was able to mount all my LVM partitions with:
lvm vgscanhaha! I'm getting rusty :P
lvm vgchange -ay
lvm lvs
mount -a
Subscribe to:
Posts (Atom)