Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the following output of df -h you can see that i have added a new hard drive(/dev/hdd1) and have mounted as /hdd1.

My question is if I start dumping data to /opt will that data be mounted in /hdd1 or /

My goal is to utilise the new hdd1 instead of old disk(/dev/sda3).

How can this be done?

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             442G  312G   12G  86% /
tmpfs                 1.9G     0  1.9G   0% /dev/shm
/dev/sda1             194M   57M  128M  31% /boot
/dev/sdb1             1.7T  201M  2.6T   1% /hdd1
share|improve this question
why -1 please respond – Rajeev Sep 9 '12 at 9:12
up vote 2 down vote accepted

You probably can't do this easily without reformatting/repartitioning.

Here's what you need to do.

  1. Back everything up.
  2. Repartition the disks as LVM partitions.
  3. Set up LVM Volume Groups on the disks (or one big one across multiple physical volumes).
  4. Set up LVM Logical Volumes for / and any other mount points.
  5. Bask in the glory of using Logical Volume Management to reallocate space as and when you want.

I really don't want to go into the length of explaining the ins and outs of LVM, because you can pretty much just read the documentation. But that's how I'd do it.

I suppose you might be able to copy everything from the old disk to the new one, and then change the Grub configuration and MBR, but I think it'd probably be more scalable in the future to use LVM.

If you just dump data on /opt it'll still go onto the old, full disk, unless you mount /dev/sdb1 onto /opt.

share|improve this answer
Of course, one can also create /sdb1/opt and then just symlink /opt to it. – Janne Pikkarainen Sep 9 '12 at 9:55
There's something about symlinks at level 0 that make me feel quite dirty. – Tom O'Connor Sep 9 '12 at 15:41

As asked: with the above configuration, in the absence of any other information, if you write to /opt, it will be stored in /, also known as sda3.

Depending on what your data is and where it is stored, you have some options.

  • You could take Tom's advice and rebuild everything into a volume-group LVM.
  • If you are going to rebuild everything anyways, take your existing disk out and rebuild onto the brand-new large disk, then copy your data disk-to-disk and keep the old disk as a standby snapshot in case something goes horribly wrong.
  • You can move your large subdirectories in /opt to /hdd1, then create a symbolic link from /opt/$DIR to /hdd1/$DIR. (Note -- be sure the application being moved is shut down when you do this.) This lets you keep your existing system without having to rebuild everything and lets you move pieces to the new storage.

Personally I'd also rename /hdd1 to be /sdb1 or /disk2, because hdd1 means something in linux and the you are using is inconsistent with what it really is -- but that's just me.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.