Welcome!

Linux Containers Authors: Liz McMillan, Robin Miller, Bob Gourley, XebiaLabs Blog, 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
Data is an unusual currency; it is not restricted by the same transactional limitations as money or people. In fact, the more that you leverage your data across multiple business use cases, the more valuable it becomes to the organization. And the same can be said about the organization’s analytics. In his session at 19th Cloud Expo, Bill Schmarzo, CTO for the Big Data Practice at Dell EMC, introduced a methodology for capturing, enriching and sharing data (and analytics) across the organization...
SYS-CON Events announced today that T-Mobile will exhibit 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 ...
The explosion of new web/cloud/IoT-based applications and the data they generate are transforming our world right before our eyes. In this rush to adopt these new technologies, organizations are often ignoring fundamental questions concerning who owns the data and failing to ask for permission to conduct invasive surveillance of their customers. Organizations that are not transparent about how their systems gather data telemetry without offering shared data ownership risk product rejection, regu...
Bert Loomis was a visionary. This general session will highlight how Bert Loomis and people like him inspire us to build great things with small inventions. In their general session at 19th Cloud Expo, Harold Hannon, Architect at IBM Bluemix, and Michael O'Neill, Strategic Business Development at Nvidia, discussed the accelerating pace of AI development and how IBM Cloud and NVIDIA are partnering to bring AI capabilities to "every day," on-demand. They also reviewed two "free infrastructure" pr...
New competitors, disruptive technologies, and growing expectations are pushing every business to both adopt and deliver new digital services. This ‘Digital Transformation’ demands rapid delivery and continuous iteration of new competitive services via multiple channels, which in turn demands new service delivery techniques – including DevOps. In this power panel at @DevOpsSummit 20th Cloud Expo, moderated by DevOps Conference Co-Chair Andi Mann, panelists will examine how DevOps helps to meet th...
With major technology companies and startups seriously embracing IoT strategies, now is the perfect time to attend @ThingsExpo 2016 in New York. Learn what is going on, contribute to the discussions, and ensure that your enterprise is as "IoT-Ready" as it can be! Internet of @ThingsExpo, taking place June 6-8, 2017, at the Javits Center in New York City, New York, is co-located with 20th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry p...
With billions of sensors deployed worldwide, the amount of machine-generated data will soon exceed what our networks can handle. But consumers and businesses will expect seamless experiences and real-time responsiveness. What does this mean for IoT devices and the infrastructure that supports them? More of the data will need to be handled at - or closer to - the devices themselves.
Grape Up is a software company, specialized in cloud native application development and professional services related to Cloud Foundry PaaS. With five expert teams that operate in various sectors of the market across the USA and Europe, we work with a variety of customers from emerging startups to Fortune 1000 companies.
The age of Digital Disruption is evolving into the next era – Digital Cohesion, an age in which applications securely self-assemble and deliver predictive services that continuously adapt to user behavior. Information from devices, sensors and applications around us will drive services seamlessly across mobile and fixed devices/infrastructure. This evolution is happening now in software defined services and secure networking. Four key drivers – Performance, Economics, Interoperability and Trust ...
Financial Technology has become a topic of intense interest throughout the cloud developer and enterprise IT communities. Accordingly, attendees at the upcoming 20th Cloud Expo at the Javits Center in New York, June 6-8, 2017, will find fresh new content in a new track called FinTech.
Today we can collect lots and lots of performance data. We build beautiful dashboards and even have fancy query languages to access and transform the data. Still performance data is a secret language only a couple of people understand. The more business becomes digital the more stakeholders are interested in this data including how it relates to business. Some of these people have never used a monitoring tool before. They have a question on their mind like “How is my application doing” but no id...
SYS-CON Events announced today that Interoute, owner-operator of one of Europe's largest networks and a global cloud services platform, has been named “Bronze Sponsor” of SYS-CON's 20th Cloud Expo, which will take place on June 6-8, 2017 at the Javits Center in New York, New York. Interoute is the owner-operator of one of Europe's largest networks and a global cloud services platform which encompasses 12 data centers, 14 virtual data centers and 31 colocation centers, with connections to 195 add...
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm.
SYS-CON Events announced today that Juniper Networks (NYSE: JNPR), an industry leader in automated, scalable and secure networks, will exhibit 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. Juniper Networks challenges the status quo with products, solutions and services that transform the economics of networking. The company co-innovates with customers and partners to deliver automated, scalable and secure network...
The age of Digital Disruption is evolving into the next era – Digital Cohesion, an age in which applications securely self-assemble and deliver predictive services that continuously adapt to user behavior. Information from devices, sensors and applications around us will drive services seamlessly across mobile and fixed devices/infrastructure. This evolution is happening now in software defined services and secure networking. Four key drivers – Performance, Economics, Interoperability and Trust ...
In his keynote at @ThingsExpo, Chris Matthieu, Director of IoT Engineering at Citrix and co-founder and CTO of Octoblu, focused on building an IoT platform and company. He provided a behind-the-scenes look at Octoblu’s platform, business, and pivots along the way (including the Citrix acquisition of Octoblu).
SYS-CON Events announced today that Hitachi Data Systems, a wholly owned subsidiary of Hitachi LTD., will exhibit 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. Hitachi Data Systems (HDS) will be featuring the Hitachi Content Platform (HCP) portfolio. This is the industry’s only offering that allows organizations to bring together object storage, file sync and share, cloud storage gateways, and sophisticated search an...
@GonzalezCarmen has been ranked the Number One Influencer and @ThingsExpo has been named the Number One Brand in the “M2M 2016: Top 100 Influencers and Brands” by Analytic. Onalytica analyzed tweets over the last 6 months mentioning the keywords M2M OR “Machine to Machine.” They then identified the top 100 most influential brands and individuals leading the discussion on Twitter.
The Internet of Things is clearly many things: data collection and analytics, wearables, Smart Grids and Smart Cities, the Industrial Internet, and more. Cool platforms like Arduino, Raspberry Pi, Intel's Galileo and Edison, and a diverse world of sensors are making the IoT a great toy box for developers in all these areas. In this Power Panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists discussed what things are the most important, which will have the most profound e...
@ThingsExpo has been named the Most Influential ‘Smart Cities - IIoT' Account and @BigDataExpo has been named fourteenth by Right Relevance (RR), which provides curated information and intelligence on approximately 50,000 topics. In addition, Right Relevance provides an Insights offering that combines the above Topics and Influencers information with real time conversations to provide actionable intelligence with visualizations to enable decision making. The Insights service is applicable to eve...