Archive for category centos

Linux Important System Files

File Purpose Where to Find More Information
User and Security Files
/etc/group User group information group, chmod
/etc/npasswd npasswd configuration file npasswd
/etc/shadow shadow password file password, npasswd
/etc/passwd User account information password, chmod
Networking Files
/etc/bootptab Internet Bootstrap Protocol server database bootptab
/etc/exports Directories to export to NFS clients exports
/etc/gateways List of gateways routed
/etc/hosts Hostname to IP address mapping file route
/etc/hosts.equiv Lists of trusted hosts and remote users hosts.equiv
/etc/inetd.conf inetd configuration file inetd
/etc/named.conf named default initialization file named
/etc/networks Known networks route
/usr/lib/named or/etc/named.d named configuration files named
/etc/smb.conf or /etc/samba/smb.conf SAMBA configuration file smb.conf
/etc/snmpd.conf SNMP daemon configuration file snmpd.conf
/etc/ftpaccess FTP configuration file ftpaccess
/etc/httpd/access.conf HTTP access configuration file
/etc/httpd/httpd.conf HTTP daemon configuration file
/etc/httpd/srm.conf HTTP server resource management configuration file
/etc/services Network services list services(5)
X-Windows Files
/etc/XF86Config or /etc/X11/XF86Config X-Server configuration file XF86Config, xf86config
/etc/X11/xinit/xinitrc xinit configuration file xinit
$HOME/.xinitrc User-specific xinit configuration file xinit
$HOME/.fvwmrc fvwm configuration file fvwm, X
/usr/lib/X11/system.fvwmrc System default MWM configuration file fvwm, X
/usr/lib/X11/app-defaults Application-specific defaults X
$HOME/.Xdefaults-hostname Host-specific defaults X
System Start-Up Files
/etc/inittab init configuration file inittab
/etc/lilo.conf Lilo configuration file lilo.conf, lilo
/etc/rc* System start-up scripts init, initscript
System Log Files
/etc/syslog.conf System login configuration file syslog.conf
/var/log/message General system log file syslogd
Miscellaneous Files
/etc/profile
/etc/bashrc
/etc/cshrc
Systemwide shell configuration files man-page for respective shell
$HOME/.bashrc
$HOME/.chsrc
$HOME/.kshrc
User-specifc shell configuration files man-page for respective shell
/etc/sysconfig Miscellaneous configuration files

Leave a comment

FTP Bash script for auto file transfer and backup

#!/bin/bash

ftp_site=ftp://yoursite.com
username=roger
passwd=abc123
backupdir=$HOME
filename="backup-$(date '+%F-%H%M').tar.gz"

echo "Creating a backup file $filename of $backupdir."

# Make a tar gzipped backup file
tar -cvzf  "$filename" "$backupdir"

ftp -in <<EOF
open $ftp_site
user $username $passwd
bin
put $filename 
close 
bye
EOF

Leave a comment

configure Kdump in centos (to recover data)

