# Adding hard disk

## peter121

Ive just purchased a new 120gb disk that I plan on using as a place for /home

So far I have,

fitted the disk

created the partition

created a file system (mke2fs /dev/hdd)

Now Im confused as to what else I need to do before I can use home on /dev/hdd instead of /dev/hda3

----------

## Tyir

this is what you do:

umount /mnt/home (unmount it)

then edit /etc/fstab

put in

```

/dev/hdd       /home     ext2        noatime 0 0

```

Remove the /dev/hda3 entry

but the way, did you want to journal it, so it was ext3? You should..

Anyway, then you can just do mount /mnt/home

----------

## peter121

```
# /etc/fstab: static file system information.

# noatime turns off atimes for increased performance (atimes normally aren't

# needed; notail increases performance of ReiserFS (at the expense of storage

# efficiency).  It's safe to drop the noatime options if you want and to

# switch between notail and tail freely.

# <fs>                  <mountpoint>    <type>          <opts>                  <dump/pass>

/dev/hda1               /boot           ext2            defaults,noatime        1 2

/dev/hda2               none            swap            sw                      0 0

/dev/hda3               /               ext3            noatime                 0 1

none                    /proc           proc            defaults                0 0

none                    /dev/shm        tmpfs           nodev,nosuid,noexec     0 0

/dev/cdrom              /mnt/cdrom      auto            noauto,user             0 0

```

If I remove /dev/hda3 from /etc/fstab will my system still boot as I have all the major files there...?

Would you say something like this would work? I would obviously have to rename /home on hda3 to something like home_backup to prevent any problems..

```

# /etc/fstab: static file system information.

# noatime turns off atimes for increased performance (atimes normally aren't

# needed; notail increases performance of ReiserFS (at the expense of storage

# efficiency).  It's safe to drop the noatime options if you want and to

# switch between notail and tail freely.

# <fs>                  <mountpoint>    <type>          <opts>                  <dump/pass>

/dev/hda1               /boot           ext2            defaults,noatime        1 2

/dev/hda2               none            swap            sw                      0 0

/dev/hda3               /               ext3            noatime                 0 1

/dev/hdd                /home           ext2            noatime                 0 1

none                    /proc           proc            defaults                0 0

none                    /dev/shm        tmpfs           nodev,nosuid,noexec     0 0

/dev/cdrom              /mnt/cdrom      auto            noauto,user             0 0

```

----------

## Tyir

Yep, thats exactly what you want.

And move the copied files over after you boot.

----------

## Gentree

tyr , please dont post "help" if you do not really know yourself, even if meant well is worse than no help.

 *Quote:*   

> /dev/hdd       /home     ext2        noatime 0 0

 

/dev/hdd is the disk, starting at the mbr , it does not refer to his partition.

 *Quote:*   

> umount /mnt/home

 

who said anything about /mnt/home ?

 *Quote:*   

> Remove the /dev/hda3 entry

 

why are you telling him to remove his root partition from fstab ??  :Rolling Eyes: 

@peter121

It seems you are pretty confused about you want to do here.

Accepting that you have a good reason form making your new disk into one huge partition and using that for /home , why are you messing with / ?

You say you made a partition, with which program? /dev/hdd is a disk not a partition . If you did mkfs /dev/hdd afterwards you just blew away the partition table! It should have been /dev/hdd1 I imagine.

For what you describe:

use parted or cfdisk of similar to create your partition.

You will need to reboot to see this partition appear as /dev/hdd1

fomat a partition to be used as /home.

You should use a journalling fs like ext3 or reiserfs rather than ext2 , they are more reliable.

mkfs.ext3 /dev/hdd1

mount -t ext3 /dev/hdd1 /home_tmp

