LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 10-11-2005, 10:50 PM   #1
kike_coello
Member
 
Registered: Jul 2005
Location: maryland
Distribution: Ubuntu 9.04
Posts: 88

Rep: Reputation: 17
how to add a hard drive to a linux system?


hello, i need help adding a partition of my hard drive to my linux (ubuntu) system.

i'm using only 2gigs for my whole ubuntu system (don't laugh i know its too damn small for a full distro, but i was just testing at first, didn't know i was gonna keep it) anyways, i also made a 3 gig partition that i thought i would use for suse but i never added it to my laptop. i would like to use the 3 gigs that i separated for suse for my ubuntu partition.

my xp partition has about 45 gigs, ubuntu about 2 and suse(actually blank partition) has 3 (unused) gigs.

i would like to know how to add the partition to ubuntu so i can use the 3gigs to save files and install programs because right now i only have about 300 megabytes of free space on the ubuntu partition.

i only use ubuntu for programming in c++, java, bash and perl so i won't need more than those 3 gigs i already partition, so don't recommend to make a bigger partition to install ubuntu.
 
Old 10-12-2005, 12:51 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
How much space are you using for your /home directory. You might want to format the 3 gigs (now empty) and move your /home directory to this partition. Normally, /home and /usr are the largest and moving one of them to the 3 gig partition would free up space. (Reducing the XP partition size would free up even more space!)

Is the 3 gig (empty) partition currently mounted? You will want to copy (or move) your user home directory or directories to the new partition, before changing the /etc/fstab entry for /home. Perhaps you could mount it temporarily on /mnt.
Enter the single user mode as root before moving the home directory. That way you are not trying to move files which are still being used.
 
Old 10-12-2005, 01:47 AM   #3
maroonbaboon
Senior Member
 
Registered: Aug 2003
Location: Sydney
Distribution: debian
Posts: 1,495

Rep: Reputation: 48
Installing non-Unbuntu applications from source can take up a lot of space, and the default location is usually /usr/local. If you move /home to the new partition as suggested you can also make a new directory /home/local, symlinked to /usr/local. That way all the non-Ubuntu stuff is together in the same partition. Easy to change distro without disturbing your own files.
 
Old 10-12-2005, 03:59 PM   #4
kike_coello
Member
 
Registered: Jul 2005
Location: maryland
Distribution: Ubuntu 9.04
Posts: 88

Original Poster
Rep: Reputation: 17
the empty partition (3 gigs) is "formatted" for linux with partition magic. i could transfer all my stuff to this new partition and since i'm the only user i could send my entire home directory to the new partition but how would i do that. i'm not a pro, i just took an intro to unix class last semester and have been trying distros like crazy, but i've finally chosen ubuntu and found out 2 gigs is just not enough. if somebody could tell me how to format my empty partition (that is if partition magic's "linux format" is not adequate) so that i can just copy all my home directory stuff to it, i'd be able to store music along with my files.

another question and i know i should post a new thread but its related: which directory is the default where the new programs are installed, and i want to know if i can also transfer this directory to the new partition

oh. i forgot when you add a new partition or hard drive it becomes just "space" on the systems because its not divided into "drives" like in windows, so would i be able to just keep storing stuff in the same folder (without moving them) and let the system be in charge of using the empty space on the new partition?

please help more questions arising...
 
Old 10-12-2005, 07:07 PM   #5
maroonbaboon
Senior Member
 
Registered: Aug 2003
Location: Sydney
Distribution: debian
Posts: 1,495

Rep: Reputation: 48
To create and delete partitions in linux:

# fdisk /dev/hda

and follow menus. To make an ext3 filesystem on a partition (could use another type if you want):

# mkfs.ext3 /dev/hda2

To mount new partition on directory /mnt

# mount /dev/hda2 /mnt

To copy home directory from old to new partition

# cp -a /home/my_home_directory /mnt

All these need to be done as root, and some are slightly dangerous in that they can destroy data. So best read up the man pages and make sure you understand what you are doing.

Where do new programs go? Ubuntu almost certainly puts its packages in /usr. If you install non-Ubuntu applications from source code the Makefile typically defaults to putting stuff in /usr/local (keeping them separate from 'official' packages).

