Welcome!

Linux Containers Authors: Liz McMillan, Kevin Sparenberg, Karyn Jeffery, Elizabeth White, Yeshim Deniz

Related Topics: Linux Containers

Linux Containers: Article

How to install another hard disk

Adding 120 gigabytes to your Linux computer is easy as 1-2-3

(LinuxWorld) — My desktop machine has been cramped for space for at least a year. I've had to shuffle games, data, applications and digital images on and off the system as I needed them. There just wasn't enough available space on the two existing drives, and it was past time to do something about it. That's what I'm writing about this week: adding a new hard drive to your existing Linux system.

I decided on a Western Digital Caviar IDE drive. Model WD1200JB is rated at 120-gigabyte capacity, spins at 7200 RPMs and sports an 8-megabyte cache. I found a good price for it online as a bare drive (meaning without any cables or hardware to facilitate installation), and I ordered it. Total cost was $131.99, including shipping and handling. Bless froogle.google.com.

I remember scraping my knuckles a couple of times when I did a similar upgrade a few years ago. I was hopeful that this time it would go a little easier. It did, by a considerable margin. Maybe I've gotten better at reading the HowTo's; this time, I followed the LinuxPlanet tutorial on adding a new (empty) hard drive (See the Resources below).

To begin with, of course, I had to decide where I would attach the new drive. My desktop machine can handle four IDE-drives in its current configuration. Three of them were already occupied, handling the two existing hard drives and the HP 9100 CD-RW drive.

 

The hardware map looked like this

The primary IDE-controller had my boot drive connected as master and the HP CD-ROM as slave. Linux recognizes those devices as /dev/hda and /dev/hdb. I think of them as hard drive a and hard drive b. The secondary IDE controller (each controller can support only two drives) had my second hard drive as master. At one time, I had a DVD drive as secondary, but it's been gone for a while.

Idiot laws like the DMCA make a DVD-drive on a Linux box a much less attractive option, so I simply don't use my DVD-drive any longer. Linux sees my second hard drive as /dev/hdc. See the pattern emerging? I think of it as hard drive c. Extra credit if you can predict what Linux called my new hard drive when I connect it as slave on the secondary controller. That's right, my dweeb! It is now known as /dev/hdd.

As I looked at my existing hardware, something inside told me I had better be sure whether I should connect the new drive to the middle connector on the cable or if it should be at the end. I went on one of the help channels on irc.freenode.net to find out. It turns out that it doesn't matter, so long as you have correctly strapped the drive as either master or slave. If you strap it for Cable Select, it matters.

Back in the day, I think it mattered when I was adding new 20-megabyte Seagate MFM drives to my 80286 machine. Not so with the IDE drives of today. My new drive came jumpered as CS, for Cable Select. I removed the jumper cap from the CS pins and slipped it over the pins marked as SL, for slave.

With that irritating question out of the way, I shut down my desktop machine and physically installed the drive. The middle connector was available on the cable (the end connector was connecting to my existing second hard drive), so I used it. The ribbon edge of the cable, which marks the pin-1 side, almost always is closest to the power connection on the back of the drive. That rule held true this time as well, so there was no fumbling around required for me to connect the cable. Then I connected a power lead from the box to the drive. With the drive secured inside the box, the hardware side of the installation was done. It only took about five minutes.

After rebooting, I followed the HowTo and started the software side of the installation. The first step of that process was to partition the drive. I used fdisk for the task. As root, I entered the following command to start fdisk and point it at the correct drive:

# /sbin/fdisk /dev/hdd

If you're not familiar with fdisk usage, it's pretty simple. Enter an m, and it will list all the commands available to you. The first command I entered was p, to print the current partition table. Because the drive was brand-new, nothing was displayed. Then I entered n to create a new partition, p to make it a primary partition, and 1 for the partition number. Easy as pie, and we're almost halfway through.

Next, I told fdisk how large I wanted the partition to be. There are several ways to do this, but the default is to give it a starting and ending cylinder number. It prompts you for each, suggesting the first cylinder as the starting place and the last cylinder for the ending spot. I just hit Enter to accept both suggestions. Then it was only a matter of telling fdisk to write the new partition table.

If doing geeky stuff from the command line makes you nervous, it may help calm your nerves to know that nothing you do in fdisk is applied until you tell it to write a new partition-table. This allows you to check and double-check every step to make sure you have it right. I printed the partition table again to make sure that partition 1 was there, and then entered w to save the new table. Nothing to it.

Then it was time to format the drive. I used the example mkfs command to create an ext3 filesystem given in the HowTo by typing the following as root:

mkfs -t ext2 -j /dev/hdd1

Note that in addition to telling mkfs what drive we are talking about, we need to tell it which partition. There is only one partition on the new drive: partition 1. That's why I entered /dev/hdd1 instead of simply /dev/hdd in the command above.

Now just two more quick tasks, and my new drive will be installed and ready to use. I decided to call it bigdog, because it dwarfs the older drives in the box. The first step was to create a directory I could use as a mount-point. I did this by entering the following commands as root. The first command creates the directory while the second gives me all rights to it:

mkdir /bigdog
chown warthawg.warthawg /bigdog

Now I was ready for the very last part of the installation: adding bigdog to /etc/fstab so the system would know about it at boot time. That way, I won't have to manually mount it each time I restart the system. That was as easy as adding the following line to the end of the file:

/dev/hdd1   /bigdog   ext3    defaults     1 2

Then I rebooted the system and watched as the drives spun up. I was able to use the new drive immediately; everything just worked exactly as it was supposed to. The entire process only took about 15 or 20 minutes. It sure didn't seem that easy the first time I did it — I know I've learned a lot more about Linux than I knew then, but I think most of the credit has to go to the HowTo I followed to do the job.

OK, now it's your turn. Have I missed something? Would you have done it differently? Is there a nice disk-manager available that does all of the above in a friendly GUI? Let me know in the forum.

More Stories By Joe Barr

Joe Barr is a freelance journalist covering Linux, open source and network security. His 'Version Control' column has been a regular feature of Linux.SYS-CON.com since its inception. As far as we know, he is the only living journalist whose works have appeared both in phrack, the legendary underground zine, and IBM Personal Systems Magazine.

Comments (5) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
Adipex 03/21/04 08:17:52 PM EST

interesting article .. any more?

Peter Sattler 12/08/03 04:51:25 PM EST

Nice description, clearly helpful for beginners. The only flaw I see is : why reboot ? Add to /etc/fstab and mount !
e.g. mount /bigblock - or how was the name of your freshly created mountpoint ?!
btw: Thanks to bex for cfdisk. I like that.

bex 11/12/03 10:29:32 AM EST

Instead of using fdisk you could have used cfdisk. It's not _exactly_ a nice friendly GUI since it's done in the console but I like it better than fdisk. You can see what you're doing better. I think it's an fdisk clone of sorts.

Jon Keeble 10/02/03 07:49:21 AM EDT

Good article, and relevant for systems with pre-existing ide drivers. What happens when the existing disk(s) are SCSI? When the ide disk is added, attempts for format result in messages like 'hda: no driver present'. How to add a driver?

J-J Cote 08/26/03 01:40:16 PM EDT

I think it would be helpful, on the mkfs line, to explain that the -j option specifies an ext3 filesystem. Everything is correct as you have it, but it looks like a typo if you don't understand the arguments to mkfs.

Thanks.

