Welcome!

Linux Containers Authors: Liz McMillan, Pat Romanski, Elizabeth White, Yeshim Deniz, Roger Strukhoff

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
SYS-CON Events announced today that Evatronix 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. Evatronix SA offers comprehensive solutions in the design and implementation of electronic systems, in CAD / CAM deployment, and also is a designer and manufacturer of advanced 3D scanners for professional applications.
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. In his session at @BigDataExpo, Jack Norris, Senior Vice President, Data and Applications at MapR Technologies, reviewed best practices to ...
SYS-CON Events announced today that Synametrics Technologies will exhibit at SYS-CON's 22nd International Cloud Expo®, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. Synametrics Technologies is a privately held company based in Plainsboro, New Jersey that has been providing solutions for the developer community since 1997. Based on the success of its initial product offerings such as WinSQL, Xeams, SynaMan and Syncrify, Synametrics continues to create and hone inn...
"Evatronix provides design services to companies that need to integrate the IoT technology in their products but they don't necessarily have the expertise, knowledge and design team to do so," explained Adam Morawiec, VP of Business Development at Evatronix, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
Recently, REAN Cloud built a digital concierge for a North Carolina hospital that had observed that most patient call button questions were repetitive. In addition, the paper-based process used to measure patient health metrics was laborious, not in real-time and sometimes error-prone. In their session at 21st Cloud Expo, Sean Finnerty, Executive Director, Practice Lead, Health Care & Life Science at REAN Cloud, and Dr. S.P.T. Krishnan, Principal Architect at REAN Cloud, discussed how they built...
No hype cycles or predictions of a gazillion things here. IoT is here. You get it. You know your business and have great ideas for a business transformation strategy. What comes next? Time to make it happen. In his session at @ThingsExpo, Jay Mason, an Associate Partner of Analytics, IoT & Cybersecurity at M&S Consulting, presented a step-by-step plan to develop your technology implementation strategy. He also discussed the evaluation of communication standards and IoT messaging protocols, data...
With tough new regulations coming to Europe on data privacy in May 2018, Calligo will explain why in reality the effect is global and transforms how you consider critical data. EU GDPR fundamentally rewrites the rules for cloud, Big Data and IoT. In his session at 21st Cloud Expo, Adam Ryan, Vice President and General Manager EMEA at Calligo, examined the regulations and provided insight on how it affects technology, challenges the established rules and will usher in new levels of diligence arou...
Smart cities have the potential to change our lives at so many levels for citizens: less pollution, reduced parking obstacles, better health, education and more energy savings. Real-time data streaming and the Internet of Things (IoT) possess the power to turn this vision into a reality. However, most organizations today are building their data infrastructure to focus solely on addressing immediate business needs vs. a platform capable of quickly adapting emerging technologies to address future ...
In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, led attendees through the exciting evolution of the cloud. He looked at this major disruption from the perspective of technology, business models, and what this means for enterprises of all sizes. John Considine is General Manager of Cloud Infrastructure Services at IBM. In that role he is responsible for leading IBM’s public cloud infrastructure including strategy, development, and offering m...
In his session at 21st Cloud Expo, Raju Shreewastava, founder of Big Data Trunk, provided a fun and simple way to introduce Machine Leaning to anyone and everyone. He solved a machine learning problem and demonstrated an easy way to be able to do machine learning without even coding. Raju Shreewastava is the founder of Big Data Trunk (www.BigDataTrunk.com), a Big Data Training and consulting firm with offices in the United States. He previously led the data warehouse/business intelligence and B...
The 22nd International Cloud Expo | 1st DXWorld Expo has announced that its Call for Papers is open. Cloud Expo | DXWorld Expo, to be held June 5-7, 2018, at the Javits Center in New York, NY, brings together Cloud Computing, Digital Transformation, Big Data, Internet of Things, DevOps, Machine Learning and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding busin...
Nordstrom is transforming the way that they do business and the cloud is the key to enabling speed and hyper personalized customer experiences. In his session at 21st Cloud Expo, Ken Schow, VP of Engineering at Nordstrom, discussed some of the key learnings and common pitfalls of large enterprises moving to the cloud. This includes strategies around choosing a cloud provider(s), architecture, and lessons learned. In addition, he covered some of the best practices for structured team migration an...
22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud ...
22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud ...
DevOps at Cloud Expo – being held June 5-7, 2018, at the Javits Center in New York, NY – announces that its Call for Papers is open. Born out of proven success in agile development, cloud computing, and process automation, DevOps is a macro trend you cannot afford to miss. From showcase success stories from early adopters and web-scale businesses, DevOps is expanding to organizations of all sizes, including the world's largest enterprises – and delivering real results. Among the proven benefits,...
@DevOpsSummit at Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, is co-located with 22nd Cloud Expo | 1st DXWorld Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to wait...
Cloud Expo | DXWorld Expo have announced the conference tracks for Cloud Expo 2018. Cloud Expo will be held June 5-7, 2018, at the Javits Center in New York City, and November 6-8, 2018, at the Santa Clara Convention Center, Santa Clara, CA. Digital Transformation (DX) is a major focus with the introduction of DX Expo within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive ov...
SYS-CON Events announced today that T-Mobile exhibited at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. As America's Un-carrier, T-Mobile US, Inc., is redefining the way consumers and businesses buy wireless services through leading product and service innovation. The Company's advanced nationwide 4G LTE network delivers outstanding wireless experiences to 67.4 million customers who are unwilling to compromise on qua...
SYS-CON Events announced today that Cedexis 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. Cedexis is the leader in data-driven enterprise global traffic management. Whether optimizing traffic through datacenters, clouds, CDNs, or any combination, Cedexis solutions drive quality and cost-effectiveness. For more information, please visit https://www.cedexis.com.
SYS-CON Events announced today that Google Cloud has been named “Keynote 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. Companies come to Google Cloud to transform their businesses. Google Cloud’s comprehensive portfolio – from infrastructure to apps to devices – helps enterprises innovate faster, scale smarter, stay secure, and do more with data than ever before.