Not sure I understand the last paragraph. On a unix system there is the root directory / and disk partitions are mounted on / and various subdirectories. Stuff in the subdirectory is physically stored in the corresponding partition.
 
Old 10-14-2005, 11:38 PM   #6
kike_coello
Member
 
Registered: Jul 2005
Location: maryland
Distribution: Ubuntu 9.04
Posts: 88

Original Poster
Rep: Reputation: 17
dudes

i just formatted the partition with ext3 and i copied all the files from home to it, but i don't think that's right because what i want is to have the entire home location saved or mounted on the new partition everytime i turn on my laptop, and i also want it to be the place where i automatically go when i intend to go "home"

i made a new dir on / and named it new so its "/new" and the empty partition is on /dev/hda7 (3 gigs), i formatted with mkfs.et3 /dev/hda7

then i mounted it like this "mount /dev/hda7 /new", and then i copied the files from home to the new partition folder with "/cp -a /home/enrique /new"

what that did is just copy the files from my home directory to the new partition, but what i want is to keep using /home/enrique as my home but have that on the new partition "dev/hda7"

please help!!!!!!!!!!!!!!!!!!!!!!!!!!!

 
Old 10-14-2005, 11:46 PM   #7
dalek
Senior Member
 
Registered: Jul 2003
Location: Mississippi USA
Distribution: Gentoo
Posts: 2,058
Blog Entries: 2

Rep: Reputation: 79
I'm not sure I followed you completely but I am going to post my fstab file. Maybe someone will come along that is not half asleep and see if this fits. Notice I have a seperate partition for my /home directory too, along with a few others.

Code:
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/hda1		/boot			reiserfs	  noatime,notail		1 1
/dev/hda5		swap			swap		defaults		         0 0
/dev/hda6		/			   reiserfs	    defaults		             0 0
/dev/hda7		/home		       reiserfs	        defaults		         0 0
/dev/hda8		/usr			  reiserfs	  defaults		            0 0 
/dev/hda9		/usr/portage	      reiserfs	      defaults		                0 0
/dev/cdrom      	/mnt/cdrom           iso9660       noauto,ro,users              0 0
/dev/fd0                /mnt/floppy     	auto            noauto,users                   0 0
/dev/hda10		/mnt/data	      reiserfs	      defaults,rw		        0 0
Maybe I will get woke up later on. I just don't want to tell you the wrong thing and mess you up.

That help any?

 
Old 10-14-2005, 11:53 PM   #8
kike_coello
Member
 
Registered: Jul 2005
Location: maryland
Distribution: Ubuntu 9.04
Posts: 88

Original Poster
Rep: Reputation: 17
its pretty late...

and i'm on my xp partition now, reading the forums for help, you see i don't have the wireless card working on ubuntu, and i don't have the mp3 codecs for xmms aside from running out of space on my ubuntu partition, so right now i can't answer because i'm about to go to sleep too, lol, but tomorrow i'll let you know, i believe i have modified the fstab file by adding a line to the end like this
"/dev/hda7 /new ext3 options.can't.remember.lol 0 1"
but then i restarted into xp so i don't know if it worked, but still, i believe all that'll do is mount the new partition but it wont have my home directory mounted "on it" indefenitely
 
Old 10-15-2005, 01:43 AM   #9
maroonbaboon
Senior Member
 
Registered: Aug 2003
Location: Sydney
Distribution: debian
Posts: 1,495

Rep: Reputation: 48
Best be in single user mode while mounting/unmounting your home directory.

Unmount /dev/hda7 and remount it on /home. Hopefully you will now have a /home/enrique again.

Note that the new partition will then be mounted 'on top of' the contents of your original home directory. The old stuff will still be there and will reappear if you unmount /dev/hda7 again.

You should then edit /etc/fstab to include a line to mount /dev/hda7 on /home automatically.

When you are happy with the situation, you can delete the contents of your old /home directory. Make sure it is really the old one, not the new one. You should go into single user mode, then unmount /dev/hda7 to see your old /home.

Confusing? Definitely. And you can screw things up if you are not careful. So please make sure you understand what is happening before you try this at /home

Last edited by maroonbaboon; 10-15-2005 at 01:47 AM.
 