1	================================================================
2	Documentation for Kdump - The kexec-based Crash Dumping Solution
3	================================================================
4	
5	This document includes overview, setup and installation, and analysis
6	information.
7	
8	Overview
9	========
10	
11	Kdump uses kexec to quickly boot to a dump-capture kernel whenever a
12	dump of the system kernel's memory needs to be taken (for example, when
13	the system panics). The system kernel's memory image is preserved across
14	the reboot and is accessible to the dump-capture kernel.
15	
16	You can use common commands, such as cp and scp, to copy the
17	memory image to a dump file on the local disk, or across the network to
18	a remote system.
19	
20	Kdump and kexec are currently supported on the x86, x86_64, ppc64, ia64,
21	and s390x architectures.
22	
23	When the system kernel boots, it reserves a small section of memory for
24	the dump-capture kernel. This ensures that ongoing Direct Memory Access
25	(DMA) from the system kernel does not corrupt the dump-capture kernel.
26	The kexec -p command loads the dump-capture kernel into this reserved
27	memory.
28	
29	On x86 machines, the first 640 KB of physical memory is needed to boot,
30	regardless of where the kernel loads. Therefore, kexec backs up this
31	region just before rebooting into the dump-capture kernel.
32	
33	Similarly on PPC64 machines first 32KB of physical memory is needed for
34	booting regardless of where the kernel is loaded and to support 64K page
35	size kexec backs up the first 64KB memory.
36	
37	For s390x, when kdump is triggered, the crashkernel region is exchanged
38	with the region [0, crashkernel region size] and then the kdump kernel
39	runs in [0, crashkernel region size]. Therefore no relocatable kernel is
40	needed for s390x.
41	
42	All of the necessary information about the system kernel's core image is
43	encoded in the ELF format, and stored in a reserved area of memory
44	before a crash. The physical address of the start of the ELF header is
45	passed to the dump-capture kernel through the elfcorehdr= boot
46	parameter. Optionally the size of the ELF header can also be passed
47	when using the elfcorehdr=[size[KMG]@]offset[KMG] syntax.
48	
49	
50	With the dump-capture kernel, you can access the memory image, or "old
51	memory," in two ways:
52	
53	- Through a /dev/oldmem device interface. A capture utility can read the
54	  device file and write out the memory in raw format. This is a raw dump
55	  of memory. Analysis and capture tools must be intelligent enough to
56	  determine where to look for the right information.
57	
58	- Through /proc/vmcore. This exports the dump as an ELF-format file that
59	  you can write out using file copy commands such as cp or scp. Further,
60	  you can use analysis tools such as the GNU Debugger (GDB) and the Crash
61	  tool to debug the dump file. This method ensures that the dump pages are
62	  correctly ordered.
63	
64	
65	Setup and Installation
66	======================
67	
68	Install kexec-tools
69	-------------------
70	
71	1) Login as the root user.
72	
73	2) Download the kexec-tools user-space package from the following URL:
74	
75	http://kernel.org/pub/linux/utils/kernel/kexec/kexec-tools.tar.gz
76	
77	This is a symlink to the latest version.
78	
79	The latest kexec-tools git tree is available at:
80	
81	git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
82	and
83	http://www.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
84	
85	There is also a gitweb interface available at
86	http://www.kernel.org/git/?p=utils/kernel/kexec/kexec-tools.git
87	
88	More information about kexec-tools can be found at
89	http://www.kernel.org/pub/linux/utils/kernel/kexec/README.html
90	
91	3) Unpack the tarball with the tar command, as follows:
92	
93	   tar xvpzf kexec-tools.tar.gz
94	
95	4) Change to the kexec-tools directory, as follows:
96	
97	   cd kexec-tools-VERSION
98	
99	5) Configure the package, as follows:
100	
101	   ./configure
102	
103	6) Compile the package, as follows:
104	
105	   make
106	
107	7) Install the package, as follows:
108	
109	   make install
110	
111	
112	Build the system and dump-capture kernels
113	-----------------------------------------
114	There are two possible methods of using Kdump.
115	
116	1) Build a separate custom dump-capture kernel for capturing the
117	   kernel core dump.
118	
119	2) Or use the system kernel binary itself as dump-capture kernel and there is
120	   no need to build a separate dump-capture kernel. This is possible
121	   only with the architectures which support a relocatable kernel. As
122	   of today, i386, x86_64, ppc64 and ia64 architectures support relocatable
123	   kernel.
124	
125	Building a relocatable kernel is advantageous from the point of view that
126	one does not have to build a second kernel for capturing the dump. But
127	at the same time one might want to build a custom dump capture kernel
128	suitable to his needs.
129	
130	Following are the configuration setting required for system and
131	dump-capture kernels for enabling kdump support.
132	
133	System kernel config options
134	----------------------------
135	
136	1) Enable "kexec system call" in "Processor type and features."
137	
138	   CONFIG_KEXEC=y
139	
140	2) Enable "sysfs file system support" in "Filesystem" -> "Pseudo
141	   filesystems." This is usually enabled by default.
142	
143	   CONFIG_SYSFS=y
144	
145	   Note that "sysfs file system support" might not appear in the "Pseudo
146	   filesystems" menu if "Configure standard kernel features (for small
147	   systems)" is not enabled in "General Setup." In this case, check the
148	   .config file itself to ensure that sysfs is turned on, as follows:
149	
150	   grep 'CONFIG_SYSFS' .config
151	
152	3) Enable "Compile the kernel with debug info" in "Kernel hacking."
153	
154	   CONFIG_DEBUG_INFO=Y
155	
156	   This causes the kernel to be built with debug symbols. The dump
157	   analysis tools require a vmlinux with debug symbols in order to read
158	   and analyze a dump file.
159	
160	Dump-capture kernel config options (Arch Independent)
161	-----------------------------------------------------
162	
163	1) Enable "kernel crash dumps" support under "Processor type and
164	   features":
165	
166	   CONFIG_CRASH_DUMP=y
167	
168	2) Enable "/proc/vmcore support" under "Filesystems" -> "Pseudo filesystems".
169	
170	   CONFIG_PROC_VMCORE=y
171	   (CONFIG_PROC_VMCORE is set by default when CONFIG_CRASH_DUMP is selected.)
172	
173	Dump-capture kernel config options (Arch Dependent, i386 and x86_64)
174	--------------------------------------------------------------------
175	
176	1) On i386, enable high memory support under "Processor type and
177	   features":
178	
179	   CONFIG_HIGHMEM64G=y
180	   or
181	   CONFIG_HIGHMEM4G
182	
183	2) On i386 and x86_64, disable symmetric multi-processing support
184	   under "Processor type and features":
185	
186	   CONFIG_SMP=n
187	
188	   (If CONFIG_SMP=y, then specify maxcpus=1 on the kernel command line
189	   when loading the dump-capture kernel, see section "Load the Dump-capture
190	   Kernel".)
191	
192	3) If one wants to build and use a relocatable kernel,
193	   Enable "Build a relocatable kernel" support under "Processor type and
194	   features"
195	
196	   CONFIG_RELOCATABLE=y
197	
198	4) Use a suitable value for "Physical address where the kernel is
199	   loaded" (under "Processor type and features"). This only appears when
200	   "kernel crash dumps" is enabled. A suitable value depends upon
201	   whether kernel is relocatable or not.
202	
203	   If you are using a relocatable kernel use CONFIG_PHYSICAL_START=0x100000
204	   This will compile the kernel for physical address 1MB, but given the fact
205	   kernel is relocatable, it can be run from any physical address hence
206	   kexec boot loader will load it in memory region reserved for dump-capture
207	   kernel.
208	
209	   Otherwise it should be the start of memory region reserved for
210	   second kernel using boot parameter "crashkernel=Y@X". Here X is
211	   start of memory region reserved for dump-capture kernel.
212	   Generally X is 16MB (0x1000000). So you can set
213	   CONFIG_PHYSICAL_START=0x1000000
214	
215	5) Make and install the kernel and its modules. DO NOT add this kernel
216	   to the boot loader configuration files.
217	
218	Dump-capture kernel config options (Arch Dependent, ppc64)
219	----------------------------------------------------------
220	
221	1) Enable "Build a kdump crash kernel" support under "Kernel" options:
222	
223	   CONFIG_CRASH_DUMP=y
224	
225	2)   Enable "Build a relocatable kernel" support
226	
227	   CONFIG_RELOCATABLE=y
228	
229	   Make and install the kernel and its modules.
230	
231	Dump-capture kernel config options (Arch Dependent, ia64)
232	----------------------------------------------------------
233	
234	- No specific options are required to create a dump-capture kernel
235	  for ia64, other than those specified in the arch independent section
236	  above. This means that it is possible to use the system kernel
237	  as a dump-capture kernel if desired.
238	
239	  The crashkernel region can be automatically placed by the system
240	  kernel at run time. This is done by specifying the base address as 0,
241	  or omitting it all together.
242	
243	  crashkernel=256M@0
244	  or
245	  crashkernel=256M
246	
247	  If the start address is specified, note that the start address of the
248	  kernel will be aligned to 64Mb, so if the start address is not then
249	  any space below the alignment point will be wasted.
250	
251	
252	Extended crashkernel syntax
253	===========================
254	
255	While the "crashkernel=size[@offset]" syntax is sufficient for most
256	configurations, sometimes it's handy to have the reserved memory dependent
257	on the value of System RAM -- that's mostly for distributors that pre-setup
258	the kernel command line to avoid a unbootable system after some memory has
259	been removed from the machine.
260	
261	The syntax is:
262	
263	    crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset]
264	    range=start-[end]
265	
266	    'start' is inclusive and 'end' is exclusive.
267	
268	For example:
269	
270	    crashkernel=512M-2G:64M,2G-:128M
271	
272	This would mean:
273	
274	    1) if the RAM is smaller than 512M, then don't reserve anything
275	       (this is the "rescue" case)
276	    2) if the RAM size is between 512M and 2G (exclusive), then reserve 64M
277	    3) if the RAM size is larger than 2G, then reserve 128M
278	
279	
280	
281	Boot into System Kernel
282	=======================
283	
284	1) Update the boot loader (such as grub, yaboot, or lilo) configuration
285	   files as necessary.
286	
287	2) Boot the system kernel with the boot parameter "crashkernel=Y@X",
288	   where Y specifies how much memory to reserve for the dump-capture kernel
289	   and X specifies the beginning of this reserved memory. For example,
290	   "crashkernel=64M@16M" tells the system kernel to reserve 64 MB of memory
291	   starting at physical address 0x01000000 (16MB) for the dump-capture kernel.
292	
293	   On x86 and x86_64, use "crashkernel=64M@16M".
294	
295	   On ppc64, use "crashkernel=128M@32M".
296	
297	   On ia64, 256M@256M is a generous value that typically works.
298	   The region may be automatically placed on ia64, see the
299	   dump-capture kernel config option notes above.
300	
301	   On s390x, typically use "crashkernel=xxM". The value of xx is dependent
302	   on the memory consumption of the kdump system. In general this is not
303	   dependent on the memory size of the production system.
304	
305	Load the Dump-capture Kernel
306	============================
307	
308	After booting to the system kernel, dump-capture kernel needs to be
309	loaded.
310	
311	Based on the architecture and type of image (relocatable or not), one
312	can choose to load the uncompressed vmlinux or compressed bzImage/vmlinuz
313	of dump-capture kernel. Following is the summary.
314	
315	For i386 and x86_64:
316		- Use vmlinux if kernel is not relocatable.
317		- Use bzImage/vmlinuz if kernel is relocatable.
318	For ppc64:
319		- Use vmlinux
320	For ia64:
321		- Use vmlinux or vmlinuz.gz
322	For s390x:
323		- Use image or bzImage
324	
325	
326	If you are using a uncompressed vmlinux image then use following command
327	to load dump-capture kernel.
328	
329	   kexec -p <dump-capture-kernel-vmlinux-image> \
330	   --initrd=<initrd-for-dump-capture-kernel> --args-linux \
331	   --append="root=<root-dev> <arch-specific-options>"
332	
333	If you are using a compressed bzImage/vmlinuz, then use following command
334	to load dump-capture kernel.
335	
336	   kexec -p <dump-capture-kernel-bzImage> \
337	   --initrd=<initrd-for-dump-capture-kernel> \
338	   --append="root=<root-dev> <arch-specific-options>"
339	
340	Please note, that --args-linux does not need to be specified for ia64.
341	It is planned to make this a no-op on that architecture, but for now
342	it should be omitted
343	
344	Following are the arch specific command line options to be used while
345	loading dump-capture kernel.
346	
347	For i386, x86_64 and ia64:
348		"1 irqpoll maxcpus=1 reset_devices"
349	
350	For ppc64:
351		"1 maxcpus=1 noirqdistrib reset_devices"
352	
353	For s390x:
354		"1 maxcpus=1 cgroup_disable=memory"
355	
356	Notes on loading the dump-capture kernel:
357	
358	* By default, the ELF headers are stored in ELF64 format to support
359	  systems with more than 4GB memory. On i386, kexec automatically checks if
360	  the physical RAM size exceeds the 4 GB limit and if not, uses ELF32.
361	  So, on non-PAE systems, ELF32 is always used.
362	
363	  The --elf32-core-headers option can be used to force the generation of ELF32
364	  headers. This is necessary because GDB currently cannot open vmcore files
365	  with ELF64 headers on 32-bit systems.
366	
367	* The "irqpoll" boot parameter reduces driver initialization failures
368	  due to shared interrupts in the dump-capture kernel.
369	
370	* You must specify <root-dev> in the format corresponding to the root
371	  device name in the output of mount command.
372	
373	* Boot parameter "1" boots the dump-capture kernel into single-user
374	  mode without networking. If you want networking, use "3".
375	
376	* We generally don' have to bring up a SMP kernel just to capture the
377	  dump. Hence generally it is useful either to build a UP dump-capture
378	  kernel or specify maxcpus=1 option while loading dump-capture kernel.
379	
380	* For s390x there are two kdump modes: If a ELF header is specified with
381	  the elfcorehdr= kernel parameter, it is used by the kdump kernel as it
382	  is done on all other architectures. If no elfcorehdr= kernel parameter is
383	  specified, the s390x kdump kernel dynamically creates the header. The
384	  second mode has the advantage that for CPU and memory hotplug, kdump has
385	  not to be reloaded with kexec_load().
386	
387	* For s390x systems with many attached devices the "cio_ignore" kernel
388	  parameter should be used for the kdump kernel in order to prevent allocation
389	  of kernel memory for devices that are not relevant for kdump. The same
390	  applies to systems that use SCSI/FCP devices. In that case the
391	  "allow_lun_scan" zfcp module parameter should be set to zero before
392	  setting FCP devices online.
393	
394	Kernel Panic
395	============
396	
397	After successfully loading the dump-capture kernel as previously
398	described, the system will reboot into the dump-capture kernel if a
399	system crash is triggered.  Trigger points are located in panic(),
400	die(), die_nmi() and in the sysrq handler (ALT-SysRq-c).
401	
402	The following conditions will execute a crash trigger point:
403	
404	If a hard lockup is detected and "NMI watchdog" is configured, the system
405	will boot into the dump-capture kernel ( die_nmi() ).
406	
407	If die() is called, and it happens to be a thread with pid 0 or 1, or die()
408	is called inside interrupt context or die() is called and panic_on_oops is set,
409	the system will boot into the dump-capture kernel.
410	
411	On powerpc systems when a soft-reset is generated, die() is called by all cpus
412	and the system will boot into the dump-capture kernel.
413	
414	For testing purposes, you can trigger a crash by using "ALT-SysRq-c",
415	"echo c > /proc/sysrq-trigger" or write a module to force the panic.
416	
417	Write Out the Dump File
418	=======================
419	
420	After the dump-capture kernel is booted, write out the dump file with
421	the following command:
422	
423	   cp /proc/vmcore <dump-file>
424	
425	You can also access dumped memory as a /dev/oldmem device for a linear
426	and raw view. To create the device, use the following command:
427	
428	    mknod /dev/oldmem c 1 12
429	
430	Use the dd command with suitable options for count, bs, and skip to
431	access specific portions of the dump.
432	
433	To see the entire memory, use the following command:
434	
435	   dd if=/dev/oldmem of=oldmem.001
436	
437	
438	Analysis
439	========
440	
441	Before analyzing the dump image, you should reboot into a stable kernel.
442	
443	You can do limited analysis using GDB on the dump file copied out of
444	/proc/vmcore. Use the debug vmlinux built with -g and run the following
445	command:
446	
447	   gdb vmlinux <dump-file>
448	
449	Stack trace for the task on processor 0, register display, and memory
450	display work fine.
451	
452	Note: GDB cannot analyze core files generated in ELF64 format for x86.
453	On systems with a maximum of 4GB of memory, you can generate
454	ELF32-format headers using the --elf32-core-headers kernel option on the
455	dump kernel.
456	
457	You can also use the Crash utility to analyze dump files in Kdump
458	format. Crash is available on Dave Anderson's site at the following URL:
459	
460	   http://people.redhat.com/~anderson/
461	
462	
463	To Do
464	=====
465	
466	1) Provide relocatable kernels for all architectures to help in maintaining
467	   multiple kernels for crash_dump, and the same kernel as the system kernel
468	   can be used to capture the dump.

Leave a comment

Open Source Software for linux

Proprietary Software Open Source Alternative
Operating Systems
Microsoft Windows
Mac OS X
Ubuntu Linux
Fedora Linux
Centos (Red Hat Linux without Red Hat’s logos and support.)
openSUSE
Debian Linux
Mandriva Linux
Xandros
K12LTSP K12 Linux Terminal Server Project
VectorLinux
PC-BSD
There are too many others to list, go to Linux Online! for more distros!
Office Productivity Software / Suites
Microsoft Office OpenOffice (cross platform)
LibreOffice (cross platform)
KOffice – Linux
HTML Editors
Adobe Dreamweaver
Microsoft FrontPage
BlueGriffon (cross platform)
Digital Image / Photo Editing / Raster Image Editing Software
Adobe Photoshop GIMP (cross platform)
Image Viewers with RAW Capability
Photo Mechanic (Win and Mac OSX) Xee (Mac OSX only)
Vector Drawing Programs
Adobe Illustrator
Macromedia FreeHand
CorelDraw
Inkscape (cross platform)
2D CAD
(Computer Aided Drawing)
AutoCAD QCad (Linux/UNIX * Mac OS X)
3D CAD
(3D Modeling)
SolidWorks
Pro/ENGINEER
AutoDesk Inventor
Blender (cross platform)
BRL-CAD 3D
Povray 3D
Tulip 3D
Screen Recording
(to capture what you are doing on your computer and save as a video file)
CamStudio (for Windows only)
Desktop Publishing
Adobe Indesign
QuarkExpress
Microsoft Publisher
Scribus (cross platform)
PDF Creation
Adobe Acrobat PDF Creator (Windows only)OpenOffice

