Mon Jul 20 10:27:58 PDT 2015

Adding a Disk to a Linux Machine

I recently had occasion to add a disk to a virtual machine running Fedora Core 5. Without much system administration experience, and with an inclination emboldened by the fact that the machine was running on VMWare on a Windows XP machine, I found that the operation straightforward. Here are the necessary steps:

1. Add the hardware to the machine (virtually in my case, using the VMWare UI).

2. Use fdisk -l to establish the name of the hard drive that you have hooked up to the machine. The answer in my case was /dev/sda. The drive name information will be distinguished by the fact that the target drive is reported as not having a valid partition table.

3. Use fdisk /dev/sda to format the new disk. This involves typing 'm' to get a help listing, 'n' to add a new partition, 'p' to selected extended, '1' to specify the starting cylinder and 'w' to write the partition information to the hard disk.

4. Use mkfs.ext3 /dev/sda to write a file system to the disk.

5. All that then remains is to mount the disk so that it is accessible to the OS, first create a mount point mkdir /mnt/disk2 then issue a mount command to hook the disk to the mount.

    mount -t ext3 /dev/sda /mnt/disk2

Then you can go on to work with your disk space hungry software.


Posted by ZFS | Permanent link | File under: bash