Old 10-16-2005, 11:26 PM   #10
kike_coello
Member
 
Registered: Jul 2005
Location: maryland
Distribution: Ubuntu 9.04
Posts: 88

Original Poster
Rep: Reputation: 17
thanks to all you dudes that helped

i frigging got it to work with your help guys, when i mounted home on /dev/hda7 the frigging computer froze and i freaked out, lol, i couldn't do a thing, the console froze and the only thing i could do was move the mouse but even restart wouldn't work, i guess the system got confused because home was already mounted on /dev/hda5 along with the rest of ubuntu and then i mounted home on /dev/hda7, i suppose there must have been some conflict in the system, anyways i turned off the laptop and when i booted to linux i still had the console on startup (on the gui) but the background was white instead of orange, so i just closed it and ubuntu started up fine. it was weird, anyways, now i have 2.5 gigs on the home drive which is in hda7 and about 200 on hda6 which is where i have the rest of the system on, i suppose i can install new programs on the home drive right? or are the programs still gonna go into the /usr/local automatically (/usr/local is in the partition that has 200 megas left /dev/hda6).

anyways, thanks, next time i install a distro i'll have a partition specifically for the home, i've installed about 20 distros and i've always used one partiton, let this be a lesson, hahahaah.

thanks again. peace out
 
Old 10-17-2005, 08:45 AM   #11
hanzerik
Member
 
Registered: Jan 2002
Location: Cheyenne Wyoming
Distribution: Debian/Raspbian/Mint
Posts: 717

Rep: Reputation: 32
If you are build/installing from source use: --prefix=
ie: ./configure --prefix=$HOME/MyApp
make
make install

This will install the program into a folder called MyApp.
cd MyApp/bin
./AppName
 
Old 10-17-2005, 03:26 PM   #12
kike_coello
Member
 
Registered: Jul 2005
Location: maryland
Distribution: Ubuntu 9.04
Posts: 88

Original Poster
Rep: Reputation: 17
oh...

ok, so the program is installed somewhere in my home directory, and how would i uninstall the program later on, i know that in windows when you install something, the wizard makes a folder containing about 99 percent of the program and then like about 1 percent is sent to other folders, for dependecies or something, is it the same with linux? i know with rpms its easy to uninstall and if i download programs from ubuntu i can use synaptic to uninstall them but how about binaries or source?

maybe i should make another thread, but you dudes seem to know what you are talking about

thanks in advance!

 
Old 10-17-2005, 05:44 PM   #13
maroonbaboon
Senior Member
 
Registered: Aug 2003
Location: Sydney
Distribution: debian
Posts: 1,495

Rep: Reputation: 48
If you follow hanzerik's suggestion uninstallation is just a matter of nuking the directory 'rm -r ~/MyApp'. That's one advantage of giving each app its own directory. The disadvantage is that it is harder to use the PATH environment variable, as all your executable files are in different places. Some source code packages provide 'make uninstall'. But otherwise if you use the usual default --prefix=/usr/local when configuring it can be hard to recognise which files to remove.

One way to try to get the best of both worlds is to give each app its own directory, and put symlinks to the executable files in some directory in your PATH e.g. $HOME/bin or /usr/local/bin.
 
Old 10-18-2005, 10:35 PM   #14
kike_coello
Member
 
Registered: Jul 2005
Location: maryland
Distribution: Ubuntu 9.04
Posts: 88

Original Poster
Rep: Reputation: 17
will do that sir!, thanks, i'm about to install a bunch of programs, lol, starting with netbeans, any recommendations for a c++ ide?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add a hard drive existing Linux system a1ntsk33r3d Linux - Hardware 5 06-28-2005 02:20 PM
Add a Hard Drive to Linux AndeAnderson Linux - Hardware 7 02-24-2005 02:06 PM
installing linux on unformatted hard drive with no operating system gjhowar Linux - Newbie 4 08-18-2004 04:29 PM
Hard Drive System Backup of Linux? KarlT Linux - Software 2 12-20-2003 08:03 PM
Can't add hard drive- simple task- about ready to give up linux saxblue Linux - Hardware 4 07-30-2003 11:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 10:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration