Difference between revisions of "Allocating a Windows Disk Partition to RHEL 6"
m (Text replacement - "<google>BUY_RHEL6</google>" to "<htmlet>rhel6</htmlet>") |
|||
Line 8: | Line 8: | ||
− | < | + | <htmlet>rhel6</htmlet> |
In the previous chapter we looked at how to install Red Hat Enterprise Linux 6 on the same disk as Windows. This so called "dual boot" configuration allows the user to have both operating systems installed on a single disk drive with the option to boot one or the other when the system is powered on. Performing this type of installation was covered in [[Installing RHEL 6 with Windows in Dual Boot Environment]]. | In the previous chapter we looked at how to install Red Hat Enterprise Linux 6 on the same disk as Windows. This so called "dual boot" configuration allows the user to have both operating systems installed on a single disk drive with the option to boot one or the other when the system is powered on. Performing this type of installation was covered in [[Installing RHEL 6 with Windows in Dual Boot Environment]]. | ||
Line 226: | Line 226: | ||
</pre> | </pre> | ||
− | < | + | <htmlet>rhel6</htmlet> |
Revision as of 21:32, 1 February 2016
Previous | Table of Contents | Next |
Installing RHEL 6 with Windows in Dual Boot Environment | Logging into the RHEL 6 GNOME Desktop |
You are reading a sample chapter from the RHEL 6 Edition book. Purchase the fully updated Red Hat Enterprise Linux 8 (RHEL 8) Edition of this publication in eBook ($9.99) or Print ($36.99) format Red Hat Enterprise Linux 8 Essentials Print and eBook (ePub/PDF/Kindle) editions contain 31 chapters and over 250 pages |
In the previous chapter we looked at how to install Red Hat Enterprise Linux 6 on the same disk as Windows. This so called "dual boot" configuration allows the user to have both operating systems installed on a single disk drive with the option to boot one or the other when the system is powered on. Performing this type of installation was covered in Installing RHEL 6 with Windows in Dual Boot Environment.
This chapter is intended for users who have decided they like RHEL 6 enough to delete Windows entirely from the disk, and use the resulting space for Linux. In the following sections we will work through this process step by step.
Deleting the Windows Partition from the Disk
The first step in freeing up the Windows partition for use by RHEL 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 RHEL 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:
# 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: 0x4eb978f9 Device Boot Start End Blocks Id System /dev/sda1 * 1 13 102400 7 HPFS/NTFS Partition 1 does not end on cylinder boundary. /dev/sda2 13 1400 11141120 7 HPFS/NTFS /dev/sda3 1400 1464 512000 83 Linux /dev/sda4 1464 2611 9214976 5 Extended /dev/sda5 1464 2611 9213952 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/sda5 respectively. Based on the values in the System column, there are two NTFS partitions. The first is very small and marked as bootable so clearly contains the boot record. The second, much larger, 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:
# 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: 0x4eb978f9 Device Boot Start End Blocks Id System /dev/sda1 * 2048 206847 102400 7 HPFS/NTFS /dev/sda2 206848 22489087 11141120 7 HPFS/NTFS /dev/sda3 22489088 23513087 512000 83 Linux /dev/sda4 23513088 41943039 9214976 5 Extended /dev/sda5 23515136 41943039 9213952 8e Linux LVM
Make a note of the start and end addresses of the partition we will be deleting (/dev/sda2 in this instance).
At the command prompt, delete the Windows partition (which is partition 2 on our example system):
Command (m for help): d Partition number (1-5): 2 Command (m for help):
Now that we have deleted the Windows partition we now need to create the new RHEL partition in the vacated disk space. The partition number must match the number of the partition removed (in this case 2) and is going to be a primary partition. It will also be necessary to enter the Start and End sectors of the partition 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 l logical (5 or over) p primary partition (1-4) p Selected partition 2 First sector (206848-41943039, default 206848): Using default value 206848 Last sector, +sectors or +size{K,M,G} (206848-22489087, default 22489087): Using default value 22489087
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: 0x4eb978f9 Device Boot Start End Blocks Id System /dev/sda1 * 2048 206847 102400 7 HPFS/NTFS /dev/sda2 206848 22489087 11141120 83 Linux /dev/sda3 22489088 23513087 512000 83 Linux /dev/sda4 23513088 41943039 9214976 5 Extended /dev/sda5 23515136 41943039 9213952 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 RHEL 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 RHEL 6, it needs to have a file system created on it. The default file system type for the current releases of RHEL 6 is ext4. Creation of the file system performed using the mkfs command as follows:
# mkfs -t ext4 /dev/sda2 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 696320 inodes, 2785280 blocks 139264 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2852126720 85 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 22 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 RHEL. 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 to see 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. 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/sda2 device to match your environment):
/dev/sda2 /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:
Filesystem Size Used Avail Use% Mounted on /dev/sda2 11G 155M 9.8G 2% /data
You are reading a sample chapter from the RHEL 6 Edition book. Purchase the fully updated Red Hat Enterprise Linux 8 (RHEL 8) Edition of this publication in eBook ($9.99) or Print ($36.99) format Red Hat Enterprise Linux 8 Essentials Print and eBook (ePub/PDF/Kindle) editions contain 31 chapters and over 250 pages |
Previous | Table of Contents | Next |
Installing RHEL 6 with Windows in Dual Boot Environment | Logging into the RHEL 6 GNOME Desktop |