Require help with mounting additional hard drive on ubuntu linux

ant80

Senior member
Dec 4, 2001
411
0
0
when I do df -h, I get the following
Filesystem Size Used Avail Use% Mounted on
/dev/hdc1 109G 63G 41G 62% /
tmpfs 253M 0 253M 0% /dev/shm
/dev 109G 63G 41G 62% /.dev
none 5.0M 2.8M 2.3M 55% /dev


when I do df -h hdd1 from the /dev directory, I get the following
Filesystem Size Used Avail Use% Mounted on
none 5.0M 2.8M 2.3M 55% /dev


The second hard drive is 160GB. I need to be able to partition it and mount it at a particular location. What commands do I need to execute in sequence for that to happen? The directory where I need to mount it is /home/<username>/Desktop/.

I am a linux n00b who only has a rudimentary understanding of the file system that linux follows. I would greatly appreciate it if any assistance can be provided with my background in mind. Thanks.
- ant80
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
First fireup fdisk

fdisk /dev/hdb (or whatever the drive is)

then make your partition

(assuming you know how to use fdisk)

Next format the drive with the filesystem you want to use

mk2fs -j /dev/hdb (for ext3)
mkreiserfs /dev/hdb (for reiser)

next mount that drive somewhere temporary

mkdir /mnt/newdrive
mount /dev/hdb /mnt/newdrive

Now cp all your desktop items to the new location

cp /home/user/desktop /mnt/newdrive/

now delete everything on your desktop

rm -rf /home/user/desktop/*

Now umount the temp drive

umount /mnt/newdrive

Then mount the drive on desktop

mount /dev/hdb /home/user/desktop

Now edit the /etc/fstab file so this will happen automagically in the future

vi /etc/fstab

add a line similar to this (look at how your fstab is formatted, and copy it)

/dev/hdb /home/user/desktop reiserfs notail 0 1


Save and you are good to go.

Although, instead of just replacing the desktop. I would just move /home to its own drive/partition. It makes more sense.

 

nweaver

Diamond Member
Jan 21, 2001
6,813
1
0
make sure you mount/fstab isn't just the drive, but drive and partition, /dev/hdb1 instead of /dev/hdb (oversight on SN, I'm sure)
 

ant80

Senior member
Dec 4, 2001
411
0
0
I tried doing fdisk /dev/hdd, but it says Unable to open /dev/hdd.

When I do df -h /dev/hdd, I get the following
Filesystem Size Used Avail Use% Mounted on
none 5.0M 2.8M 2.3M 55% /dev


Does this have anything to do with it? Thanks.

edit: I forgot to mention, the hard drive is the secondary slave, which is why I am using hdd. Or is this wrong? Thanks.
 

The Scientist

Member
Aug 18, 2005
81
0
0
Ok, so whatever you have on you other HDD's you have your HDC1 which is linux OS and HDD1 on which you have your /home

If you know what the filesystem is this is kinda easy it's mount hdd1 (filesystem) (options) mount point.

Example mount hdd1 vfat /media/home

although, it this is a preserved home system, you should mount it to /home and edit your fstab

RTFM
 

ant80

Senior member
Dec 4, 2001
411
0
0
First of all, I'd like to thank everyone thats attempted to help me so far.

When I did dmesg | less, I get the following
Probing IDE interface ide0...
hda: TDK DVDRW840G, ATAPI CD/DVD-ROM drive
elevator: using anticipatory as default io scheduler
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
Probing IDE interface ide1...
hdc: WDC WD1200BB-00CAA1, ATA DISK drive
hdd: WDC WD1600JB-00EVA0, ATA DISK drive
ide1 at 0x170-0x177,0x376 on irq 15
hdc: max request size: 128KiB
hdc: Host Protected Area detected.
current capacity is 234439535 sectors (120033 MB)
native capacity is 234441648 sectors (120034 MB)
hdc: Host Protected Area disabled.
hdc: 234441648 sectors (120034 MB) w/2048KiB Cache, CHS=65535/16/63, UDMA(100)
hdc: cache flushes not supported
/dev/ide/host0/bus1/target0/lun0: p1 p2 < p5 >
hdd: max request size: 1024KiB
hdd: 312581808 sectors (160041 MB) w/8192KiB Cache, CHS=19457/255/63, UDMA(100)
hdd: cache flushes supported
/dev/ide/host0/bus1/target1/lun0: p1 < >


Well, it gave more than that, but this is the info pertaining to the IDE stuff.

As far as what The Scientist said, I am not sure why you say that the /home is mounted on hdd1. I only used hdc for installation of the OS. As I mentioned above, I only have a rudimentary understanding of the filesystem in linux, so I could be wrong there.

The problem is, hdd1 says that it is only 5MB in size, but I know that hdd is actually 160GB. Where is all the extra space going to? I assume it is unformatted, unpartitioned space, but I could be wrong.

Is there a command for finding out the filesystem on this drive? Also, that last sentence did not make any sense.

As sourceninja said, I tried doing the commands, but there is no command called mk2fs. I tried man mk2fs, it says the command is not found either. I am at a total loss.
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
Nice catch on my typo. I forget to proof read sometimes hehe.

Sorry its mke2fs

I'm not the best proof reader :-D
 

ant80

Senior member
Dec 4, 2001
411
0
0
Originally posted by: nweaver
fdisk /dev/hdc
l (L)
q
fdisk /dev/hdd
l
q
(Post output)

Folks, I'm sorry for the delay but they were laying the back alley behind my house last week, and apparently, they knocked down the telephone pole. I have DSL, and I lost service for more than a week.

Here's the info
/etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/hdc1 / ext3 defaults,errors=remount-ro 0 1
/dev/hdc5 none swap sw 0 0
/dev/hda /media/cdrom0 udf,iso9660 ro,user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0


Good news is I was able to figure out why it says "unable to open the device". Apparently, all I needed to do was sudo fdisk /dev/hdc. I have mounted the drive on /mnt/newdrive and now, when I do df -h, I get the following:
Filesystem Size Used Avail Use% Mounted on
/dev/hdc1 109G 99G 5.1G 96% /
tmpfs 253M 0 253M 0% /dev/shm
/dev 109G 99G 5.1G 96% /.dev
none 5.0M 2.8M 2.3M 55% /dev
/dev/hdd 147G 33M 140G 1% /mnt/newdrive


I have even tested it out in the file viewer provided by ubuntu, when i get into /mnt, it says only 5 GB remaining, but when I go into /mnt/newdrive, I get a whooping 140GB remaining. One question is, I see a folder called lost+found in /mnt/newdrive, which closes the file browser whenever I try to see what is in it. So what is in it, and what does it do?

Now, after sourceninja suggested that I just move /home to the new drive, I asked around and everyone I talked to suggested that that was a good idea. In retrospect, I should've asked how I should set things up, but oh well... Aniway I want to do that instead. So here's the situation:
Currently, the only thing I'm using is the 120GB hard drive. There is one folder called fmriData on desktop that occupies nearly 100GB of that. I have a home network that I have set up that allows me access to this folder from a windows comp. I want to leave this on the 120GB drive, but I NEED ACCESS TO THIS FOLDER FROM MY WINDOWS MACHINE AT ALL TIMES. On top of that, I want to move the /home to the new 160GB drive, where I plan to store other items that will probably take up more than 100GB.

In other words, to summarise,
- want to move /home from 120GB drive to 160GB drive
- want to keep fmriData on the 120GB drive, but still retain access to it from windows machine
- want to have access to data on 160GB drive from windows machine

How do I go from my current configuration to that? And in the same vein as not making the same mistake twice, do u guys think this is an optimal way to set things up? Or is there a different way to set things up that would be better? Thanks.
- ant
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
I think lost+found is really only important on non-journalling filesystems (ext2). Type mount to find out what options are being used for your file systems. If I'm right, it has to deal with file fragments and stuff from fsck being run after a filesystem wasn't unmounted properly. IIRC, it's only accessible to root. I could be wrong about all of it though.
These people seem to agree.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
If you have Samba installed to access that data from the Windows machine, you should be able to configure it to share the data from a different location.

Basic steps to switch home over to the other drive:
  1. boot into single user mode (for LILO: boot_name -s replacing boot_name with whatever the proper label is)
  2. mount the root drive read/write (mount -u -o rw /)
  3. mount the new hard drive in a temporary location (mount /dev/hdd1 /mnt)
  4. copy all data from the old /home directory to the new drive (cp -a /home/* /mnt/ Just a note, I believe the -a flag is a linux-ism and -pR is about the same on some other platforms)
  5. move the /home directory to a new location so it does not conflict with the new disk (mv /home /home2)
  6. create a new /home directory (mkdir /home)
  7. add an entry to /etc/fstab for the new drive (maybe: /dev/hdd1 /home ext3fs defaults 0 1)
  8. umount the new home from the temporary location (umount /mnt)
  9. mount the new home in the proper location (mount /home)
  10. type exit to boot to multiuser mode

EDIT: Fixed /NUM.
 

ant80

Senior member
Dec 4, 2001
411
0
0
Originally posted by: n0cmonkey
If you have Samba installed to access that data from the Windows machine, you should be able to configure it to share the data from a different location.

Basic steps to switch home over to the other drive:
  1. boot into single user mode (for LILO: boot_name -s replacing boot_name with whatever the proper label is)
  2. mount the root drive read/write (mount -u -o rw /)
  3. mount the new hard drive in a temporary location (mount /dev/hdd1 /mnt)
  4. copy all data from the old /home directory to the new drive (cp -a /home/* /mnt/ Just a note, I believe the -a flag is a linux-ism and -pR is about the same on some other platforms)
  5. move the /home directory to a new location so it does not conflict with the new disk (mv /home /home2)
  6. create a new /home directory (mkdir /home)
  7. add an entry to /etc/fstab for the new drive (maybe: /dev/hdd1 /home ext3fs defaults 0 1)
  8. umount the new home from the temporary location (umount /mnt)
  9. mount the new home in the proper location (mount /home)
  10. type exit to boot to multiuser mode


  1. First of all, I LOVE your sig. I kinda relate to it because I feel the same way about MRI, which is my research area at this stage.

    Aniway,
    Point 1: In ubuntu, I usually log in as my own username, is that single user mode? If not, I how do I get into it? boot_name -s with boot_name replaced by label. What is a proper label?
    Point 2: I assume you meant mount -U -o rw /, with a capital U instead of a lower case u. When I did sudo mount -U -o rw / and enter password, I get a message saying mount: no such partition found. I checked for the presence of the file /proc/partitions
    major minor #blocks name

    22 0 117220824 hdc
    22 1 115708131 hdc1
    22 2 1 hdc2
    22 5 1510078 hdc5
    22 64 156290904 hdd
    22 65 156288321 hdd1
    254 0 115708131 dm-0
    254 1 1510078 dm-1

    How do I get around that? Also, what is the purpose of this statement? Why can't I just go through to the 3rd step instead of this one?

    I kinda have a lot of things running in my mind, and I am very confused about how stuff works here. (Insert your sig here, lol)
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
I was going to respond to this last night, but got interrupted. Sorry.

Originally posted by: ant80
First of all, I LOVE your sig. I kinda relate to it because I feel the same way about MRI, which is my research area at this stage.

It's a quote from a Dune book, I think. My fortune(6) spits them out when I log in to my server.

Aniway,
Point 1: In ubuntu, I usually log in as my own username, is that single user mode? If not, I how do I get into it? boot_name -s with boot_name replaced by label. What is a proper label?

By the proper label I meant whatever your Linux install is called. I posted the information for LILO, I don't know how to do it in grub. You're probably using grub though.

These instructions may help you figure it out. You may also be able to type in a terminal: init 1 which should put you in single user mode.

Point 2: I assume you meant mount -U -o rw /, with a capital U instead of a lower case u. When I did sudo mount -U -o rw / and enter password, I get a message saying mount: no such partition found. I checked for the presence of the file /proc/partitions
major minor #blocks name

22 0 117220824 hdc
22 1 115708131 hdc1
22 2 1 hdc2
22 5 1510078 hdc5
22 64 156290904 hdd
22 65 156288321 hdd1
254 0 115708131 dm-0
254 1 1510078 dm-1

How do I get around that? Also, what is the purpose of this statement? Why can't I just go through to the 3rd step instead of this one?

In single user mode all partitions are mounted read only. The -u (little u, unless ubuntu is using unstandard options) tells mount(8) to change the status of an already mounted partition. To quote from the man page (from OpenBSD):
-u The -u flag indicates that the status of an already mounted file system should be changed. Any of the options discussed above (the -o option) may be changed; also a file system can be changed from read-only to read-write or vice versa. An attempt to change from read-write to read-only will fail if any files on the file system are currently open for writing unless the -f flag is also specified. Only options specified on the command line with -o are changed; other file system options are unaltered. The options set in the fstab(5) table are ignored.

The -o rw should tell mount(8) to mount the partition read write.

I'm not sure why it is telling you / isn't mounted, it's kind of important to the system.

I kinda have a lot of things running in my mind, and I am very confused about how stuff works here. (Insert your sig here, lol)

It takes some getting used to. It's like a foreign language. Use it a lot and you'll start to know it. One day you might wake up and it'll hit you like a ton of bricks.
 

ant80

Senior member
Dec 4, 2001
411
0
0
Someday, I am going to figure out how to do all that fancy stuff to optimize the configuration, but it seems that today is not the day. After playing around with all this stuff for a while, I decided to go back to just mounting the new hard drive on the already existing location, namely /home/<user>/Desktop/fmriData/Drive. I did that using the command sudo mount /dev/hdd /home/<user>/Desktop/fmriData/Drive/. Now when I do df -h, I get the following
Filesystem Size Used Avail Use% Mounted on
/dev/hdc1 109G 98G 5.2G 96% /
tmpfs 253M 0 253M 0% /dev/shm
/dev 109G 98G 5.2G 96% /.dev
none 5.0M 2.8M 2.3M 55% /dev
/dev/hdd 147G 33M 140G 1% /home/<user>/Desktop/fmriData/Drive


One thing I am confused about, why is this hdd instead of hdd1? In fact, when I tried to mount hdd1, it said there wasn't any hdd1. I checked /dev, and found no hdd1, only a hdd. What happened?

I edited the fstab file as follows
/dev/hdd /home/<user>/Desktop/fmriData/Drive ext3 notail 0 1
as sourceninja mentioned, separating each column with a tab. But it still doesn't automatically mount the drive when I restarted. What did I not do? Thanks in advance.
- A
 

ant80

Senior member
Dec 4, 2001
411
0
0
Upon further analysis, I think it is the ext3 thing. I just put garbage into what should've gone into ext3, and it said while booting, unknown partition 'garbage'. I used the command mke2fs -j /dev/hdd as shown by sourceninja, but apparently, that does not create an ext3 partition. I am at a loss. Please help.
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
make2fs -j /dev/hdd# (where # is hte partition number) is the only way I know of to make ext3 partitions. I'm currently moving into a new house, so sorry I dont have time to read the thread and see whats been suggested. I'll try in a day or two once I get my stuff unpacked and have more then a few seconds at work to post.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |