Vacuuming makes the databases perform faster.
Run this command to vacuum:
vacuumdb --analyze --verbose -d [database_name]
Various nuggets of useful technical information.
Monday, July 14, 2008
Sunday, July 6, 2008
Disabling/Removing persistent Lexmark Print Spooler
Click on Start --> Right Click on My Computer and choose manage --> services and applications --> services.
Scroll down and make sure you disable the lexbce server and the print spooler.
Once your done, click OK through it all.
Click on the Start --> Run.
Copy and paste his string:
sc config spooler depend=RPCSS
Click run.
This will disable the lexbce problem and start your print spooler.
Scroll down and make sure you disable the lexbce server and the print spooler.
Once your done, click OK through it all.
Click on the Start --> Run.
Copy and paste his string:
sc config spooler depend=RPCSS
Click run.
This will disable the lexbce problem and start your print spooler.
Friday, June 27, 2008
Installing Openswan on Redhat 9.0
Openswan 2.x is not compatible with RedHat 9.0 for which OpenSwan 1.0.3 must be used.
INSTALL OPENSWAN FOR REDHAT 9.0:
Check if OpenSwan is installed:
ipsec --version
GBS uses the latest OpenSwan available for RedHat 9.0. At the time of writing that was OpenSwan 1.0.3. Openswan 1.0.3 installs on Redhat 9.0 and is compatible with any OpenSwan installation. However it needs a special kernel patch that must be installed separately. Either download the Openswan 1.0.3.rpm from www.openswan.org or use:
yum install openswan
If downloading manually, install as follows:
rpm -ivh openswan-1.0.3-3.i386.rpm
Either obtain the kernel patches locally or download them from www.openswan.org:
Install as follows:
Reboot the server:
reboot
Since a new kernel has been installed, you must change the boot kernel in /etc/grub.conf. Edit /etc/grub.conf so that the default= for new kernel. In the example below, the new openswan patched kernel is the first one, so default=0, if it was the second one, default=1 and so on.
default=0
timeout=10
splashimage=(hd0,1)/grub/splash.xpm.gz
title Red Hat Linux (2.4.20-30.9.openswan_1.0.3_1)
root (hd0,1)
kernel /vmlinuz-2.4.20-30.9.openswan_1.0.3_1 ro root=/dev/md1
initrd /initrd-2.4.20-30.9.openswan_1.0.3_1.img
title Red Hat Linux (2.4.20-31.9smp)
root (hd0,1)
kernel /vmlinuz-2.4.20-31.9smp ro root=/dev/md1
initrd /initrd-2.4.20-31.9smp.img
title Red Hat Linux (2.4.20-31.9)
root (hd0,1)
kernel /vmlinuz-2.4.20-31.9 ro root=/dev/md1
initrd /initrd-2.4.20-31.9.img
INSTALL OPENSWAN FOR REDHAT 9.0:
Check if OpenSwan is installed:
ipsec --version
GBS uses the latest OpenSwan available for RedHat 9.0. At the time of writing that was OpenSwan 1.0.3. Openswan 1.0.3 installs on Redhat 9.0 and is compatible with any OpenSwan installation. However it needs a special kernel patch that must be installed separately. Either download the Openswan 1.0.3.rpm from www.openswan.org or use:
yum install openswan
If downloading manually, install as follows:
rpm -ivh openswan-1.0.3-3.i386.rpm
Either obtain the kernel patches locally or download them from www.openswan.org:
wget http://www.openswan.org/download/binaries/redhat/9/i386/RPMS/i386/kernel-source-
2.4.20-30.9.openswan_1.0.3_1.i386.rpm
wget http://www.openswan.org/download/binaries/redhat/9/i386/RPMS/i386/kernel-doc-
2.4.20-30.9.openswan_1.0.3_1.i386.rpm
wget http://www.openswan.org/download/binaries/redhat/9/i386/RPMS/i386/kernel-2.4.20-
30.9.openswan_1.0.3_1.i386.rpm
2.4.20-30.9.openswan_1.0.3_1.i386.rpm
wget http://www.openswan.org/download/binaries/redhat/9/i386/RPMS/i386/kernel-doc-
2.4.20-30.9.openswan_1.0.3_1.i386.rpm
wget http://www.openswan.org/download/binaries/redhat/9/i386/RPMS/i386/kernel-2.4.20-
30.9.openswan_1.0.3_1.i386.rpm
Install as follows:
rpm -ivh --nodeps --force kernel-2.4.20-30.9.openswan_1.0.3_1.i386.rpm
rpm -ivh --nodeps --force kernel-source-2.4.20-30.9.openswan_1.0.3_1.i386.rpm
rpm -ivh --nodeps --force kernel-doc-2.4.20-30.9.openswan_1.0.3_1.i386.rpm
rpm -ivh --nodeps --force kernel-source-2.4.20-30.9.openswan_1.0.3_1.i386.rpm
rpm -ivh --nodeps --force kernel-doc-2.4.20-30.9.openswan_1.0.3_1.i386.rpm
Reboot the server:
reboot
Since a new kernel has been installed, you must change the boot kernel in /etc/grub.conf. Edit /etc/grub.conf so that the default=
default=0
timeout=10
splashimage=(hd0,1)/grub/splash.xpm.gz
title Red Hat Linux (2.4.20-30.9.openswan_1.0.3_1)
root (hd0,1)
kernel /vmlinuz-2.4.20-30.9.openswan_1.0.3_1 ro root=/dev/md1
initrd /initrd-2.4.20-30.9.openswan_1.0.3_1.img
title Red Hat Linux (2.4.20-31.9smp)
root (hd0,1)
kernel /vmlinuz-2.4.20-31.9smp ro root=/dev/md1
initrd /initrd-2.4.20-31.9smp.img
title Red Hat Linux (2.4.20-31.9)
root (hd0,1)
kernel /vmlinuz-2.4.20-31.9 ro root=/dev/md1
initrd /initrd-2.4.20-31.9.img
Outlook PST Files Location
Windows 2000 and Office 2000 onwards:
C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\Outlook
C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\Outlook
Adding Swap partitions on Fedora Core
Physically install the disk.
Locate it in /dev
If IDE it should be detected as hdX
If SCSI or SATA it should be detected as sdX
Use fdisk to partition it
fdisk /dev/device_name
n - for new partition
p - for primary partition
1 - for partition number
Specify start and end cylinders or sizes
t - for type change
L - to list types
82 - for Linux Swap - verify by looking at list when listed
w to writeout to disk and save the partition table.
So, the new partition will be /dev/device_name1
Once the drive has been partitioned above, run:
mkswap /dev/device_name1
Test it by switching it on:
swapon /dev/device_name1
.. and then running top to see it being added to the swap memory size:
top - 16:33:31 up 111 days, 21:59, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 136 total, 1 running, 134 sleeping, 0 stopped, 1 zombie
Cpu(s): 0.0%us, 0.1%sy, 0.2%ni, 99.6%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 2006264k total, 1990932k used, 15332k free, 230972k buffers
Swap: 2096376k total, 144k used, 2096232k free, 1602840k cached
Add it to /etc/fstab by adding a line as follows specifying it is a swap partition:
/dev/sda2 swap swap defaults 0 0
Reboot when done.
Locate it in /dev
If IDE it should be detected as hdX
If SCSI or SATA it should be detected as sdX
Use fdisk to partition it
fdisk /dev/device_name
n - for new partition
p - for primary partition
1 - for partition number
Specify start and end cylinders or sizes
t - for type change
L - to list types
82 - for Linux Swap - verify by looking at list when listed
w to writeout to disk and save the partition table.
So, the new partition will be /dev/device_name1
Once the drive has been partitioned above, run:
mkswap /dev/device_name1
Test it by switching it on:
swapon /dev/device_name1
.. and then running top to see it being added to the swap memory size:
top - 16:33:31 up 111 days, 21:59, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 136 total, 1 running, 134 sleeping, 0 stopped, 1 zombie
Cpu(s): 0.0%us, 0.1%sy, 0.2%ni, 99.6%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 2006264k total, 1990932k used, 15332k free, 230972k buffers
Swap: 2096376k total, 144k used, 2096232k free, 1602840k cached
Add it to /etc/fstab by adding a line as follows specifying it is a swap partition:
/dev/sda2 swap swap defaults 0 0
Reboot when done.
Thursday, June 26, 2008
Finding out who's infected on a LAN
I refer to this excellent article at the Everything Sysadmin Blog:
http://everythingsysadmin.com/archives/000054.html
He uses a nifty little shell command to collect useful statistics from tcpdump and explains the whole process very very well.
In essence, infected computers (by virii or mal/spyware) typically send out tonnes of address resolution requests that flood the network. These request are in the form of ARP packets (ARP = Address Resolution Protocol). By sniffing the network for these packets, one can easily tell which machine(s) are infected.
The command in question is:
tcpdump -l -n arp | egrep 'arp who-has' | head -100 | awk '{ print $NF }' |sort | uniq -c | sort -n
See above for an explanation of how he got to that stage =)
http://everythingsysadmin.com/archives/000054.html
He uses a nifty little shell command to collect useful statistics from tcpdump and explains the whole process very very well.
In essence, infected computers (by virii or mal/spyware) typically send out tonnes of address resolution requests that flood the network. These request are in the form of ARP packets (ARP = Address Resolution Protocol). By sniffing the network for these packets, one can easily tell which machine(s) are infected.
The command in question is:
tcpdump -l -n arp | egrep 'arp who-has' | head -100 | awk '{ print $NF }' |sort | uniq -c | sort -n
See above for an explanation of how he got to that stage =)
Obtaining machine name to IP mappings from DHCP Server on Linux
Say you're running dhcpd on Linux.
Need to know what IP a certain machine has gotten (and you don't have access to that machine?)
or
Need to know what machine a given IP belongs to ?
One needs to look in the following file:
/var/lib/dhcpd/dhcpd.leases
Since, this file contains all the mappings and lease times handed out (and a lot of redundant information), you may want to grep the file for the information you need. On top of that the information you need may be located several lines away from your search string, so look at the man page for grep for added functionality.
I use the following simple scripts:
To find the IP from the netbios name/machine name:
see_ip [netbios_name]
#!/bin/bash
# Automates display of machines' DHCP IP on LINUX
# Shows machine name and IP in one go from dhcpd.leases file
# Show the machine in /var/lib/dhcpd/dhcpd.leases
# Since the machine name is the 8th line in a stack of info about it
# Display the preceding 7 lines as well
echo "Machine details in DHCP database:"
cat /var/lib/dhcpd/dhcpd.leases | grep -B 7 $1
To find the netbios name/machine name from the IP address:
see_netbios [ip_address]
#!/bin/bash
# Automates display of DHCP IP's machine name on LINUX
# Shows machine name and IP in one go from dhcpd.leases file
# Show the machine in /var/lib/dhcpd/dhcpd.leases
# Since the IP is the 1st line of 8 in a stack of info about it
# Display the following 7 lines as well
echo "IP details in DHCP database:"
cat /var/lib/dhcpd/dhcpd.leases | grep -A 7 $1
Need to know what IP a certain machine has gotten (and you don't have access to that machine?)
or
Need to know what machine a given IP belongs to ?
One needs to look in the following file:
/var/lib/dhcpd/dhcpd.leases
Since, this file contains all the mappings and lease times handed out (and a lot of redundant information), you may want to grep the file for the information you need. On top of that the information you need may be located several lines away from your search string, so look at the man page for grep for added functionality.
I use the following simple scripts:
To find the IP from the netbios name/machine name:
see_ip [netbios_name]
#!/bin/bash
# Automates display of machines' DHCP IP on LINUX
# Shows machine name and IP in one go from dhcpd.leases file
# Show the machine in /var/lib/dhcpd/dhcpd.leases
# Since the machine name is the 8th line in a stack of info about it
# Display the preceding 7 lines as well
echo "Machine details in DHCP database:"
cat /var/lib/dhcpd/dhcpd.leases | grep -B 7 $1
To find the netbios name/machine name from the IP address:
see_netbios [ip_address]
#!/bin/bash
# Automates display of DHCP IP's machine name on LINUX
# Shows machine name and IP in one go from dhcpd.leases file
# Show the machine in /var/lib/dhcpd/dhcpd.leases
# Since the IP is the 1st line of 8 in a stack of info about it
# Display the following 7 lines as well
echo "IP details in DHCP database:"
cat /var/lib/dhcpd/dhcpd.leases | grep -A 7 $1
Switching off roaming profiles in SAMBA
Simply commenting out the following line does NOT switch it off. Leave the following line uncommented but specify an empty value:
[global]
..
logon path =
..
[global]
..
logon path =
..
Wednesday, June 25, 2008
Samba Performance Tuning
If you are using Samba to be the file server for windows machines, you may need to tweak certain options within Samba to get it work more ideally for your setup.
This post assumes you have already set Samba up to be a file server or a PDC/file server and have already defined some shared folders.
Share level directives:
For shared folder where files may be accessed concurrently by multiple users, I find that the following permissions within the share definition in Samba are quite good:
security mask = 0775
directory security mask = 0775
force create mode = 0777
force directory mode = 0777
This ensures that new folders and files created are fully controllable by everyone.
For folders where files may be accessed by a few users and never concurrently, I find that the following options within the share definition in Samba are quite good. There are a host of windows programs that 'import' files to be used in data generation and analysis. This setting is especially crucial for that kind of setup:
level2 oplocks = True
oplocks = True
By specifying that the files can be locked by an application, import speeds are exponentially increased, however one may find that concurrent file access is slowed down.
Therein lies the difference:
If your files are meant to be shared concurrently by multiple users - the first section applies to you.
If your files are meant to be used by a few users and rarely, if ever, concurrently, then use the second section.
More information on oplocks and samba file locking can be found here:
http://www.samba.org/samba/docs/man/Samba3-HOWTO/locking.html
More information on files and directories in shares can be found here:
http://www.samba.org/samba/docs/man/Samba3-HOWTO/AccessControls.html
Global level directives:
I always add these options in the global section:
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=8192 SO_SNDBUF=8192
Fiddle with the last two options - SO_RCVBUF and SO_SNDBUF till you get performance you are happy with. Bear in mind, blindly doubling or tripling those numbers does not improve performance.
More information can be found here:
http://www.samba.org/samba/docs/man/Samba3-HOWTO/speed.html
This post assumes you have already set Samba up to be a file server or a PDC/file server and have already defined some shared folders.
Share level directives:
For shared folder where files may be accessed concurrently by multiple users, I find that the following permissions within the share definition in Samba are quite good:
security mask = 0775
directory security mask = 0775
force create mode = 0777
force directory mode = 0777
This ensures that new folders and files created are fully controllable by everyone.
For folders where files may be accessed by a few users and never concurrently, I find that the following options within the share definition in Samba are quite good. There are a host of windows programs that 'import' files to be used in data generation and analysis. This setting is especially crucial for that kind of setup:
level2 oplocks = True
oplocks = True
By specifying that the files can be locked by an application, import speeds are exponentially increased, however one may find that concurrent file access is slowed down.
Therein lies the difference:
If your files are meant to be shared concurrently by multiple users - the first section applies to you.
If your files are meant to be used by a few users and rarely, if ever, concurrently, then use the second section.
More information on oplocks and samba file locking can be found here:
http://www.samba.org/samba/docs/man/Samba3-HOWTO/locking.html
More information on files and directories in shares can be found here:
http://www.samba.org/samba/docs/man/Samba3-HOWTO/AccessControls.html
Global level directives:
I always add these options in the global section:
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=8192 SO_SNDBUF=8192
Fiddle with the last two options - SO_RCVBUF and SO_SNDBUF till you get performance you are happy with. Bear in mind, blindly doubling or tripling those numbers does not improve performance.
More information can be found here:
http://www.samba.org/samba/docs/man/Samba3-HOWTO/speed.html
Tuesday, June 24, 2008
Looking for Users on Mailserver in Linux
Linux mail servers have users' home directories in /home
Within the various user folders there may be .copy and .forward files that reference other user accounts by email address.
In addition users may be aliased in /etc/aliases
When a user gets deleted, they may still be referenced in a .copy, .procmailrc or .forward file somewhere or exist in the aliases db
Use the following script to check for a user's presence in one quick step:
#!/bin/bash
# This script helps search for usernames that are being copied, forwarded or
# aliased to.
USERNAME=$1;
# Go to the /home driectory
cd /home
# Search all .copy files and print the name out of the file that matches
echo ".copy references: "
grep -l $USERNAME `ls */.copy`
echo -e "\n"
# Same for .forward files
echo ".forward references: "
grep -l $USERNAME `ls */.forward`
echo -e "\n"
# Same for .procmailrc files
echo ".procmailrc references: "
grep -l $USERNAME `ls */.procmailrc`
echo -e "\n"
# Same for the /etc/aliases file
echo "Aliases File: "
cat /etc/aliases | grep $USERNAME
echo -e "\n"
I put this file in /root/bin as well. If you change this location, make sure you change the location in the script above.
Within the various user folders there may be .copy and .forward files that reference other user accounts by email address.
In addition users may be aliased in /etc/aliases
When a user gets deleted, they may still be referenced in a .copy, .procmailrc or .forward file somewhere or exist in the aliases db
Use the following script to check for a user's presence in one quick step:
#!/bin/bash
# This script helps search for usernames that are being copied, forwarded or
# aliased to.
USERNAME=$1;
# Go to the /home driectory
cd /home
# Search all .copy files and print the name out of the file that matches
echo ".copy references: "
grep -l $USERNAME `ls */.copy`
echo -e "\n"
# Same for .forward files
echo ".forward references: "
grep -l $USERNAME `ls */.forward`
echo -e "\n"
# Same for .procmailrc files
echo ".procmailrc references: "
grep -l $USERNAME `ls */.procmailrc`
echo -e "\n"
# Same for the /etc/aliases file
echo "Aliases File: "
cat /etc/aliases | grep $USERNAME
echo -e "\n"
I put this file in /root/bin as well. If you change this location, make sure you change the location in the script above.
Labels:
Command Line Tricks,
Email,
Linux Maintenance
Viewing Hardware Information in Linux
This Linux utility tells you what lies inside your case and saves you the trouble of opening it up and looking to see what the details of your motherboard and slots are. Assuming of course that you actually know how to tell what the details of everything are just by looking at them ;-)
dmidecode | less
This gives you way more information than you would need but it does give you what you may want from motherboard manufacturer and model to memory slot speeds.
Initially the listing seems very verbose and tricky to read. With a little practice you can scan straight to the parts which have the information you are looking for.
For example:
Memory information is listed in multiple places:
One section has information about the modules installed
Another section has information about the slots
dmidecode | less
This gives you way more information than you would need but it does give you what you may want from motherboard manufacturer and model to memory slot speeds.
Initially the listing seems very verbose and tricky to read. With a little practice you can scan straight to the parts which have the information you are looking for.
For example:
Memory information is listed in multiple places:
One section has information about the modules installed
Another section has information about the slots
Monday, June 23, 2008
Killing specific processes on Linux
I use the following simple code snippet to kill specific processes based on owner:
kill -9 `ps auwx | grep service_name | awk 'match($1,"owner_name") {print $2}'` 2&>1 > /dev/null
owner_name is the owner of the process.
So, if they are pop connections change service_name above to pop.
Always look at the process stack generated by ps auwx first to get an idea of who owns what processes. The above snippet is best used in a script where one can pass in the owner_name and service_name parameters as arguments.
kill -9 `ps auwx | grep service_name | awk 'match($1,"owner_name") {print $2}'` 2&>1 > /dev/null
owner_name is the owner of the process.
So, if they are pop connections change service_name above to pop.
Always look at the process stack generated by ps auwx first to get an idea of who owns what processes. The above snippet is best used in a script where one can pass in the owner_name and service_name parameters as arguments.
Friday, June 20, 2008
Wireless Internet Connectivity for Notebooks using a Blackberry
This post is now deprecated. Although the following setup does still work it is non-trivial to setup and is now no longer recommended by Rogers or GBS.
GBS and Rogers both recommend notebook users to get a SIM based Mobilink Air Card modem for wireless access anywhere.
--------------------------------------
Connect a computer to the Internet using a GPRS, EDGE, or UMTS BlackBerry smartphone as a tethered modem
Environment
* BlackBerry® 7130 Series
* BlackBerry® 7200 Series
* BlackBerry® 8100 Series
* BlackBerry® 8300 Series
* BlackBerry® 8700 Series
* BlackBerry® 8800 smartphone
* BlackBerry® Desktop Software 4.1 and later
* Windows® 2000 and XP
Note: Research In Motion (RIM) provides some support for the tethered modem; the installation of the Standard Modem Driver is supported. See KB05178 for more details about support for the tethered modem.
Important: Contact your service provider to obtain the user name and password you require to configure dial-up networking. Also, ask your service provider if additional charges are incorporated when connecting to the Internet using the BlackBerry smartphone as a tethered modem.
Procedure
A BlackBerry smartphone with tethered modem capabilities can be used as an external modem to connect a computer or laptop computer to the Internet.
Summary of Tasks
To set up a tethered modem, complete the following tasks:
1. Install BlackBerry Desktop Software 4.1 or later (one time only).
2. Set up the Internet access point name (APN) (one time only).
3. Configure dial-up networking (one time only).
4. Connect to the Internet using dial-up networking.
Task 1
Install BlackBerry Desktop Software 4.1 or later on the computer.
When you install BlackBerry Desktop Software, the drivers that allow the BlackBerry smartphone to communicate through the Universal Serial Bus (USB) port and virtual COM port are installed. The Standard Modem, which is used by dial-up networking, is also installed.
Note: If upgrading your BlackBerry Desktop Software from version 4.0 to 4.1, the required Virtual COM Port and Standard Modem might be removed during the upgrade process. If this is the case, re-install the BlackBerry Desktop Software 4.1 or later and choose the Repair option to re-install these components.
Task 2
Set up an Internet APN.
1. Click Start > Settings > Control Panel.
2. Double-click Phone and Modem Options.
3. In the Phone and Modem Options window, click the Modems tab.
4. Select Standard Modem and click Properties.
5. Click Change Settings.
6. In the Standard Modem Properties window, click the Advanced tab.
7. In the Extra initialization commands field, type the following:
+cgdcont=1,"IP",""
Note: The following is applicable for T-Mobile® customers only:
The extra initialization command is: +cgdcont=1,"IP","wap.voicestream.com"
Note: If you do not know your Internet APN, or if you do not have an Internet APN, contact your service provider.
8. Click OK.
9. In the Phone and Modem Options window, click OK.
Task 3
To configure dial-up networking, complete the procedure that is appropriate to the operating system you are using:
Windows Vista™
Click Start > Control Panel > Hardware and Sound > Phone and Modem Options.
If you are opening Phone and Modem Options for the first time, a dialog box displays prompting you to enter an area code and access codes.
Windows XP operating system
1. Click Start > Settings > Network Connections.
2. Double-click New Connection Wizard. The New Connection Wizard opens.
3. Click Next.
4. Select the Connect to the Internet option. Click Next.
5. Select Set up my connection manually. Click Next.
6. Select Connect using a dial-up modem. Click Next.
7. If the Select a Device screen appears, select the Modem - Standard Modem check box. Click Next.
8. In the ISP Name field, type a name for your connection. Click Next.
9. In the Phone number field, type *99#. Click Next.
10. Indicate which users will have access to the connection. Click Next.
11. Type the user name and password provided by your service provider. Click Next.
12. Click Finish.
13. In the Connect window, click Properties.
14. In the Properties window, verify that Modem - Standard Modem appears beneath the Connect using heading, and then click Configure.
15. In the Modem Configuration window, clear the Enable hardware flow control check box and make sure none of the other check boxes are selected. Click OK. In the Properties window, click OK.
Windows 2000 operating system
1. Click Start > Settings > Control Panel.
2. Double-click Network and Dial-up Connections.
Note: The following is applicable for T-Mobile customers only:
Under the networking tab in the properties window for the dial-up connection, clear the Enable LCP Extensions check box, as well as every other box beneath the PPP window.
3. Double-click Make New Connection. The Network Connection Wizard opens.
4. Click Next.
5. Choose Dial-up to private network. Click Next.
6. In the Phone number field, type *99#. Click Next.
7. Indicate which users will have access to the connection. Click Next.
8. Type a name for your connection. Click Finish.
9. In the Connect window, click Properties.
10. In the Properties window, verify that Modem - Standard Modem is selected, then click Configure.
11. In the Modem Configuration window, clear the Enable hardware flow control check box and make sure none of the other check boxes are selected. Click OK.
12. In the Properties window, click OK.
Task 4
Connect to the Internet using dial-up networking.
Note: During this procedure, do not operate the BlackBerry® Browser or any third-party applications on the BlackBerry smartphone. An active data session may interfere with the modem connection. Also, make sure an ethernet connection is not active at the same time.
1. Connect the BlackBerry smartphone to the computer.
2. Open BlackBerry Desktop Manager.
3. Click Start > Settings > Network Connections >.
4. Type the user name and password provided by your service provider.
5. Click Dial.
Additional Info
Products & Services:
* BlackBerry Desktop Software
* Version 4.1
* Version 4.2
* BlackBerry 7100 Series
* BlackBerry 7200 Series
* BlackBerry 8100 Series
* BlackBerry 8700 Series
* Device Applications
* BlackBerry 8800 Series
GBS and Rogers both recommend notebook users to get a SIM based Mobilink Air Card modem for wireless access anywhere.
--------------------------------------
Connect a computer to the Internet using a GPRS, EDGE, or UMTS BlackBerry smartphone as a tethered modem
Environment
* BlackBerry® 7130 Series
* BlackBerry® 7200 Series
* BlackBerry® 8100 Series
* BlackBerry® 8300 Series
* BlackBerry® 8700 Series
* BlackBerry® 8800 smartphone
* BlackBerry® Desktop Software 4.1 and later
* Windows® 2000 and XP
Note: Research In Motion (RIM) provides some support for the tethered modem; the installation of the Standard Modem Driver is supported. See KB05178 for more details about support for the tethered modem.
Important: Contact your service provider to obtain the user name and password you require to configure dial-up networking. Also, ask your service provider if additional charges are incorporated when connecting to the Internet using the BlackBerry smartphone as a tethered modem.
Procedure
A BlackBerry smartphone with tethered modem capabilities can be used as an external modem to connect a computer or laptop computer to the Internet.
Summary of Tasks
To set up a tethered modem, complete the following tasks:
1. Install BlackBerry Desktop Software 4.1 or later (one time only).
2. Set up the Internet access point name (APN) (one time only).
3. Configure dial-up networking (one time only).
4. Connect to the Internet using dial-up networking.
Task 1
Install BlackBerry Desktop Software 4.1 or later on the computer.
When you install BlackBerry Desktop Software, the drivers that allow the BlackBerry smartphone to communicate through the Universal Serial Bus (USB) port and virtual COM port are installed. The Standard Modem, which is used by dial-up networking, is also installed.
Note: If upgrading your BlackBerry Desktop Software from version 4.0 to 4.1, the required Virtual COM Port and Standard Modem might be removed during the upgrade process. If this is the case, re-install the BlackBerry Desktop Software 4.1 or later and choose the Repair option to re-install these components.
Task 2
Set up an Internet APN.
1. Click Start > Settings > Control Panel.
2. Double-click Phone and Modem Options.
3. In the Phone and Modem Options window, click the Modems tab.
4. Select Standard Modem and click Properties.
5. Click Change Settings.
6. In the Standard Modem Properties window, click the Advanced tab.
7. In the Extra initialization commands field, type the following:
+cgdcont=1,"IP","
Note: The following is applicable for T-Mobile® customers only:
The extra initialization command is: +cgdcont=1,"IP","wap.voicestream.com"
Note: If you do not know your Internet APN, or if you do not have an Internet APN, contact your service provider.
8. Click OK.
9. In the Phone and Modem Options window, click OK.
Task 3
To configure dial-up networking, complete the procedure that is appropriate to the operating system you are using:
Windows Vista™
Click Start > Control Panel > Hardware and Sound > Phone and Modem Options.
If you are opening Phone and Modem Options for the first time, a dialog box displays prompting you to enter an area code and access codes.
Windows XP operating system
1. Click Start > Settings > Network Connections.
2. Double-click New Connection Wizard. The New Connection Wizard opens.
3. Click Next.
4. Select the Connect to the Internet option. Click Next.
5. Select Set up my connection manually. Click Next.
6. Select Connect using a dial-up modem. Click Next.
7. If the Select a Device screen appears, select the Modem - Standard Modem check box. Click Next.
8. In the ISP Name field, type a name for your connection. Click Next.
9. In the Phone number field, type *99#. Click Next.
10. Indicate which users will have access to the connection. Click Next.
11. Type the user name and password provided by your service provider. Click Next.
12. Click Finish.
13. In the Connect window, click Properties.
14. In the Properties window, verify that Modem - Standard Modem appears beneath the Connect using heading, and then click Configure.
15. In the Modem Configuration window, clear the Enable hardware flow control check box and make sure none of the other check boxes are selected. Click OK. In the Properties window, click OK.
Windows 2000 operating system
1. Click Start > Settings > Control Panel.
2. Double-click Network and Dial-up Connections.
Note: The following is applicable for T-Mobile customers only:
Under the networking tab in the properties window for the dial-up connection, clear the Enable LCP Extensions check box, as well as every other box beneath the PPP window.
3. Double-click Make New Connection. The Network Connection Wizard opens.
4. Click Next.
5. Choose Dial-up to private network. Click Next.
6. In the Phone number field, type *99#. Click Next.
7. Indicate which users will have access to the connection. Click Next.
8. Type a name for your connection. Click Finish.
9. In the Connect window, click Properties.
10. In the Properties window, verify that Modem - Standard Modem is selected, then click Configure.
11. In the Modem Configuration window, clear the Enable hardware flow control check box and make sure none of the other check boxes are selected. Click OK.
12. In the Properties window, click OK.
Task 4
Connect to the Internet using dial-up networking.
Note: During this procedure, do not operate the BlackBerry® Browser or any third-party applications on the BlackBerry smartphone. An active data session may interfere with the modem connection. Also, make sure an ethernet connection is not active at the same time.
1. Connect the BlackBerry smartphone to the computer.
2. Open BlackBerry Desktop Manager.
3. Click Start > Settings > Network Connections >
4. Type the user name and password provided by your service provider.
5. Click Dial.
Additional Info
Products & Services:
* BlackBerry Desktop Software
* Version 4.1
* Version 4.2
* BlackBerry 7100 Series
* BlackBerry 7200 Series
* BlackBerry 8100 Series
* BlackBerry 8700 Series
* Device Applications
* BlackBerry 8800 Series
Post-Install XP Settings for Toshiba Notebooks
Post-Install XP Configuration:
Power Options:
Switch Of Hibernation
Use Always-On Power Setting and NOT Toshiba Power Setting
When I close the lid of my computer the computer goes into standby
File and Folder Options:
Display contents of System Folders
Display full name in address bar
Display full name in title bar
Display hidden files
Set View to Detailed NOT Thumbnails or Icons
System Options:
Under Device manager - for Ethernet NICs, Wireless NICs and USB Root Hubs - Power Managment
Uncheck "Allow computer to switch this device off to save power"
Control Panel:
Switch to Classic View from Category View
IE Settings:
Tools - Internet Options - Programs - I set the default program for editing web pages/HTML to notepad.
Homepage to Google
Offline File Size settings to 250 MB
Power Options:
Switch Of Hibernation
Use Always-On Power Setting and NOT Toshiba Power Setting
When I close the lid of my computer the computer goes into standby
File and Folder Options:
Display contents of System Folders
Display full name in address bar
Display full name in title bar
Display hidden files
Set View to Detailed NOT Thumbnails or Icons
System Options:
Under Device manager - for Ethernet NICs, Wireless NICs and USB Root Hubs - Power Managment
Uncheck "Allow computer to switch this device off to save power"
Control Panel:
Switch to Classic View from Category View
IE Settings:
Tools - Internet Options - Programs - I set the default program for editing web pages/HTML to notepad.
Homepage to Google
Offline File Size settings to 250 MB
Setting up windows computer to use new Samba PDC on same domain
Setting up windows computer to use new Samba PDC on same domain
1) Log on to machine as local admin.
2) Leave the domain - restart.
3) Rejoin the domain (you can use either root/administrator as the domain admin with admin password).
4) After rejoining, do not restart yet, go to Control Panel -> Admin Tools -> Computer Mgmt -> Local Users and Groups. Under groups, for administrators, select 'domain_name' from the drop down list (again use either root/administrator as the domain admin with admin password) and add 'root' and 'user' to list of administrators for the machine. Click Apply, Click OK, Close all those windows. Now restart.
5) Login as user.
6) Right Click on My Computer, Properties, User Profiles, Select the 'domain_name/user' from the list of profiles, Click on the Change Type button, Change it from Roaming to Local. Click Apply, Click OK.****
7) Now log off user, log back on as local admin. Go to C:\Documents and Settings\ .
8) Delete 'user.domain_name'. Rename 'user' as 'user.domain_name'.
9) Log off local admin, log back on as user. You should see the user's normal profile being restored. The shortcuts, desktop, start menu, etc will be restored as before.
10) If the user uses Outlook one more thing needs to be done. Start Outlook, it will complain about not being able to find the .pst file (Outlook's file pointers are absolute, not relative). A file browser window will open up. Navigate to C:\Documents and Settings\user.domain_name\Local Settings\Application Data\Microsoft\Outlook\ and select the .pst file from there. Outlook should then open up as normal. If this fails - Outlook's account configuration has to be setup again from scratch - but you can still specify the pst file during re-configuration. It might prompt for CD.
That SHOULD be it. However I am learning new gotchas every time.
------
**** If the new domain is set to not use roaming profiles, you may not need to do anything beyond step 6 and you may not need to even change the profile type from roaming to local.
1) Log on to machine as local admin.
2) Leave the domain - restart.
3) Rejoin the domain (you can use either root/administrator as the domain admin with admin password).
4) After rejoining, do not restart yet, go to Control Panel -> Admin Tools -> Computer Mgmt -> Local Users and Groups. Under groups, for administrators, select 'domain_name' from the drop down list (again use either root/administrator as the domain admin with admin password) and add 'root' and 'user' to list of administrators for the machine. Click Apply, Click OK, Close all those windows. Now restart.
5) Login as user.
6) Right Click on My Computer, Properties, User Profiles, Select the 'domain_name/user' from the list of profiles, Click on the Change Type button, Change it from Roaming to Local. Click Apply, Click OK.****
7) Now log off user, log back on as local admin. Go to C:\Documents and Settings\ .
8) Delete 'user.domain_name'. Rename 'user' as 'user.domain_name'.
9) Log off local admin, log back on as user. You should see the user's normal profile being restored. The shortcuts, desktop, start menu, etc will be restored as before.
10) If the user uses Outlook one more thing needs to be done. Start Outlook, it will complain about not being able to find the .pst file (Outlook's file pointers are absolute, not relative). A file browser window will open up. Navigate to C:\Documents and Settings\user.domain_name\Local Settings\Application Data\Microsoft\Outlook\ and select the .pst file from there. Outlook should then open up as normal. If this fails - Outlook's account configuration has to be setup again from scratch - but you can still specify the pst file during re-configuration. It might prompt for CD.
That SHOULD be it. However I am learning new gotchas every time.
------
**** If the new domain is set to not use roaming profiles, you may not need to do anything beyond step 6 and you may not need to even change the profile type from roaming to local.
Labels:
Linux networking,
SAMBA,
Windows,
Windows Networking
Windows TCP/IP Settings for STATIC IP
You must do the following:
Under Network connections:
For each LAN connection that is to have a static IP:
TCP/IP Properties
Specify:
LAN IP
MASK
GATEWAY
DNS Servers (You need at least one)
Under Advanced,
DNS Tab:
Specify the search suffix
WINS Tab:
Add and specify a WINS server
Select the DEFAULT Netbios Setting
Under Network connections:
For each LAN connection that is to have a static IP:
TCP/IP Properties
Specify:
LAN IP
MASK
GATEWAY
DNS Servers (You need at least one)
Under Advanced,
DNS Tab:
Specify the search suffix
WINS Tab:
Add and specify a WINS server
Select the DEFAULT Netbios Setting
Simple Port Forwarding on IPTABLES over NAT-T
Assuming you have:
Machine 1 with WAN and LAN interfaces running IPTABLES with NAT-T
Machine 2 with only LAN interface
Machine 1 WAN interface is WAN_IF
Machine 2 LAN interface is LAN_IF
Machine 2 LAN IP is DEST_IP
Machine 1 Port that is being forwarded is FWD_PORT
MAchine 2 Port that is being forwarded to is DEST_PORT
You want to to forward ports on Machine 1 to Machine 2.
Here's a snippet that can be added to /etc/sysconfig/iptables that does that.
In the *nat block, after the NAT-T lines:
-A PREROUTING -d WAN_IP -i WAN_IF -p tcp -m tcp --dport FWD_PORT -j DNAT --to-destination DEST_IP:DEST_PORT
-A POSTROUTING -s DEST_IP -o WAN_IF -j SNAT --to-source WAN_IP
#-A POSTROUTING -o LAN_IF -p tcp --dport FWD_PORT -d DEST_IP -j SNAT --to DEST_IP**
COMMIT
**If machine 2 is NOT set up to use Machine 1 as a gateway, then uncomment that line.
In the *filter block:
-A FORWARD -d DEST_IP -i WAN_IF -o LAN_IF -p tcp -m tcp --dport FWD_PORT -m state --state NEW -j ACCEPT
COMMIT
And you're done.
I usually use VNC to test this. Install VNC on the LAN Machine 2, use port 5900 as the DEST_PORT and FWD_PORT and test.
Machine 1 with WAN and LAN interfaces running IPTABLES with NAT-T
Machine 2 with only LAN interface
Machine 1 WAN interface is WAN_IF
Machine 2 LAN interface is LAN_IF
Machine 2 LAN IP is DEST_IP
Machine 1 Port that is being forwarded is FWD_PORT
MAchine 2 Port that is being forwarded to is DEST_PORT
You want to to forward ports on Machine 1 to Machine 2.
Here's a snippet that can be added to /etc/sysconfig/iptables that does that.
In the *nat block, after the NAT-T lines:
-A PREROUTING -d WAN_IP -i WAN_IF -p tcp -m tcp --dport FWD_PORT -j DNAT --to-destination DEST_IP:DEST_PORT
-A POSTROUTING -s DEST_IP -o WAN_IF -j SNAT --to-source WAN_IP
#-A POSTROUTING -o LAN_IF -p tcp --dport FWD_PORT -d DEST_IP -j SNAT --to DEST_IP**
COMMIT
**If machine 2 is NOT set up to use Machine 1 as a gateway, then uncomment that line.
In the *filter block:
-A FORWARD -d DEST_IP -i WAN_IF -o LAN_IF -p tcp -m tcp --dport FWD_PORT -m state --state NEW -j ACCEPT
COMMIT
And you're done.
I usually use VNC to test this. Install VNC on the LAN Machine 2, use port 5900 as the DEST_PORT and FWD_PORT and test.
Generic overview of disk addition in Linux
Use fdisk to partition it
Use mkfs to format it, you want to format it as an ext3 type partition, you will want to tell mkfs to check for bad blocks. Read the man page
NOTE: Order of command params for this command MATTER, because mkfs is just a front end for various other programs that actually do the work
Then you will want to mount it, the command is mount, read the man page
Then you will want to tell the system to mount that partition automatically each boot, make an entry in the /etc/fstab file
Use mkfs to format it, you want to format it as an ext3 type partition, you will want to tell mkfs to check for bad blocks. Read the man page
NOTE: Order of command params for this command MATTER, because mkfs is just a front end for various other programs that actually do the work
Then you will want to mount it, the command is mount, read the man page
Then you will want to tell the system to mount that partition automatically each boot, make an entry in the /etc/fstab file
Checking process stack in Linux
Generally the command to show the process stack is ps auwx
Since this spews out every single process running and we want to prune it down to show specific processes use grep as follows:
To show pop3 processes:
ps auwx | grep pop3
IMAP
ps auwx | grep imap
HTTPD:
ps auwx | grep httpd
POSTGRESQL
ps auwx | grep postgres
SENDMAIL
ps auwx | grep sendmail
and so on....
Since this spews out every single process running and we want to prune it down to show specific processes use grep as follows:
To show pop3 processes:
ps auwx | grep pop3
IMAP
ps auwx | grep imap
HTTPD:
ps auwx | grep httpd
POSTGRESQL
ps auwx | grep postgres
SENDMAIL
ps auwx | grep sendmail
and so on....
RAID Array Rebuilding and Boot Disk Creation in Linux
Boot Disk Creation:
cd /lib/modules
mkbootdisk --iso --device [location you want the bootdisk iso to be created
in] [kernel number you want to create a boot disk for]
Fedora core 6 RAID rebuilding:
mdadm [raid device] [harddrive]
ex:
mdadm /dev/md0 --add /dev/sda
Older versions: RH9 et al:
raidhotadd /dev/md0 /dev/sda
cd /lib/modules
mkbootdisk --iso --device [location you want the bootdisk iso to be created
in] [kernel number you want to create a boot disk for]
Fedora core 6 RAID rebuilding:
mdadm [raid device] [harddrive]
ex:
mdadm /dev/md0 --add /dev/sda
Older versions: RH9 et al:
raidhotadd /dev/md0 /dev/sda
Labels:
Boot Disk,
Command Line Tricks,
Linux Disk Drives
TCPDUMP Setup to monitor FW Servers
In /root/bin:
call_tcpdump actually has the tcpdump command:
#!/bin/bash
# Call tcp dump with the following options:
# Listen on interface eth1 (WAN nic) : -i eth1
# Output date and time : -tttt
# Suppress host and portnumber lookup : -nn This has been reenabled for now
# Quiet Mode - suppress ack and nack : -q
# Buffer output for writing to file : -l
# Filter out local eth1 address from traffic : grep -v WAN_IP
# Write it to the following log file : /var/log/tcpdump/packetinfo.log
tcpdump -i eth1 -tttt -q -l | grep -v WAN_IP > /var/log/tcpdump/packetinfo.log &
restart_tcpdump does the rotation and calls the command script call_tcpdump:
#!/bin/bash
cd /var/log/tcpdump/
# Rotate the log files one for each day dropping off the oldest one
rm -f packetinfo.log.7
mv -f packetinfo.log.6 packetinfo.log.7
mv -f packetinfo.log.5 packetinfo.log.6
mv -f packetinfo.log.4 packetinfo.log.5
mv -f packetinfo.log.3 packetinfo.log.4
mv -f packetinfo.log.2 packetinfo.log.3
mv -f packetinfo.log.1 packetinfo.log.2
# Kill the current tcpdump process
kill -9 `ps auwx | grep tcpdump | awk 'match($1,"pcap") {print $2}'` 2&>1 > /dev/null
# Rotate the current log file
mv -f packetinfo.log packetinfo.log.1
# Call the tcpdump process again
/root/bin/call_tcpdump
In addition I have set it to restart the tcpdump script everyday at 8:00 AM
/var/spool/cron/root:
# Perform the tcpdump service restart every day at 8:00 and at 12:00
00 8 * * * /root/bin/restart_tcpdump fw_server.tcpdump
call_tcpdump actually has the tcpdump command:
#!/bin/bash
# Call tcp dump with the following options:
# Listen on interface eth1 (WAN nic) : -i eth1
# Output date and time : -tttt
# Suppress host and portnumber lookup : -nn This has been reenabled for now
# Quiet Mode - suppress ack and nack : -q
# Buffer output for writing to file : -l
# Filter out local eth1 address from traffic : grep -v WAN_IP
# Write it to the following log file : /var/log/tcpdump/packetinfo.log
tcpdump -i eth1 -tttt -q -l | grep -v WAN_IP > /var/log/tcpdump/packetinfo.log &
restart_tcpdump does the rotation and calls the command script call_tcpdump:
#!/bin/bash
cd /var/log/tcpdump/
# Rotate the log files one for each day dropping off the oldest one
rm -f packetinfo.log.7
mv -f packetinfo.log.6 packetinfo.log.7
mv -f packetinfo.log.5 packetinfo.log.6
mv -f packetinfo.log.4 packetinfo.log.5
mv -f packetinfo.log.3 packetinfo.log.4
mv -f packetinfo.log.2 packetinfo.log.3
mv -f packetinfo.log.1 packetinfo.log.2
# Kill the current tcpdump process
kill -9 `ps auwx | grep tcpdump | awk 'match($1,"pcap") {print $2}'` 2&>1 > /dev/null
# Rotate the current log file
mv -f packetinfo.log packetinfo.log.1
# Call the tcpdump process again
/root/bin/call_tcpdump
In addition I have set it to restart the tcpdump script everyday at 8:00 AM
/var/spool/cron/root:
# Perform the tcpdump service restart every day at 8:00 and at 12:00
00 8 * * * /root/bin/restart_tcpdump fw_server.tcpdump
Mounting Windows shares in Linux
Fedora Core onwards:
mount -t cifs //1.2.3.4/share /mnt/somedirectory -ouser=admin_account,password=admin_passwd,rw
For more information about this, in a terminal you can do:
man mount.cifs
mount -t cifs //1.2.3.4/share /mnt/somedirectory -ouser=admin_account,password=admin_passwd,rw
For more information about this, in a terminal you can do:
man mount.cifs
Thursday, June 19, 2008
Getting NETBIOS name from IP address
Remember how sometimes and often recurrently we need to know what machine is doing something on the network, and we only have the IP address ?
Well this windows comandline command from a windows machine on that LAN will give you that very same info - so we can run this from the PDC:
nbstat -r -A
......as evidence by:
G:\>nbtstat -r -A 10.243.102.148
Local Area Connection:
Node IpAddress: [10.243.102.75] Scope Id: []
NetBIOS Remote Machine Name Table
Name Type Status
---------------------------------------------
DREW <00> UNIQUE Registered
GGG_IT <00> GROUP Registered
DREW <03> UNIQUE Registered
DREW$ <03> UNIQUE Registered
DREW <20> UNIQUE Registered
GGG_IT <1e> GROUP Registered
MAC Address = 00-16-E6-D9-06-B0
Given that it gives us some rather redundant information - but it does tell us the remote machine name and the MAC Address - which might be useful.
Well this windows comandline command from a windows machine on that LAN will give you that very same info - so we can run this from the PDC:
nbstat -r -A
......as evidence by:
G:\>nbtstat -r -A 10.243.102.148
Local Area Connection:
Node IpAddress: [10.243.102.75] Scope Id: []
NetBIOS Remote Machine Name Table
Name Type Status
---------------------------------------------
DREW <00> UNIQUE Registered
GGG_IT <00> GROUP Registered
DREW <03> UNIQUE Registered
DREW$ <03> UNIQUE Registered
DREW <20> UNIQUE Registered
GGG_IT <1e> GROUP Registered
MAC Address = 00-16-E6-D9-06-B0
Given that it gives us some rather redundant information - but it does tell us the remote machine name and the MAC Address - which might be useful.
PAM workaround for Squirrelmail
I had to fiddle with this to get the auto-vacation working for local users.
Squirrelmail's option vacation_local uses the (vs)ftp backend and, since
vsftpd uses pam to authenticate local ftp logins, there was a problem where
it was not allowing local users who did not have a shell to log in. One
solution was granting them a shell which is tedious and a massive security
hole.
So I found that for every service that uses pam, there is a corresponding
file/module in /etc/pam.d
for /etc/pam.d/vsftpd I found there is an entry:
auth required pam_shells.so (This suggested to me, vsftpd's pam
REQUIRES users to have a login shell)
..which was absent in /etc/pam.d/dovecot (a service that makes no
distinction in authenticating between users who have a shell and those who
don't)
So I commented out that line, restarted vsftpd and voila, local users with
no shell could log in and the vacation message option was working for them.
Squirrelmail's option vacation_local uses the (vs)ftp backend and, since
vsftpd uses pam to authenticate local ftp logins, there was a problem where
it was not allowing local users who did not have a shell to log in. One
solution was granting them a shell which is tedious and a massive security
hole.
So I found that for every service that uses pam, there is a corresponding
file/module in /etc/pam.d
for /etc/pam.d/vsftpd I found there is an entry:
auth required pam_shells.so (This suggested to me, vsftpd's pam
REQUIRES users to have a login shell)
..which was absent in /etc/pam.d/dovecot (a service that makes no
distinction in authenticating between users who have a shell and those who
don't)
So I commented out that line, restarted vsftpd and voila, local users with
no shell could log in and the vacation message option was working for them.
Adding a new IDE drive to FC/RedHat Install
1. Physically put the new IDE hard drive in.
2. Boot up. Go into /dev and do 'ls | grep hd' to see all devices
starting with hd - ie all the IDE harddrives. In this case the new IDE HDD
was hdg. If it does not show up under /dev check the BIOS and jumper
settings if necessary to ensure the HD is powering up and getting detected.
3. Type 'fdisk /dev/hdg' This opens up the fdisk utility on hdg. We want
to partition it.
3a Type ? for help with fdisk commands if necessary. The ones we need are:
'p' (which means print partition information) to see the partition table
infor for that drive - it should be empty.
'n' (which means new partition) - follow the prompts - default options are
best selected to create a new partition on it called hdg1 which encompasses
the entire drive.
4 Once this is done you can quit out of fdisk. Now the partition is
created, we can format it as per our needs. formating will not work unless
we have a partition to format. Partitions are basically the OS's way of
looking at and interacting with HDs. Type the following:
mkfs -t ext3 -c /dev/hdg1
This should format hdg1 as a ext3 partition.
5 Now we can add it to the list of mounted disks. Since it was replacing
hda1 we need to mount hdg1 as /temp (a temporary location) and copy over the
contents of whatever was mounted on hda1 (in this case /backup2) to hdg1.
Also set the fstab to automatically mount hdg1 where hda1 was the next time
the OS reboots.
So, vi /etc/fstab - replace occurences hda1 with hdg1. Save and exit
cd /
mkdir /temp
mount /dev/hdg1 /temp
cd /backup2
cp -rp * /temp
...
cd /
umount /backup2
mount /backup2 - NOTICE how this time when you do 'df' /backup2 is mounted
on /dev/hdg1
You're done.
2. Boot up. Go into /dev and do 'ls | grep hd' to see all devices
starting with hd - ie all the IDE harddrives. In this case the new IDE HDD
was hdg. If it does not show up under /dev check the BIOS and jumper
settings if necessary to ensure the HD is powering up and getting detected.
3. Type 'fdisk /dev/hdg' This opens up the fdisk utility on hdg. We want
to partition it.
3a Type ? for help with fdisk commands if necessary. The ones we need are:
'p' (which means print partition information) to see the partition table
infor for that drive - it should be empty.
'n' (which means new partition) - follow the prompts - default options are
best selected to create a new partition on it called hdg1 which encompasses
the entire drive.
4 Once this is done you can quit out of fdisk. Now the partition is
created, we can format it as per our needs. formating will not work unless
we have a partition to format. Partitions are basically the OS's way of
looking at and interacting with HDs. Type the following:
mkfs -t ext3 -c /dev/hdg1
This should format hdg1 as a ext3 partition.
5 Now we can add it to the list of mounted disks. Since it was replacing
hda1 we need to mount hdg1 as /temp (a temporary location) and copy over the
contents of whatever was mounted on hda1 (in this case /backup2) to hdg1.
Also set the fstab to automatically mount hdg1 where hda1 was the next time
the OS reboots.
So, vi /etc/fstab - replace occurences hda1 with hdg1. Save and exit
cd /
mkdir /temp
mount /dev/hdg1 /temp
cd /backup2
cp -rp * /temp
...
cd /
umount /backup2
mount /backup2 - NOTICE how this time when you do 'df' /backup2 is mounted
on /dev/hdg1
You're done.
Labels:
Command Line Tricks,
Linux Utilities,
Redhat 9.0
Making a Linux Boot CD
After doing a linux install, if you discover the system will not boot off the hardware, here is how to make a boot cd for the install:
1) put the linux disk 1 from install set in and boot computer
2) at the boot prompt, enter "linux rescue"
3) select options to search for and mount the OS partitions
4) select options to enable network interfaces
5) when you get to the shell, you need to make a boot CD. In order to make a boot CD, mkbootdisk must see the kernel in /lib/modules But in rescue mode, the everything is mounted under /mnt/sysimage... Therefore chroot to the real OS partitions. Do this by:
5a) cd /mnt/sysimage (so your shell focus is in the system partition area)
5b) chroot /mnt/sysimage (now a df to see partitions will appear as if you mount the OS partitions normally)
6) create the boot image:
6a) cd /lib/modules
6b) mkbootdisk --iso --device /myboot.iso 2.6....
NOTE: the 2.6... is the kernel, which if you are in /lib/modules you can acquire simply by hitting because there is a directory in /lib/modules which is the kernel identifier
7) move the iso to a machine with a burner, either ftp it somewhere or use mutt to email it to yourself etc
8) burn the ISO
9) test boot the server with the cd, if it works, BURN A SPARE boot cd, and place it with the server
1) put the linux disk 1 from install set in and boot computer
2) at the boot prompt, enter "linux rescue"
3) select options to search for and mount the OS partitions
4) select options to enable network interfaces
5) when you get to the shell, you need to make a boot CD. In order to make a boot CD, mkbootdisk must see the kernel in /lib/modules But in rescue mode, the everything is mounted under /mnt/sysimage... Therefore chroot to the real OS partitions. Do this by:
5a) cd /mnt/sysimage (so your shell focus is in the system partition area)
5b) chroot /mnt/sysimage (now a df to see partitions will appear as if you mount the OS partitions normally)
6) create the boot image:
6a) cd /lib/modules
6b) mkbootdisk --iso --device /myboot.iso 2.6....
NOTE: the 2.6... is the kernel, which if you are in /lib/modules you can acquire simply by hitting
7) move the iso to a machine with a burner, either ftp it somewhere or use mutt to email it to yourself etc
8) burn the ISO
9) test boot the server with the cd, if it works, BURN A SPARE boot cd, and place it with the server
Workaround for RAID Creation with mdadm when it complains that /dev/mdX device is absent
The problem seems to be that mdadm wants an entry in mdadm.conf and the create command is the one that creates the entry - so it's a chicken and egg just like you mentioned below.
Here is what I did.
I used mknod to create a buffered file called /dev/md2 and then ran the command to creat the RAID10 array and voila it SEEMS to be working as evidenced by /proc/mdstat
[root@bigone13 ~]# mdadm --create --level=raid10 /dev/md2 --raid-devices=4 --spare-devices=1 /dev/sd[bcdef]1
mdadm: error opening /dev/md2: No such file or directory
[root@bigone13 ~]# ls /dev/md2
ls: /dev/md2: No such file or directory
[root@bigone13 ~]# ls /dev/md0
/dev/md0
[root@bigone13 ~]# ls /dev/md1
/dev/md1
[root@bigone13 ~]# file /dev/md1
/dev/md1: block special (9/1)<-------
[root@bigone13 ~]# file /dev/md0
/dev/md0: block special (9/0)<-------
[root@bigone13 ~]# mknod --help
Usage: mknod [OPTION]... NAME TYPE [MAJOR MINOR] Create the special file NAME of the given TYPE. -Z, --context=CONTEXT set security context (quoted string) Mandatory arguments to long options are mandatory for short options too. -m, --mode=MODE set permission mode (as in chmod), not a=rw - umask --help display this help and exit --version output version information and exit Both MAJOR and MINOR must be specified when TYPE is b, c, or u, and they must be omitted when TYPE is p. If MAJOR or MINOR begins with 0x or 0X, it is interpreted as hexadecimal; otherwise, if it begins with 0, as octal; otherwise, as decimal. TYPE may be: b create a block (buffered) special file c, u create a character (unbuffered) special file p create a FIFO Report bugs to < bug-coreutils@gnu.org>.
[root@bigone13 ~]# mknod /dev/md2 b
mknod: missing operand after `b'
Special files require major and minor device numbers. These are the numbers in the parantheses above.
Try `mknod --help' for more information.
[root@bigone13 ~]# mknod /dev/md2 b 9 2
[root@bigone13 ~]# mdadm --create /dev/md2 --level=raid10 --raid-devices=4 --spare-devices=1 /dev/sd[bcdef]1
mdadm: array /dev/md2 started.
[root@bigone13 ~]# less /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4] [raid10]
md2 : active raid10 sdf1[4](S) sde1[3] sdd1[2] sdc1[1] sdb1[0]
286743936 blocks 64K chunks 2 near-copies [4/4] [UUUU]
[==>..................] resync = 12.2% (35209728/286743936) finish=28.6min speed=146344K/sec
Since all the component drives are set to type 0xfd Linux Raid we should be good.
Here is what I did.
I used mknod to create a buffered file called /dev/md2 and then ran the command to creat the RAID10 array and voila it SEEMS to be working as evidenced by /proc/mdstat
[root@bigone13 ~]# mdadm --create --level=raid10 /dev/md2 --raid-devices=4 --spare-devices=1 /dev/sd[bcdef]1
mdadm: error opening /dev/md2: No such file or directory
[root@bigone13 ~]# ls /dev/md2
ls: /dev/md2: No such file or directory
[root@bigone13 ~]# ls /dev/md0
/dev/md0
[root@bigone13 ~]# ls /dev/md1
/dev/md1
[root@bigone13 ~]# file /dev/md1
/dev/md1: block special (9/1)<-------
[root@bigone13 ~]# file /dev/md0
/dev/md0: block special (9/0)<-------
[root@bigone13 ~]# mknod --help
Usage: mknod [OPTION]... NAME TYPE [MAJOR MINOR] Create the special file NAME of the given TYPE. -Z, --context=CONTEXT set security context (quoted string) Mandatory arguments to long options are mandatory for short options too. -m, --mode=MODE set permission mode (as in chmod), not a=rw - umask --help display this help and exit --version output version information and exit Both MAJOR and MINOR must be specified when TYPE is b, c, or u, and they must be omitted when TYPE is p. If MAJOR or MINOR begins with 0x or 0X, it is interpreted as hexadecimal; otherwise, if it begins with 0, as octal; otherwise, as decimal. TYPE may be: b create a block (buffered) special file c, u create a character (unbuffered) special file p create a FIFO Report bugs to < bug-coreutils@gnu.org>.
[root@bigone13 ~]# mknod /dev/md2 b
mknod: missing operand after `b'
Special files require major and minor device numbers. These are the numbers in the parantheses above.
Try `mknod --help' for more information.
[root@bigone13 ~]# mknod /dev/md2 b 9 2
[root@bigone13 ~]# mdadm --create /dev/md2 --level=raid10 --raid-devices=4 --spare-devices=1 /dev/sd[bcdef]1
mdadm: array /dev/md2 started.
[root@bigone13 ~]# less /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4] [raid10]
md2 : active raid10 sdf1[4](S) sde1[3] sdd1[2] sdc1[1] sdb1[0]
286743936 blocks 64K chunks 2 near-copies [4/4] [UUUU]
[==>..................] resync = 12.2% (35209728/286743936) finish=28.6min speed=146344K/sec
Since all the component drives are set to type 0xfd Linux Raid we should be good.
Yum installation for older Linux installations
This is for certain servers that may not have yum. At the prompt:
# rpm -qa | grep python to get the python version
# rpm -qa | grep rpm to get the rpm version
.. and then click on the appropriate link on the following page to get to the download directory for the version of yum that is supported on that system.
http://linux.duke.edu/projects/yum/download.ptml
Once you're in the correct yum directory, at the prompt:
# wget url_link_for_directory_name/name_of_yum.noarch.rpm
This will download the yum rpm to the server. You can get the url link by copy and pasting from the web browser, simply type in the yum rpm name after the trailing slash.
Once downloaded you can install by running at the prompt:
# rpm -Uvh yum.version.number.rpm
Example:
So to download yum for Redhat 9, I found that it had
python 2.2 and rpm 4.2
So I clicked on the link for "yum 2.0.X - for python 2.1+ and rpm 4.1.1-4.3.1 systems: 2.0.8 latest"
Then I copied the url from the browser and added in the yum package name to get:
# wget http://linux.duke.edu/projects/yum/download/2.0/yum-2.0.8-1.noarch.rpm
...which I ran from the prompt.
Then I installed it by running
# rpm -Uvh yum-2.0.8-1.noarch.rpm
# rpm -qa | grep python to get the python version
# rpm -qa | grep rpm to get the rpm version
.. and then click on the appropriate link on the following page to get to the download directory for the version of yum that is supported on that system.
http://linux.duke.edu/projects/yum/download.ptml
Once you're in the correct yum directory, at the prompt:
# wget url_link_for_directory_name/name_of_yum.noarch.rpm
This will download the yum rpm to the server. You can get the url link by copy and pasting from the web browser, simply type in the yum rpm name after the trailing slash.
Once downloaded you can install by running at the prompt:
# rpm -Uvh yum.version.number.rpm
Example:
So to download yum for Redhat 9, I found that it had
python 2.2 and rpm 4.2
So I clicked on the link for "yum 2.0.X - for python 2.1+ and rpm 4.1.1-4.3.1 systems: 2.0.8 latest"
Then I copied the url from the browser and added in the yum package name to get:
# wget http://linux.duke.edu/projects/yum/download/2.0/yum-2.0.8-1.noarch.rpm
...which I ran from the prompt.
Then I installed it by running
# rpm -Uvh yum-2.0.8-1.noarch.rpm
Fix for Recurrent Macromedia Flash Message
Windows 2000/XP installations will sometimes keep popping up a "Unable to find the Macromedia Flash" Error Window every 15 minutes.
This is despite Flash being installed. This is not a side effect of some spyware. Occasionally it is a side effect of a newer screen saver being installed.
The fix is here:
http://kb.adobe.com/selfservice/viewContent.do?externalId=kb402694&sliceId=1
In essence, Go to C:\WINNT\System32\Macromed\Flash.
Copy FlashX.ocx (usually Flash9d or Flash9e) and rename the copy as Flash.ocx (without the number)
Fixing drives that disappear from RAID arrays on Linux
If you notice that on running cat /proc/mdstat:
some of the component drives are missing:
[root@gghbkup ~]# cat /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4] [raid0]
md0 : active raid0 hdb1[2] hde1[0] hdf1[1]
396409728 blocks 64k chunks
md1 : active raid1 sdb1[1] sda1[0]
104320 blocks [2/2] [UU]
md2 : active raid1 sda3[2] sdb3[1]
17406336 blocks [2/1] [_U]
Like in this case /dev/sda3 on /dev/md2, Here's what can be done:
First try re-adding it:
mdadm /dev/md2 --add /dev/sda3
If this does not work on account of a device not ready/device busy error
Then reboot the system, see if it comes back up.
Then, try fdisk /dev/sda to see if the drive is responding (use 'p' to print out the device table)
(Chances are it will still respond as evidenced by the non-failure of /dev/sda1 in /dev/md1)
If fdisk does not work, chances are the drive is dead, try replacing.
Otherwise run fsck /dev/sda3
It will check and fix any errors (or simply just bring it back up).
Then you can re-add it as shown above:
And then cat /proc/mdstat will show:
[root@gghbkup ~]# cat /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4] [raid0]
md0 : active raid0 hdb1[2] hde1[0] hdf1[1]
396409728 blocks 64k chunks
md1 : active raid1 sdb1[1] sda1[0]
104320 blocks [2/2] [UU]
md2 : active raid1 sda3[2] sdb3[1]
17406336 blocks [2/1] [_U]
[=======>.............] recovery = 38.1% (6636096/17406336) finish=21.0min speed=8532K/sec
unused devices:
And you're done.
some of the component drives are missing:
[root@gghbkup ~]# cat /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4] [raid0]
md0 : active raid0 hdb1[2] hde1[0] hdf1[1]
396409728 blocks 64k chunks
md1 : active raid1 sdb1[1] sda1[0]
104320 blocks [2/2] [UU]
md2 : active raid1 sda3[2] sdb3[1]
17406336 blocks [2/1] [_U]
Like in this case /dev/sda3 on /dev/md2, Here's what can be done:
First try re-adding it:
mdadm /dev/md2 --add /dev/sda3
If this does not work on account of a device not ready/device busy error
Then reboot the system, see if it comes back up.
Then, try fdisk /dev/sda to see if the drive is responding (use 'p' to print out the device table)
(Chances are it will still respond as evidenced by the non-failure of /dev/sda1 in /dev/md1)
If fdisk does not work, chances are the drive is dead, try replacing.
Otherwise run fsck /dev/sda3
It will check and fix any errors (or simply just bring it back up).
Then you can re-add it as shown above:
And then cat /proc/mdstat will show:
[root@gghbkup ~]# cat /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4] [raid0]
md0 : active raid0 hdb1[2] hde1[0] hdf1[1]
396409728 blocks 64k chunks
md1 : active raid1 sdb1[1] sda1[0]
104320 blocks [2/2] [UU]
md2 : active raid1 sda3[2] sdb3[1]
17406336 blocks [2/1] [_U]
[=======>.............] recovery = 38.1% (6636096/17406336) finish=21.0min speed=8532K/sec
unused devices:
And you're done.
Labels:
Command Line Tricks,
Linux Disk Drives,
RAID
Recovering PST file > 2GB
As we all know, Outlook cannot open a PST file once it's larger than 2GB (or 1.98 GB to be exact)
Normally, when this happens, unless people have saved a recent copy of the current pst file, they would lose the contacts, calendar and emails in that pst.
There is a solution to this:
There is a Microsoft 2GB PST repair/truncate tool called PST2GB.exe that fixes this problem by truncating a portion of the oversize PST file. How much it truncates is user defined and can be set when the tool runs its wizard. It simply deletes emails from the PST file starting with the most recent till it has truncated it to an allowable size.
This allows people to recover the PST file without losing all their emails, contacts, etc, etc.
Normally, when this happens, unless people have saved a recent copy of the current pst file, they would lose the contacts, calendar and emails in that pst.
There is a solution to this:
There is a Microsoft 2GB PST repair/truncate tool called PST2GB.exe that fixes this problem by truncating a portion of the oversize PST file. How much it truncates is user defined and can be set when the tool runs its wizard. It simply deletes emails from the PST file starting with the most recent till it has truncated it to an allowable size.
This allows people to recover the PST file without losing all their emails, contacts, etc, etc.
Manual Vacation Message Setup
EVERYONE should use webmail for controlling their vacation messaging.
Sometimes on account of user laziness, lack of planning or plain obstinacy, manual vacation setup becomes necessary.
In this case,
Become root on the appropriate mailserver:
Go to /home/username
Modify the .procmailrc_holiday file
Add the correct atq commands as follows:
at "Date and Time for vacation message to start"
/root/bin/vac_on
CTRL-D
at "Date and Time for vacation message to stop"
/root/bin/vac_off
CTRL-D
Sometimes on account of user laziness, lack of planning or plain obstinacy, manual vacation setup becomes necessary.
In this case,
Become root on the appropriate mailserver:
Go to /home/username
Modify the .procmailrc_holiday file
Add the correct atq commands as follows:
at "Date and Time for vacation message to start"
/root/bin/vac_on
CTRL-D
at "Date and Time for vacation message to stop"
/root/bin/vac_off
CTRL-D
Attaching files from command line in Linux
One needs to have the linux utilities uuencode and uudecode installed.
uuencode/uudecode are in the sharutils package, which may not be installed by default.
[root@gghbkup source_disks]# find ./* -name "sharutil*"
./disk5/Fedora/RPMS/sharutils-4.6.1-2.i386.rpm
[root@gghbkup source_disks]# cd disk5/Fedora/RPMS/
[root@gghbkup RPMS]# rpm -Uvh sharutils-4.6.1-2.i386.rpm
Preparing... ########################################### [100%]
1:sharutils ########################################### [100%]
[root@gghbkup RPMS]# which uuencode
/usr/bin/uuencode
[root@gghbkup RPMS]# which uudecode
/usr/bin/uudecode
Say you want to attach test.iso to an email to yourself:
uuencode test_attachment test.iso > testattach.uu
echo "This is the email body" > mail.body
cat mail.body testattach.uu | mail -s "test email" temp@tempemailaccount.com
And it comes through an email with test.iso attached. Works with Tbird and Outlook.
uuencode/uudecode are in the sharutils package, which may not be installed by default.
[root@gghbkup source_disks]# find ./* -name "sharutil*"
./disk5/Fedora/RPMS/sharutils-4.6.1-2.i386.rpm
[root@gghbkup source_disks]# cd disk5/Fedora/RPMS/
[root@gghbkup RPMS]# rpm -Uvh sharutils-4.6.1-2.i386.rpm
Preparing... ########################################### [100%]
1:sharutils ########################################### [100%]
[root@gghbkup RPMS]# which uuencode
/usr/bin/uuencode
[root@gghbkup RPMS]# which uudecode
/usr/bin/uudecode
Say you want to attach test.iso to an email to yourself:
uuencode test_attachment test.iso > testattach.uu
echo "This is the email body" > mail.body
cat mail.body testattach.uu | mail -s "test email" temp@tempemailaccount.com
And it comes through an email with test.iso attached. Works with Tbird and Outlook.
Standard ifcfg syntax
Standard syntax (non-exhaustive) for an ifcfg-ethX file located in /etc/sysconfig/network-scripts
# nVidia Corporation MCP61 Ethernet
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:1A:4D:74:63:26
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=10.249.100.20
GATEWAY=10.249.100.20
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
# nVidia Corporation MCP61 Ethernet
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:1A:4D:74:63:26
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=10.249.100.20
GATEWAY=10.249.100.20
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
Adding Raid and Swap Partitions on RedHat 9.0
This applies to Redhat 9.0, I cannot confirm that it applies to Redhat 9.0- but it may. All the same it is a good starting point for RAID configuration troubleshooting on Redhat archs.
Note on Disk Drive Support:
If adding a new physical hard disk, ensure that you either use a standard type of drive, like IDE or a drive that is of the same type as a drive that already exists in the installation.
RH does not recognize SATA or certain types of EIDE.
RH may need additional drivers for special types of SCSI drives.
Adding additional drivers to the boot loader and kernel is non-trivial, try to avoid at all costs. Simply have a look at the machine and either add a drive of the same type or add a standard IDE drive.
If adding SCSI drives ensure the pins on the SCSI chip are such that:
The drive is detected as the last drive in a SCSI chain (if an additional drive)
The drive is detected in the same place/order as the SCSI drive it is replacing (if a replacement drive)
Adding a RAID partition:
Once the drive is in place, see if it is detected at boot time. If not, perhaps it is either:
not plugged in properly - check pin jumper settings for both SCSI and IDE drives
not supported - try a different (type of) drive.
Once the drive is detected, see where it shows up in /dev
SCSI drives are normally /dev/sdX where X is the letter of the drive in the order it shows up on the SCSI chain. /dev/sda is the first one
IDE drives are normally /dev/hdX where X is a-f depending on the IDE controller and whether it is Master or Slave. Normally Masters are hd[ace]. Slaves are hd[bdf].
Let's assume that we added a supported SCSI disk and it was detected as /dev/sda.
Partition the drive using fdisk:
#cd /dev
#fdisk sde
Create a new partition on it:
Command (m for help): p
Disk sda: 36.7 GB, 36748945408 bytes
255 heads, 63 sectors/track, 4467 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
sda1 1 128 1028128+ 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (129-4467, default 129):
Using default value 129
Last cylinder or +size or +sizeM or +sizeK (129-4467, default 4467):
Using default value 4467
Change the partition type if necessary:
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): L
0 Empty 1c Hidden Win95 FA 70 DiskSecure Mult bb Boot Wizard hid
1 FAT12 1e Hidden Win95 FA 75 PC/IX be Solaris boot
2 XENIX root 24 NEC DOS 80 Old Minix c1 DRDOS/sec (FAT-
3 XENIX usr 39 Plan 9 81 Minix / old Lin c4 DRDOS/sec (FAT-
4 FAT16 <32m>
5 Extended 40 Venix 80286 83 Linux c7 Syrinx
6 FAT16 41 PPC PReP Boot 84 OS/2 hidden C: da Non-FS data
7 HPFS/NTFS 42 SFS 85 Linux extended db CP/M / CTOS / .
8 AIX 4d QNX4.x 86 NTFS volume set de Dell Utility
9 AIX bootable 4e QNX4.x 2nd part 87 NTFS volume set df BootIt
a OS/2 Boot Manag 4f QNX4.x 3rd part 8e Linux LVM e1 DOS access
b Win95 FAT32 50 OnTrack DM 93 Amoeba e3 DOS R/O
c Win95 FAT32 (LB 51 OnTrack DM6 Aux 94 Amoeba BBT e4 SpeedStor
e Win95 FAT16 (LB 52 CP/M 9f BSD/OS eb BeOS fs
f Win95 Ext'd (LB 53 OnTrack DM6 Aux a0 IBM Thinkpad hi ee EFI GPT
10 OPUS 54 OnTrackDM6 a5 FreeBSD ef EFI (FAT-12/16/
11 Hidden FAT12 55 EZ-Drive a6 OpenBSD f0 Linux/PA-RISC b
12 Compaq diagnost 56 Golden Bow a7 NeXTSTEP f1 SpeedStor
14 Hidden FAT16 <3>
16 Hidden FAT16 61 SpeedStor a9 NetBSD f2 DOS secondary
17 Hidden HPFS/NTF 63 GNU HURD or Sys ab Darwin boot fd Linux raid auto
18 AST SmartSleep 64 Novell Netware b7 BSDI fs fe LANstep
1b Hidden Win95 FA 65 Novell Netware b8 BSDI swap ff BBT
Hex code (type L to list codes): fd
Command (m for help): p
Disk sda: 36.7 GB, 36748945408 bytes
255 heads, 63 sectors/track, 4467 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
sda1 1 128 1028128+ 83 Linux
sda2 129 4467 34853017+ fd Linux
Save the partition:
Command (m for help): w
Writing table to disk..
Create a new RAID parition:
#mdadm --create /dev/mdX --level= --raid-devices= --spare-devices= /dev/[hs]dX /dev/[hs]dY
Look at manpage for mdadm for more details.
Verify the new RAID device:
# cat /proc/mdstat
Personalities : [raid1] [raid5]
read_ahead 1024 sectors
md2 : active raid1 sde1[1] sda1[0]
1028032 blocks [2/2] [UU]
md0 : active raid5 sdd1[2] sdc1[1] sdb1[0]
143636864 blocks level 5, 64k chunk, algorithm 0 [3/3] [UUU]
unused devices:
Format the new partition:
mkfs -t -c /dev/mdX
Save the data located on the mount_point:
If the mount point is located on device(s) that make up the new RAID device, then copy over the contents of the entire mount_point elsewhere*
If the mount point is located on device(s) that do not make up the new RAID device, nothing needs to be done.
If you are about to mount a new mount_point then nothing needs to be done.
Unmount the mount point if necessary:
umount /mount_point
Remount the mount point:
mount /dev/mdX /mount_point
If the mount point was located on device(s) that now make up the new RAID device, then copy over the contents of the entire mount_point that were copied over elsewhere*
Verify the mount:
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/md0 141382888 24337024 109864024 19% /
/dev/md2 1011864 21748 938716 3% /boot
none 1804184 0 1804184 0% /dev/shm
10.243.102.3:/var/www/html/ca
141267544 60599344 73492000 46% /var/www/html/ca
Modify /etc/fstab:
Change the entry for this mount_point in /etc/fstab or add a new entry for it
/dev/md2 /boot ext2 defaults 1 2
Add the new RAID device into /etc/raidtab:
This is very important as in RH, creating a raid device does not add it to /etc/raidtab. /etc/raidtab is where RH installations look for and register raid devices from.
Edit /etc/raidtab and add the following lines at the end depending on the type of raid device you created:
raiddev /dev/md2
raid-level 1
nr-raid-disks 2
chunk-size 64k
persistent-superblock 1
nr-spare-disks 0
device /dev/sda1
raid-disk 0
device /dev/sde1
raid-disk 1
Save the file.
Verify that /etc/fstab has the mount_point mounted on the new RAID device, check that the mount_point has the necessary data in it and reboot.
--------------
Adding a SWAP device:
Add the disk drive.
Use fdisk to create the swap partitions:
fdisk
Format them as swap partitions:
mkswap
Start them:
Either add them to fstab and reboot.
or start them from the command line:
swapon
or add them to fstab and start them all at once:
swapon -a
Note on Disk Drive Support:
If adding a new physical hard disk, ensure that you either use a standard type of drive, like IDE or a drive that is of the same type as a drive that already exists in the installation.
RH does not recognize SATA or certain types of EIDE.
RH may need additional drivers for special types of SCSI drives.
Adding additional drivers to the boot loader and kernel is non-trivial, try to avoid at all costs. Simply have a look at the machine and either add a drive of the same type or add a standard IDE drive.
If adding SCSI drives ensure the pins on the SCSI chip are such that:
The drive is detected as the last drive in a SCSI chain (if an additional drive)
The drive is detected in the same place/order as the SCSI drive it is replacing (if a replacement drive)
Adding a RAID partition:
Once the drive is in place, see if it is detected at boot time. If not, perhaps it is either:
not plugged in properly - check pin jumper settings for both SCSI and IDE drives
not supported - try a different (type of) drive.
Once the drive is detected, see where it shows up in /dev
SCSI drives are normally /dev/sdX where X is the letter of the drive in the order it shows up on the SCSI chain. /dev/sda is the first one
IDE drives are normally /dev/hdX where X is a-f depending on the IDE controller and whether it is Master or Slave. Normally Masters are hd[ace]. Slaves are hd[bdf].
Let's assume that we added a supported SCSI disk and it was detected as /dev/sda.
Partition the drive using fdisk:
#cd /dev
#fdisk sde
Create a new partition on it:
Command (m for help): p
Disk sda: 36.7 GB, 36748945408 bytes
255 heads, 63 sectors/track, 4467 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
sda1 1 128 1028128+ 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (129-4467, default 129):
Using default value 129
Last cylinder or +size or +sizeM or +sizeK (129-4467, default 4467):
Using default value 4467
Change the partition type if necessary:
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): L
0 Empty 1c Hidden Win95 FA 70 DiskSecure Mult bb Boot Wizard hid
1 FAT12 1e Hidden Win95 FA 75 PC/IX be Solaris boot
2 XENIX root 24 NEC DOS 80 Old Minix c1 DRDOS/sec (FAT-
3 XENIX usr 39 Plan 9 81 Minix / old Lin c4 DRDOS/sec (FAT-
4 FAT16 <32m>
5 Extended 40 Venix 80286 83 Linux c7 Syrinx
6 FAT16 41 PPC PReP Boot 84 OS/2 hidden C: da Non-FS data
7 HPFS/NTFS 42 SFS 85 Linux extended db CP/M / CTOS / .
8 AIX 4d QNX4.x 86 NTFS volume set de Dell Utility
9 AIX bootable 4e QNX4.x 2nd part 87 NTFS volume set df BootIt
a OS/2 Boot Manag 4f QNX4.x 3rd part 8e Linux LVM e1 DOS access
b Win95 FAT32 50 OnTrack DM 93 Amoeba e3 DOS R/O
c Win95 FAT32 (LB 51 OnTrack DM6 Aux 94 Amoeba BBT e4 SpeedStor
e Win95 FAT16 (LB 52 CP/M 9f BSD/OS eb BeOS fs
f Win95 Ext'd (LB 53 OnTrack DM6 Aux a0 IBM Thinkpad hi ee EFI GPT
10 OPUS 54 OnTrackDM6 a5 FreeBSD ef EFI (FAT-12/16/
11 Hidden FAT12 55 EZ-Drive a6 OpenBSD f0 Linux/PA-RISC b
12 Compaq diagnost 56 Golden Bow a7 NeXTSTEP f1 SpeedStor
14 Hidden FAT16 <3>
16 Hidden FAT16 61 SpeedStor a9 NetBSD f2 DOS secondary
17 Hidden HPFS/NTF 63 GNU HURD or Sys ab Darwin boot fd Linux raid auto
18 AST SmartSleep 64 Novell Netware b7 BSDI fs fe LANstep
1b Hidden Win95 FA 65 Novell Netware b8 BSDI swap ff BBT
Hex code (type L to list codes): fd
Command (m for help): p
Disk sda: 36.7 GB, 36748945408 bytes
255 heads, 63 sectors/track, 4467 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
sda1 1 128 1028128+ 83 Linux
sda2 129 4467 34853017+ fd Linux
Save the partition:
Command (m for help): w
Writing table to disk..
Create a new RAID parition:
#mdadm --create /dev/mdX --level=
Look at manpage for mdadm for more details.
Verify the new RAID device:
# cat /proc/mdstat
Personalities : [raid1] [raid5]
read_ahead 1024 sectors
md2 : active raid1 sde1[1] sda1[0]
1028032 blocks [2/2] [UU]
md0 : active raid5 sdd1[2] sdc1[1] sdb1[0]
143636864 blocks level 5, 64k chunk, algorithm 0 [3/3] [UUU]
unused devices:
Format the new partition:
mkfs -t
Save the data located on the mount_point:
If the mount point is located on device(s) that make up the new RAID device, then copy over the contents of the entire mount_point elsewhere*
If the mount point is located on device(s) that do not make up the new RAID device, nothing needs to be done.
If you are about to mount a new mount_point then nothing needs to be done.
Unmount the mount point if necessary:
umount /mount_point
Remount the mount point:
mount /dev/mdX /mount_point
If the mount point was located on device(s) that now make up the new RAID device, then copy over the contents of the entire mount_point that were copied over elsewhere*
Verify the mount:
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/md0 141382888 24337024 109864024 19% /
/dev/md2 1011864 21748 938716 3% /boot
none 1804184 0 1804184 0% /dev/shm
10.243.102.3:/var/www/html/ca
141267544 60599344 73492000 46% /var/www/html/ca
Modify /etc/fstab:
Change the entry for this mount_point in /etc/fstab or add a new entry for it
/dev/md2 /boot ext2 defaults 1 2
Add the new RAID device into /etc/raidtab:
This is very important as in RH, creating a raid device does not add it to /etc/raidtab. /etc/raidtab is where RH installations look for and register raid devices from.
Edit /etc/raidtab and add the following lines at the end depending on the type of raid device you created:
raiddev /dev/md2
raid-level 1
nr-raid-disks 2
chunk-size 64k
persistent-superblock 1
nr-spare-disks 0
device /dev/sda1
raid-disk 0
device /dev/sde1
raid-disk 1
Save the file.
Verify that /etc/fstab has the mount_point mounted on the new RAID device, check that the mount_point has the necessary data in it and reboot.
--------------
Adding a SWAP device:
Add the disk drive.
Use fdisk to create the swap partitions:
fdisk
Format them as swap partitions:
mkswap
Start them:
Either add them to fstab and reboot.
or start them from the command line:
swapon
or add them to fstab and start them all at once:
swapon -a
Subscribe to:
Posts (Atom)