* This capability is built into Mac OS X via the print function.

Text Editors
Notepad jEdit (cross platform)
Notepad++ (for Windows only)
Syn (for Windows only)
Smultron (for Mac OS X only)
Web Servers
Microsoft IIS (Internet Information Services) Apache (cross platform)
Web Browsers
Microsoft Internet Explorer
Safari
Mozilla Firefox (cross platform)
Flock
Email Software
Microsoft Outlook
Microsoft Entourage
QuickMail
Thunderbird (cross platform)
Evolution
Kmail
FTP Clients
(File Transfer Protocol)
Ipswitch WS_FTP Pro
Fetch
Filezilla – FTP and SFTP (cross platform)
Cyberduck – FTP and SFTP (for Mac OS X only)
SFTP Programs
(SSH Secure File Transfer)
Filezilla – FTP and SFTP (cross platform)
Cyberduck – FTP and SFTP (for Mac OS X only)
WinSCP – SFTP and SCP client for Windows
SSH
PuTTY – SFTP and Telnet client for Windows
VNC
Apple Remote Desktop (ARD) TightVNC – VNC server and client for Windows, Linux, and Unix
Chicken of the VNC – VNC client for Mac OS X
OSXvnc – VNC server for Mac OS X
Hard Disk Utilities / Partitioning Tools
Norton PartitionMagic GParted & GParted LiveCD (Gnome Partition Editor) – (cross platform)
Anti-Virus Software
McAfee
Norton Anti-virus
AVG
ClamAV
ClamWin – (for Windows only)
ClamXav – (for Mac OS X only)
Keyboarding / Typing Software
Tux Typing 2
Edutainment / Educational Software
The KDE Edutainment Project
FREEDUC – resource for FOSS educational software
A List of Open Source Software for Education
Gcompris – educational softare for kids ages 2 to 10
Childsplay – various games for ages 1-9
KStars – a simualted planetarium (astronomy)
Kalzium – periodic table
KWord Quiz – flash cards
KTouch – teaches typing
Tux Paint – vector and raster image editing program for young children
KTurtle – Logo programming for young children
Math Programs
Geometer’s Sketchpad or Cabri GeoGebra – joins geometry, algebra and calculus
Dr. Geo – interactive geometry software
TuxMath – math game for kids
Music Composition
Rosegarden – similar to Cubase
Noteedit
Solfege – ear training
Montessori Bells
Sound Editing Programs
Sound Forge Audacity (cross platform)
Video Editing
iMovie KINO
Brainstorming, Mind Mapping, Flowcharting, Planning
Inpsiration FreeMind
Kivio
View Your Mind
Compression Utilities
WinZip 7-Zip
The Unarchiver
Accounting / Personal Finance
Quicken GnuCash
Grisbi – (cross platform)
Course Management Systems (CMS) and Virtual Learning Environments (VLE)
Click here for a full list of non-open source CMS/VLEs
Blackboard
WebCT
Campus Pipeline
ClassCampus
CyberProf
eCollege
Virtuoso
TeleTOP cms
Virtual Campus
Sentient Discover
MindEdge CMS
MyEDUkit
Click here for a full list of Open Source CMS/VLEs
Also click here
Moodle – used in 74 countries in 34 diferent languages!
MyClassroom – in use by several middle schools and high schools in the US and around the world!
interact
OpenCourse
Boddington
.LRN
LogiCampus
ATutor
Wordcircle CMS
Sakai
Manhattan
ILIAS
CourseWork – used by Stanford University
COSE (Creation of Study Environments)
Claroline – used in 62 countries and 28 languages!
WebWork
Eledge
ClassWeb 2.0
ePICE
Whiteboard
Student Information Systems (SIS)
Powerschool
WebEIM
eSIS
SCHOOLMASTER
MMS
Centre
Open Admin for Schools
Emulators
Virtual PC for Mac QEMU
PearPC
Q – cocoa port of QEMU for Mac OS X
bochs
Virtualization
Virtual PC for Windows
VMware
VirtualBox (cross platform)
coLinux

Leave a comment

Allocating a Windows Disk Partition to CentOS 6

Deleting the Windows Partition from the Disk

The first step in freeing up the Windows partition for use by CentOS 6 is to delete that partition. Before doing so, however, it is imperative that any data you need to keep is backed up from both the Windows and CentOS 6 partitions. Having done that, it is safe to proceed with this chapter.

In order to remove the Windows partition we first need to identify it using the fdisk tool:

[root@localhost ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x86008600

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1276    10249438+   7  HPFS/NTFS
/dev/sda2            1277        1340      512000   83  Linux
/dev/sda3            1340        2611    10209280   8e  Linux LVM

In the above example output the system contains one physical disk drive referenced by device name /dev/sda. On that disk drive are three partitions accessed via the device names /dev/sda1 through /dev/sda3 respectively. Based on the values in the System column, there is one NTFS partition. This NTFS partition is the one containing the Windows operating system and user data that we plan to remove. Note that a FAT partition also indicates the presence of a Windows installation.

To remove the partition, start the fdisk tool using the device name of the disk containing the partition (/dev/sda in this instance) and follow the instructions to switch out from DOS mode and to display sectors:

# su -
# fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): c
DOS Compatibility flag is not set

Command (m for help): u
Changing display/entry units to sectors

Command (m for help):

Next, display the partition table information for the disk drive using the p command:

Command (m for help): p

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x86008600

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63    20498939    10249438+   7  HPFS/NTFS
/dev/sda2        20500480    21524479      512000   83  Linux
/dev/sda3        21524480    41943039    10209280   8e  Linux LVM

Make a note of the end sector of the partition we will be deleting (/dev/sda1 in this instance).

At the command prompt, delete the Windows partition (which is partition 1 on our example system):

Command (m for help): d
Partition number (1-5): 1

Command (m for help):

Now that we have deleted the Windows partition we now need to create the new Linux partition in the vacated disk space. The partition number must match the number of the partition removed (in this case 1) and is going to be a primary partition. It will also be necessary to enter the Start and End sectors of the partition. In the case of the start sector accept the default value offered by fdisk. Enter the end sector exactly as reported for the old partition (fdisk will typically offer the correct values by default, though it is wise to double check):

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20500479, default 20500479):  20498939

Having made these changes the next step is to check that the settings are correct:

Command (m for help): p

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x86008600

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    20498939    10248446   83  Linux
/dev/sda2        20500480    21524479      512000   83  Linux
/dev/sda3        21524480    41943039    10209280   8e  Linux LVM

To commit the changes we now need to write the new partition information to disk and quit from the fdisk tool:

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

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

If you see a warning similar to the one indicated in the above output you will need to reboot your CentOS 6 system to be sure the new partition table information is picked up by the system kernel before proceeding.

Formatting the Unallocated Disk Partition

In order to make the new partition suitable for use by CentOS 6, it needs to have a file system created on it. The default file system type for the current release of CentOS 6 is ext4. Creation of the file system is performed using the mkfs command as follows:

[root@localhost ~]# mkfs -t ext4 /dev/sda1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
640848 inodes, 2562111 blocks
128105 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2625634304
79 block groups
32768 blocks per group, 32768 fragments per group
8112 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

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

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Editing the Boot Menu

The next step is to modify the boot menu. Since this was originally a dual boot system, the menu is configured to provide the option of booting either Windows or CentOS 6. Now that the Windows partition is gone, we need to remove this boot option. This is achieved by editing the menu.lst as follows:

su - 
gedit /boot/grub/menu.lst

Towards the bottom of the grub.conf file you will see a section similar to:

 
title Windows
        rootnoverify (hd0,0)
        chainloader +1

Delete this section from the file. Also check the default= value to make sure the default is not set to the partition which was just deleted. Save the file once the changes have been made.

Mounting the New Partition

Finally, we need to mount the new partition. In this example we will mount it in a directory named /data. You are free, however, to mount the new partition using any valid mount point you desire or to use it as part of a logical volume (details of which are covered in the chapter entitled Adding a New Disk to a CentOS 6 Volume Group and Logical Volume). First we need to create the directory to act as the mount point:

su - 
mkdir /data

Secondly, we need to edit the mount table so that the partition is automatically mounted each time system starts:

gedit /etc/fstab

At the bottom of the /etc/fstab file, add the following line to mount the new partition (modifying the /dev/sda1 device to match your environment):

/dev/sda1 /data ext4 defaults 0 0

Finally, we can manually mount the new partition (note that on subsequent reboots this will not be necessary as the partition will automount as a result of the setting we added to the /etc/fstab file above).

mount /data

To check the partition, try running the following command to display the available space:

 
df -h /data

You should see output similar to:

[root@localhost ~]# df -h /data
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             9.7G  150M  9.0G   2% /data

Leave a comment

CentOS 6 Network Installation

In addition to installing directly from the physical CentOS 6 installation media (in the form of a DVD) it is also possible to perform a network based CentOS installation whereby the installation image is installed on a remote server and downloaded in packages to the destination computer system during installation. CentOS 6 currently supports network installation via HTTP, FTP and NFS. For the purposes of this tutorial we will focus on the use of HTTP (in other words the installation image is available via a web server on a remote host) though the concepts are largely the same for the other network installation options.

Contents

[hide]

  • 1 CentOS 6 Network Installation Requirements
  • 2 Obtaining a Network Boot Image
  • 3 Writing the Boot Image to a USB Flash Drive
  • 4 Configuring the Network Installation
  • 5 Starting the CentOS 6 Network Installation

CentOS 6 Network Installation Requirements

Before a network installation of CentOS 6 can be performed a number of items are required. Firstly, the CentOS 6 installation image must be loaded onto the remote server and mounted. If the installation media is in the form of DVD then the image can be read from that media into a disk based ISO image file using the dd command as follows:

dd if=/dev/media of=/path/to/iso/file/rhel6-image.iso

Note that in the above example, /dev/media would be replaced by the path to the DVD device and /path/to/iso/file/ represents the path to a suitable location on the file system to create the image file. Also keep in mind that the installation media may comprise multiple disk images, each of which may need to be imported into the server.

Having created the ISO image file from the installation media, it now needs to be mounted in a location that is accessible to the web server, ftp server or NFS mount point so that it is accessible to the target system. This is achieved using the mount loopback interface:

mount -o loop rhel6_image.iso /path/to/mount/point

In this case, /path/to/mount/point is replaced by the full path to the location where the RHEL 6 installation image is to be mounted such that it can be accessed via the chosen network installation method. For example, in the case of an HTTP based installation, the chosen mount point might be /var/www/html/rhel6. Note that the specified mount point directory must already exist before executing this command.

Obtaining a Network Boot Image

Once the remote server is configured with a copy of the RHEL 6 installation image, the next step is to plan how the installation process will be initiated on the target system. Clearly we will still need to be able to boot from something locally to start the installation. The best option is to download the Network Install image from a CentOS mirror server at:

http://mirror.centos.org/centos/6/isos/

The file name containing this image is usually adopts the following format:

CentOS-<version>-<architecture>-netinstall.iso

For example, the 32-bit installation image for CentOS 6.2 is named CentOS-6.2-i386-netinstall.iso.

This image is approximately 170 Mb in size and may be burned to a CDROM, DVD or USB flash drive.

Writing the Boot Image to a USB Flash Drive

Once the network installation ISO image has been downloaded from the CentOS web site, it may optionally be burned onto a USB flash drive and then used to boot the system on which the network installation is to be performed. This task is best performed on another Linux system using the dd command to directly write the ISO image to the flash drive.

Begin by inserting the USB flash drive into an appropriate port on the Linux system and wait for the system to detect the device and mount it. Identify the device name assigned to the drive using the mount command in a terminal window and then unmount the media. Assuming, for the sake of an example, that the mount command indicated the USB drive was assigned to device file /dev/sdb, the following command would be used to write the ISO image to the drive:

dd if=/path/to/iso/image of=/dev/sdb

Once the image has been written to the drive, take it to the target system, modify the BIOS boot settings to ensure that the system will boot from a USB device prior to any other storage devices and reboot the system.

Configuring the Network Installation

When the network installer image has booted press the Esc key on the boot menu screen, enter the following command at the boot: prompt and press the enter key:

linux askmethod

A sequence of screens will subsequently appear providing the opportunity to select a language and keyboard type. Once these settings have been defined, a screen will appear requesting the location of the installation media:
CentOS 6 imnstallation method screen
Depending on the method by which the installation images are being served by the remote system select either NFS Directory or, in the case of an FTP or HTTP based server, URL. For the purposes of this tutorial we will be assuming the use of HTTP.

Once the installation method has been selected, click OK to proceed to the TCP/IP configuration screen. If the computer has multiple network adaptors, select the one to be used during the installation. On the next screen, configure the required IPv4 and IPv6 settings for the network to which the computer is attached:
CentOS 6 network installation network settings
The next item of information that the installer needs is the URL of server containing the installation images and the path to the directory where the first installation image media was mounted. Enter this information either as a hostname or IP address before clicking OK to proceed:
CentOS 6 network installation URL settings
In the above figure, the installation media is identified via an HTTP URL to the location on the remote web server where the installation image is located. Proxy and user and password information may also be specified if required for access to the server.

Starting the CentOS 6 Network Installation

Once the network configuration settings are complete, select the OK button to begin the installation process. The network installation process will now connect to the remote server and download the first installation image file (this is typically /install.img):
A CentOS 6 network based installation in progress
The duration of this download will vary subject to the speed of the connection between the local system and the remote server hosting the installation image. Once the image has downloaded the installation will proceed as outlined in the previous chapter, with the inevitable exception that it may proceed more slowly than a comparable installation from a local media unless the remote server and client are connected via a high speed network connection such as that provided by a fiber channel.

Leave a comment

CentOS 6 with Windows in a Dual Boot Environment

entOS 6, in common with most Linux distributions, will happily co-exist on a hard disk drive with just about any version of Windows up to and including Windows 7 and Windows Server 2008 R2. This is a concept known as dual-booting. Essentially, when you power up the system, you will be presented with a menu providing the option to boot either your CentOS 6 installation or Windows. Obviously you can only run one operating system at a time in such a configuration, but it is worth noting that the files on the Windows partition of your disk drive will be available to you from CentOS 6 regardless of whether your Windows partition was formatted using Microsoft’s NTFS, FAT16 or FAT32 file system formats.

This installation method involves shrinking the size of the existing Windows partition to accommodate the installation of CentOS 6. How you go about doing this will depend on the version of Windows currently installed on the disk.

Contents

[hide]

Partition Resizing

In order to accommodate CentOS 6 on a disk drive that already contains a Windows installation the first step involves shrinking the Windows partition to make some room. If you are running Windows Vista, Windows 7, Windows Server 2008 or later, the recommended course of action is to use the Windows Disk Management interface to reduce the size of the partition prior to attempting to install CentOS 6. You can generally access this by right clicking on the Computer icon and selecting Manage from the popup menu. Within the Computer Management interface, select Disk Management to display a graphical representation of the disk drives in your system:
The Windows Disk Management Tool
Right click on the partition you wish to reduce and select Shrink Volume. The tool will calculate the maximum amount by which the volume may be reduced without data loss (a process that can take several minutes depending on the overall size of the partition). Once this analysis is complete, a dialog similar to the one in the following figure will appear:

Shrinking a Windows NTFS partition

Enter into the Total size after shrink in MB field the new target size for the partition and click on Shrink to proceed. Once the resizing operation is complete, reboot using the CentOS 6 installation media (as outlined in Installing CentOS 6 on a Clean Disk Drive) and proceed with the installation. When prompted to decide on where CentOS 6 is to be installed be sure to select the Use Free Space option.

Shrinking the Windows Partition from within Linux

