Add a second hard disk

If you run out of space on your main hard disk you might choose to add a second hard disk.16 When adding a new disk, two things need to be done. First the disk must be partitioned. Then it must be formatted. If you want to make it accessible under Windows as well as Ubuntu, the FAT32 format must be used. Before you can do either task, you need to identify how Ubuntu refers to the new hard disk on a technical level.

The following steps will do all of this:

1. Boot into Ubuntu with the hard disk attached to your computer. Open a terminal window and type sudo fdisk -l.

16. The instructions in the tip above assuming you've installed a brand new hard disk. If you connect an old hard disk that already contains an operating system, you should find the disk is detected automatically on the Places menu within Ubuntu. Rather than repartitioning and reformatting, you may as well just wipe the files from the hard disk using Nautilus and use the existing partition. Ensure that you select the right disk and don't accidentally wipe the files from your Windows partition!

Add a second hard disk M 154

Here are the results I saw on my test system:

Disk /dev/sda: 81.9 GB, 81964302336 bytes 255 heads, 63 sectors/track, 9964 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x1c381c37

Device Boot

Start

End

Blocks

Id

System

/dev/sdal *

l

4742

38090083+

7

HPFS/NTFS

/dev/sda2

4743

9964

41945715

5

Extended

/dev/sda5

4743

9744

40178533+

83

Li nux

/dev/sda6

9745

9964

1767118+

82

Linux swap/Solaris

Disk /dev/sdb: 120.0 GB, 120034123776 bytes 255 heads, 63 sectors/track, 14593 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xb94838a4

Disk /dev/sdb: 120.0 GB, 120034123776 bytes 255 heads, 63 sectors/track, 14593 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xb94838a4

Disk /dev/sdb doesn't contain a valid partition table

There are two hard disks listed in the results: look for the headings Disk /dev/sda and Disk /dev/sdb. Beneath each heading is technical information about the disk, and beneath that is listed the partitions on that disk.

It should be obvious that, on my test computer, /dev/sdb is the new hard disk because it has no partitions (it "doesn't contain a valid partition table"), while /dev/sda has the standard partition layout of a dual-boot Ubuntu system.

2. Type the following to start the cfdisk partitioning program: $ sudo cfdisk -z /dev/sdb

You should replace /dev/sdb with what you discovered earlier. Then type 0 to create a new partition, and hit [Enter] twice to select to create a primary partition and accept the size suggestion. This will create a partition that fills the entire disk.

3. Hit (t and then hit [Enter] to scroll the list. Then type 0C (note that's zero and then C). Hit [Enter ]. Then type (W (note that's [Shift ]+[w]). Type yes to confirm your choice. Once the program has finished writing the new partition table, type @ to quit the program.

4. Now you must format the new partition. To do this, type the following:

Update Ubuntu in the background M 155

You should replace the /dev/sdb component of the line above with what you discovered earlier, although ensure you end it with a 1 (in other words, if you found the new disk was identified as, say, /dev/sdc then you would type sudo mkfs.vfat -F 32 /dev/sdc1).

Following this, the hard disk is ready for use. To have it appear on Ubuntu's Places menu, restart the computer (it will be identified by its sizeā€”for example, if it is a 160GB hard disk, it will appear on the Places menu as 160 GB Media). The new disk should be automatically detected and made available within My Computer when you boot into Windows.

Was this article helpful?

0 0

Post a comment