cp -a /home/* /home_tmp

cd /

umount /home_tmp

mount -t ext3 /dev/hdd1 /home

you can now enjoy your new home

now add hdd1 to /etc/fstab

do _not_ remove hda3 

no need to reboot .

Finally , unless you really need 120G of /home I suggest a smaller partition , you will probably find better uses for the rest of that disk.

HTH  :Cool: 

----------

## Tyir

Blah, he's totally right, I knew what to do, but I didn't write what I meant to write.

Of course you have to partition it first, and I for some reason I understood he already had a seperate partition for home.

Sorry!

----------

## Gentree

There are two things I have learnt in life: 

2. Mix it around to confuse the oppostion  :Wink: 

----------

## kar1107

Adding Gentree's excellent explanation....

First the OP doesn't seem to have a separate /home partition. He wan't to create a new partitiion now.

So he may not be able to do...

umount /home

I think after cp -a /home/* /dev/hdd1,

cd /

mount -t ext3 /dev/hdd1 /home. 

We'll see the new /home; but the old home is still lurking underneath. If he wants to reclaim the disk

space, the only way I can think of is... do a \rm -rf /home/* (that ought to be done carefully though  :Wink:  ),

after the copy. Another safe way is to login from a liveCD or another disk (if linux is available) and do

the cleanup and reclaim the diskspace under /home

----------

## Gentree

 *Quote:*   

> Now Im confused as to what else I need to do before I can use home on /dev/hdd instead of /dev/hda3

 

Since he is obviously still learning (as we all are) I would recommend leaving the contents of /home on /dev/hda3 hidden and untouched for a while incase he does something silly like formatting the disk instead of the partition. wink:

I have corrected the post. What I meant was

```
umount /home_tmp
```

umount /home would have given an error , so I guess he has not read the post yet.

You are indeed quite correct about recovering the disk space, thanks for picking up my error.  :Cool: 

----------

## peter121

Thanks for your help,

I have the new drive working fine, the filesystem is however ext2, is it safe to upgrade to ext3 with data on the disk?

 *Quote:*   

> 
> 
> You say you made a partition, with which program? /dev/hdd is a disk not a partition . If you did mkfs /dev/hdd afterwards you just blew away the partition table! It should have been /dev/hdd1 I imagine. 

 

/dev/hdd is the 120gb disk, I dont have /dev/hdd1

----------

## Gentree

Not that I know of , but I never had the need for ext2, it's older than the ark.

Well I did suggest not using it as one huge partition , now you see one reason why.

If you have followed my other suggestion above you will still have a copy  of your old content on the original drive. Just umount /dev/hdd and you will see it again. (How did I know you were going to need it ?)

Once you get out of that one I would suggest using a few gigs of all that lovely space to clone your root partition. Even if you do nothing daft (and we all do) portage will sooner or later. If you have a nice clean working system make a snap-shot of it and add it to your grub.conf so next time you cant boot you have a fall-back system .

This will save you days of work sometime soon.

 :Cool: 

----------

## macawgumbo

You should use reiserfs as it is stable and faster than ext3.  You should try reiserfs4 which is the fastest filesystem especially since it is stable now, and you don't have to reinstall because it isn't your root partition.

----------

## Gentree

 *Quote:*   

> You should use reiserfs as it is stable and faster than ext3

  Oh yeah, can you back that up . It's the complete opposite to all the data I have seen. (Speed not stablility wise I mean.)

Less of the "you should" until you do your homework. I prefer "you could try".

I was not going to complicate the thread with fs args but since you brought it up:

I am a fan of Reiser4 which is sometimes faster that ext3 depending on what you are doing with it.

I use it for portage mainly. I recently copied my whole portage tree back and forth quite a bit and got noticably faster times from R4. For other situations it can be a bit slower.

There are constant flame wars about R4 and some devs will spit on your grave for just daring to name it.

Seriously some ppl have had problems on intel HT  and multi-processor systems it seems.

Although most of that is fixed I beleive.

I use it on athlon-xp and it has worked beautifully for over a year.

Stick to ext3 until you get things sorted out. Since you will have broken up your 120G by then just make an R4 partition , dupe a partition and remount the new copy and see if works for you.

----------

## peter121

I Have just under 80gb free on my root drive,

The purpose of the 120gb drive is for movies, music and genreally all my work.

I did create a backup, so ill upgrade the disk and then revert to the backup if things go wrong

----------

## Gentree

There's lots of reasons for using smaller partitions even if you are doing space hungry work like video.

Imagine a power-out or hardware error corrupts you fs. Would you rather lose 20G or 120G?

Dont forget that with Linux you can just mount each partition anywhere in the tree. So you really dont notice once you have mounted the partitions from fstab at boot.

Creating a couple primary partitions then an extended one to fill the rest of the disk will leave you much more flexibility to organise your disk later. If you dont do that now then you're going to need to borrow another 120G drive later if you want to break things up a bit.

Anyway , glad you got everthing working with the new drive. Glad I could help.

You may later like to look into xfs which is reckoned to be very fast for handling "a few v.large files " type situation.

 :Cool: 

 *macawgumbo wrote:*   

> **The man with one ball uses Linux, the man with both uses Gentoo. Who do you think performs better?**

  Yeah? and which OS do eunuques use then?

----------

## omnicloud

Windows of course >_>

----------

## Gentree

Doh, the winning answer is : eunix !  :Rolling Eyes: 

----------