Whilst it is possible to shrink existing Windows partitions using the Windows Disk Management tool on recent versions of Windows, this is not possible from within Windows XP or earlier Windows releases. If you need to shrink a Windows XP partition in order to install CentOS 6, one option is to use one of the commercially available partitioning tools such as PartitionMagic. If you would prefer not to buy a partitioning tool, the repartitioning may also be performed from within the CentOS 6 Live CD distribution using the fdisk and ntfsresize utilities. As outlined in the chapter entitled Installing CentOS 6 on a Clean Disk Drive, a Live CD is a CDROM from which a Linux distribution can be booted and run without the necessity to install the operating system on a disk drive.

Before attempting this resizing technique it is vital that you back up all essential data from your Windows system. In this section we will be performing some low level disk partitioning activities using command line tools. Whilst following these steps is an invaluable method for learning about the structure of disk partitions, it is important that you understand that errors in performing the following steps may result in loss of data. With that warning out of the way we can proceed.

The CentOS Live CD image can be downloaded from the mirror sites listed on the CentOS web site at:

http://mirror.centos.org/centos/6/isos/

Once you have loaded this page into your browser, select either the i386 or x86_64 link depending on whether the target system is a 32-bit or 64-bit platform. Within the next screen, select a mirror from the list and look for a link to download the Live CD image. This will typically be named as follows:

CentOS-<version>-<architecture>-LiveCD.iso

Once you have downloaded the image, burn it to a CD, then make sure your BIOS is configured to boot from the CDROM/DVD drive before the hard disk and then boot from the CD. The system will boot CentOS and you will have a fully functional CentOS environment to use during the repartitioning process.

Once CentOS has loaded, log in and open a terminal window (right click anywhere on the desktop and select Open in Terminal). In the terminal window, gain root privileges by executing the following command:

su –

The fdisk tool is installed by default but the ntfsresize tool is not part of the standard CentOS distribution or installation repositories. Instead, we need to install from a different source. To enable access to the required repository, one of the following commands must be run depending on whether you are running a 32-bit or 64-bit version of CentOS:

For 32-bit systems:

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

For 64-bit systems:

rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

Next, we need to install the package that contains the ntfsresize utility:

yum install ntfsprogs

Now that we have installed the tools we need, the next step is to identify the disk drive on which the Windows partition resides. This is achieved by running the fdisk command as follows:

[root@livecd ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x86008600

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2609    20956761    7  HPFS/NTFS

As we can see, in the case of the above example, we have a single disk drive (/dev/sda) which contains a single partition (/dev/sda1) that is formatted as NTFS (a sure sign that is a Windows partition). Since the Boot column for /dev/sda1 contains an asterisk we also know this is currently the hard disk’s boot partition. Depending on your system configuration you may see different results (for example if you have multiple disk drives or the disk drive contains more than one partition).

Having identified the disk and partition, we now need to find out how much unused space is available within the partition for us to free up. To obtain this information we use the ntfsresize tool as follows:

[root@livecd ~]# ntfsresize -i /dev/sda1
ntfsresize v1.13.1 (libntfs 9:0:0)
Device name        : /dev/sda1
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 21459722752 bytes (21460 MB)
Current device size: 21459723264 bytes (21460 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use       : 2139 MB (10.0%)
Collecting resizing constraints ...
You might resize at 3232075776 bytes or 3233 MB (freeing 18227 MB).
Please make a test run using both the -n and -s options before real resizing!

The output from ntfsresize for our example tells us that we can safely free up 18227MB of disk space by shrinking the specified Windows partition. In practice, however, you will want to leave space on your Windows system for storing future data, so it is recommended that you do not shrink the partition to the full extent available. For the purposes of this example, therefore, we will shrink the partition to 10000MB. Before performing the live resize, it is best to run through a simulation in order to identify any potential problems before permanent changes are made. To do this, run ntfsresize with the –no-action option:

[root@livecd ~]# ntfsresize --no-action -b --size 10000M /dev/sda1
ntfsresize v1.13.1 (libntfs 9:0:0)
Device name        : /dev/sda1
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 21459722752 bytes (21460 MB)
Current device size: 21459723264 bytes (21460 MB)
New volume size    : 9999995392 bytes (10000 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use       : 2945 MB (13.7%)
Collecting resizing constraints ...
Needed relocations : 45 (1 MB)
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Relocating needed data ...
100.00 percent completed
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
The read-only test run ended successfully.

Assuming the read-only test runs successfully, the actual resize can be performed by running the same command, but this time without the –no-action option:

[root@livecd ~]# ntfsresize -b --size 10000M /dev/sda1
ntfsresize v1.13.1 (libntfs 9:0:0)
Device name        : /dev/sda1
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 21459722752 bytes (21460 MB)
Current device size: 21459723264 bytes (21460 MB)
New volume size    : 9999995392 bytes (10000 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use       : 2945 MB (13.7%)
Collecting resizing constraints ...
Needed relocations : 45 (1 MB)
WARNING: Every sanity check passed and only the dangerous operations left.
Make sure that important data has been backed up! Power outage or computer
crash may result major data loss!
Are you sure you want to proceed (y/[n])? y
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Relocating needed data ...
100.00 percent completed
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
Syncing device ...
Successfully resized NTFS on device '/dev/sda1'.
You can go on to shrink the device for example with Linux fdisk.
IMPORTANT: When recreating the partition, make sure that you
  1)  create it at the same disk sector (use sector as the unit!)
  2)  create it with the same partition type (usually 7, HPFS/NTFS)
  3)  do not make it smaller than the new NTFS filesystem size
  4)  set the bootable flag for the partition if it existed before
Otherwise you won't be able to access NTFS or can't boot from the disk!
If you make a mistake and don't have a partition table backup then you
can recover the partition table by TestDisk or Parted's rescue mode.

At this point we have reduced the size of the NTFS partition but the partition does not yet know we have done so. If, for example, we use fdisk to tell us about the partition, the partition table information still indicates the original size:

[root@livecd ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x8f6a8f6a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2609    20956761    7  HPFS/NTFS

In order to address this we will have to delete the partition information and then recreate it with the new size information. Before doing so, make a note of the Start and Id values for the partition provided by the above fdisk command (since yours will almost certainly differ from the example and we will need these when we recreate the partition). Begin by starting fdisk with the name of the disk drive on which we are going to modify the partition table information:

[root@livecd ~]# fdisk /dev/sda

At the command prompt, delete the partition (for the example this is partition 1 but may be different on your system):

Command (m for help): d
Selected partition 1

Next, we need to recreate the partition with the new size information (keeping in mind that we reduced the partition to 10000MB):

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

Next, the Id of the partition needs to set to the original value as indicated by the fdisk –l command (in this case 7 to indicate the partition uses the Windows NTFS format):

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 7
Changed system type of partition 1 to 7 (HPFS/NTFS)

Finally, we need to make sure the partition is still bootable:

Command (m for help): p

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x86008600

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        1276    10249438+   7  HPFS/NTFS

If the Boot column does not contain an asterisk (*) then we need to make the partition bootable before we write the new configuration disk:

Command (m for help): a
Partition number (1-4): 1

Once again, it is prudent to check the settings before proceeding:

Command (m for help): p

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x86008600

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1276    10249438+   7  HPFS/NTFS

At this point none of the changes have been written to disk. In the event that the partition settings do not meet your expectations simply exit from fdisk without comitting the changes. If all is well, however, simply write the new partition information to disk as follows:

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

Calling ioctl() to re-read partition table.

The resize is now complete and you can reboot the system. If you check the disk volumes in the Windows XP disk manager (right click on My Computer, select Manage and choose Disk Management from the Computer Management tool). The newly freed space will be displayed as Unallocated.

Having resized the partition, reboot using the CentOS 6 installation media (as outlined in Installing CentOS 6 on a Clean Disk Drive) and proceed with the installation. When prompted to decide on where CentOS 6 is to be installed be sure to select the Use Free Space option.

Choosing an Operating System at Boot Time

Once the installation completes, the system will display the standard boot countdown screen. Pressing any key on the keyboard at this point will display the boot menu screen as illustrated in the following figure:
Choosing to boot Windows or CentOS 6
This menu provides the option of booting either “CentOS” or “Other”. In this instance, selecting “Other” will boot your original Windows installation. In the next section we will cover the steps to modify this menu to change the boot default and rename the “Other” menu option to something more descriptive.

Editing the CentOS 6 Boot Menu

Once you have logged into the system, completed the tasks presented by the setup agent and the desktop is visible the next step is to configure the boot menu so that it lists the alternate operating system as Windows instead of Other. The boot menu configuration settings are stored in the /boot/grub/menu.lst file. This file may be edited in a terminal window as follows:

su -
gedit /boot/grub/menu.lst

When prompted by the su command to enter a password be sure to enter the root password created during the installation process, not the password you created for your user account during the setup agent configuration steps.

The contents of a typical menu.lst file is listed below:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,1)
#          kernel /vmlinuz-version ro root=/dev/mapper/vg_centos62-lv_root
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,1)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-220.el6.i686)
        root (hd0,1)
        kernel /vmlinuz-2.6.32-220.el6.i686 ro root=/dev/mapper/vg_centos62-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_centos62/lv_swap rd_LVM_LV=vg_centos62/lv_root rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM
        initrd /initramfs-2.6.32-220.el6.i686.img
title Other
        rootnoverify (hd0,0)
        chainloader +1

The above menu.lst file contains options to boot for two operating systems. The CentOS section of the configuration typically reads as follows:

title CentOS (2.6.32-220.el6.i686)
        root (hd0,1)
        kernel /vmlinuz-2.6.32-220.el6.i686 ro root=/dev/mapper/vg_centos62-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_centos62/
lv_swap rd_LVM_LV=vg_centos62/lv_root rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb 
crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM
        initrd /initramfs-2.6.32-220.el6.i686.img

The Windows section of the configuration is likely to be similar to the following:

title Other
        rootnoverify (hd0,0)
        chainloader +1

The default=0 line indicates that the first entry in the file is to be the default operating system (in other words, the operating system that will boot by default if the user does not intervene during the boot phase). The timeout=5 directive specifies the number of seconds the boot screen is displayed before the default operating system is automatically booted.

To configure the system to boot Windows by default simply change this line so that it reads as follows:

default=1

To increase or decrease the timeout before the default operating system boots, change the timeout value (in this case to 20 seconds):

timeout=20

The final task in our dual boot configuration process is to rename the Windows boot option to something more descriptive than “Other”. To achieve this, simply change the “Other” line as follows:

title Windows

Note that the title value can be anything you choose.

The next time the system is rebooted, the boot screen will wait 20 seconds before auto-booting. If no keys are pressed the system will now boot Windows by default, instead of CentOS 6. If the user does intervene and display the boot menu, the Windows option is now titled “Windows” and not “Other”.

Accessing the Windows Partition from CentOS 6

When running CentOS 6 in a dual boot configuration it is still possible to access files located on the Windows partition. This can be achieved by manually mounting the partition from the command-line. Before doing so, however, some additional packages need to be installed on the system. To do so, run the following commands inside a terminal window:

su -
yum install fuse

Next, we need to set up access to the Dag RPMForge repositories:

For 32-bit systems:

rpm -Uhv http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm

For 64-bit systems:

rpm –Uhv http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-1.el6.rf.x86_64.rpm

Next, install the NTFS driver:

yum install fuse-ntfs-3g

Once the requisite packages are installed, the next step is to create a directory to use as the mount point for our Windows partition. In this example we will create a directory called /windows:

mkdir /windows

When prompted for a password by the su command, enter the root password specified during the CentOS 6 installation process. In order to identify the device name that has been assigned to the Windows partition, use the fdisk command as follows:

[root@localhost ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x86008600

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1276    10249438+   7  HPFS/NTFS
/dev/sda2            1277        1340      512000   83  Linux
/dev/sda3            1340        2611    10209280   8e  Linux LVM

In the above output, the main Windows partition containing the files we need access to is /dev/sda1.

Next, we need to run the mount command (still with root privileges and assuming the Windows partition is /dev/sda1 and NTFS format – this may be different on your system):

mount –t ntfs-3g /dev/sda1 /windows

Under some circumstances you may get a message that the Windows partition needs to be checked. If so, either reboot into Windows again and manually run chkdsk (if it does not run automatically during the boot process), or force the mount with the –o option:

mount /dev/sda2 /windows -o force

To automate the mount each time the system is booted, simply add the mount line to the /etc/fstab file:

/dev/sda1 /windows ntfs defaults 0 0

To unmount the Windows file system at any time:

umount /windows

Leave a comment