@ThingsExpo Stories
"DX encompasses the continuing technology revolution, and is addressing society's most important issues throughout the entire $78 trillion 21st-century global economy," said Roger Strukhoff, Conference Chair. "DX World Expo has organized these issues along 10 tracks with more than 150 of the world's top speakers coming to Istanbul to help change the world."
While the focus and objectives of IoT initiatives are many and diverse, they all share a few common attributes, and one of those is the network. Commonly, that network includes the Internet, over which there isn't any real control for performance and availability. Or is there? The current state of the art for Big Data analytics, as applied to network telemetry, offers new opportunities for improving and assuring operational integrity. In his session at @ThingsExpo, Jim Frey, Vice President of S...
"We provide IoT solutions. We provide the most compatible solutions for many applications. Our solutions are industry agnostic and also protocol agnostic," explained Richard Han, Head of Sales and Marketing and Engineering at Systena America, in this SYS-CON.tv interview at @ThingsExpo, held June 6-8, 2017, at the Javits Center in New York City, NY.
"We are focused on SAP running in the clouds, to make this super easy because we believe in the tremendous value of those powerful worlds - SAP and the cloud," explained Frank Stienhans, CTO of Ocean9, Inc., in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
DX World EXPO, LLC., a Lighthouse Point, Florida-based startup trade show producer and the creator of "DXWorldEXPO® - Digital Transformation Conference & Expo" has announced its executive management team. The team is headed by Levent Selamoglu, who has been named CEO. "Now is the time for a truly global DX event, to bring together the leading minds from the technology world in a conversation about Digital Transformation," he said in making the announcement.
"We've been engaging with a lot of customers including Panasonic, we've been involved with Cisco and now we're working with the U.S. government - the Department of Homeland Security," explained Peter Jung, Chief Product Officer at Pulzze Systems, in this SYS-CON.tv interview at @ThingsExpo, held June 6-8, 2017, at the Javits Center in New York City, NY.
The financial services market is one of the most data-driven industries in the world, yet it’s bogged down by legacy CPU technologies that simply can’t keep up with the task of querying and visualizing billions of records. In his session at 20th Cloud Expo, Karthik Lalithraj, a Principal Solutions Architect at Kinetica, discussed how the advent of advanced in-database analytics on the GPU makes it possible to run sophisticated data science workloads on the same database that is housing the rich...
SYS-CON Events announced today that Massive Networks will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Massive Networks mission is simple. To help your business operate seamlessly with fast, reliable, and secure internet and network solutions. Improve your customer's experience with outstanding connections to your cloud.
Everything run by electricity will eventually be connected to the Internet. Get ahead of the Internet of Things revolution and join Akvelon expert and IoT industry leader, Sergey Grebnov, in his session at @ThingsExpo, for an educational dive into the world of managing your home, workplace and all the devices they contain with the power of machine-based AI and intelligent Bot services for a completely streamlined experience.
Internet of @ThingsExpo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 21st Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devic...
"The Striim platform is a full end-to-end streaming integration and analytics platform that is middleware that covers a lot of different use cases," explained Steve Wilkes, Founder and CTO at Striim, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
SYS-CON Events announced today that Calligo, an innovative cloud service provider offering mid-sized companies the highest levels of data privacy and security, has been named "Bronze Sponsor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Calligo offers unparalleled application performance guarantees, commercial flexibility and a personalised support service from its globally located cloud plat...
SYS-CON Events announced today that DXWorldExpo has been named “Global Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Digital Transformation is the key issue driving the global enterprise IT business. Digital Transformation is most prominent among Global 2000 enterprises and government institutions.
SYS-CON Events announced today that Datera, that offers a radically new data management architecture, has been named "Exhibitor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Datera is transforming the traditional datacenter model through modern cloud simplicity. The technology industry is at another major inflection point. The rise of mobile, the Internet of Things, data storage and Big...
"MobiDev is a Ukraine-based software development company. We do mobile development, and we're specialists in that. But we do full stack software development for entrepreneurs, for emerging companies, and for enterprise ventures," explained Alan Winters, U.S. Head of Business Development at MobiDev, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
SYS-CON Events announced today that DXWorldExpo has been named “Global Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Digital Transformation is the key issue driving the global enterprise IT business. Digital Transformation is most prominent among Global 2000 enterprises and government institutions.
In his opening keynote at 20th Cloud Expo, Michael Maximilien, Research Scientist, Architect, and Engineer at IBM, discussed the full potential of the cloud and social data requires artificial intelligence. By mixing Cloud Foundry and the rich set of Watson services, IBM's Bluemix is the best cloud operating system for enterprises today, providing rapid development and deployment of applications that can take advantage of the rich catalog of Watson services to help drive insights from the vast t...
SYS-CON Events announced today that EnterpriseTech has been named “Media Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. EnterpriseTech is a professional resource for news and intelligence covering the migration of high-end technologies into the enterprise and business-IT industry, with a special focus on high-tech solutions in new product development, workload management, increased effic...
SYS-CON Events announced today that Massive Networks, that helps your business operate seamlessly with fast, reliable, and secure internet and network solutions, has been named "Exhibitor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. As a premier telecommunications provider, Massive Networks is headquartered out of Louisville, Colorado. With years of experience under their belt, their team of...
SYS-CON Events announced today that Cloud Academy named "Bronze Sponsor" of 21st International Cloud Expo which will take place October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara, CA. Cloud Academy is the industry’s most innovative, vendor-neutral cloud technology training platform. Cloud Academy provides continuous learning solutions for individuals and enterprise teams for Amazon Web Services, Microsoft Azure, Google Cloud Platform, and the most popular cloud com...