LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-09-2001, 12:08 PM   #1
KNeptune
LQ Newbie
 
Registered: Oct 2001
Posts: 9

Rep: Reputation: 0
Unhappy Unfortunately I only got rude replies elsewhere ...


Hello,

I have been asking this for some time now at many various places across the web all with only negative/rude remarks in reply. (such as rtfm, which helps no one and is a waste of your time to even say to someone - sigh)

Anyway, While looking around here things seemed alittle different so I thought I would give my question a shot ... Explinations, Links to articles, Cartoons, etc, would all be of help ... I will RTFM if I could find one that addresses this ....

I have a Redhat 7.x install running my internal network (5+ machines) as the firewall/gateway, Incoming and Outgoing mail server (via Qmail of course!), mySQL, Apache, etc, etc all on a single 9gig SCSI drive but I need more space as I am dangerously close to being completely OUT of space and find myself deleting and uninstalling things just to continue to stay afloat...

I just dont understand how to ADD additional HDD space to a already running server/system without starting from scratch and doing the initial install with the new drives attached.

Any help, pointers, links, etc I would be forever gratfull for!

=-)
 
Old 10-09-2001, 01:07 PM   #2
da Perp
Member
 
Registered: Oct 2001
Location: the Netherlands
Distribution: Bear Linux (LFS 3.3)
Posts: 171

Rep: Reputation: 30
Thumbs up

attach the new drives, and use RedHats' diskdruid (i think).
This is kind of like fdisk in dos. You can identify the drives by looking at the size. Select the drives in linux's partitioning program , set proper mount points, and you should be done. No reinstalling necessary. No need to RTFM

This messageboard rokz dude! ask your questions here from now on.

Last edited by da Perp; 10-09-2001 at 01:10 PM.
 
Old 10-09-2001, 01:20 PM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
RTFM. Fantastic album by the Poster Children.. but anyway...

you want to add a new physical hard drive? well... you'd better... or i'll do you for wasting my time! :-)

I've not done it myself, but i really need to fairly soon. So the lowlevel stuff is a bit of a guess...

OK, so plug in yuor device and boot to linux. go into cfdisk or fdisk. DiskDruid is Mandrake only, so not an option.. but where's the fun in all singing all dancing progs anyway?!

So delete any existing partitions, and create new ones, and format them using
mke2fs i think.

Once that's all done, you need to put the space somewhere. The easiest thing to do would be to add it to /var, for a general network sharing drive, available via nfs and samba as /var/share.

Add a line in the /etc/fstab file somethign like:

/dev/hdb1 /var/share defaults 0 0

assuming that the /var/share directory exists and is completely empty. So then you should be able to mount the drive by 'mount /var/share' and it should be done. naturally, successive reboots will automatically mount it, and you're done.

If you're gonna do something scarier liek move the /usr directory out to it, then be very careful! But the genereal procedure should sstill be the same.
 
Old 10-09-2001, 01:23 PM   #4
da Perp
Member
 
Registered: Oct 2001
Location: the Netherlands
Distribution: Bear Linux (LFS 3.3)
Posts: 171

Rep: Reputation: 30
mandrake has diskdrake, redhat has diskdruid
 
Old 10-09-2001, 01:41 PM   #5
KNeptune
LQ Newbie
 
Registered: Oct 2001
Posts: 9

Original Poster
Rep: Reputation: 0
Ok, so far you've all got me going on the right track ...

Thanks!

Seriously I think I can follow those pointers with no prob ...

One question though ... Is it possible to, lets say, make the new Drive the /var partition and just give something like /home (or whatever) the space that is free'd up by moving /var off the original drive?

Thanks again for all your help!

=-)
 
Old 10-09-2001, 01:44 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well if var was on the same partition as home, then yeah, it's all up for grabs. just liek any other directory
 
Old 10-09-2001, 07:21 PM   #7
DMR
Member
 
Registered: Jun 2001
Location: Fairfax, California
Distribution: RH 9.0, RH 7.3, Mandrake 8.0
Posts: 986

Rep: Reputation: 30
To assign the space in /var to another partition, you'll have to delete /var in fdisk first to make the space free. Even then, you'll only be able to "grow" the parition which is physically adjacent to the /var partition on the disk. In other words, space assigned to partitions has to be contiguous space.

BTW- as far as Disk Druid goes: it isn't a stand-alone utility; it runs at installation time only.
 
Old 10-10-2001, 12:38 PM   #8
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
I moved /home on my system without any problem

if the new drive is the primary slave then it will be hdb

fdisk /dev/hdb

create partitions you want.

If its just one primary it will be hdb1

m will show you the fdisk menu

after creating the partition set the type to linux

this is type 83

so you would do

t

1

83

this will set partition 1 to type 83

w

q


then you must make the file system


mkfs -t ext2 /dev/hdb1

make a directory to mount the new drive in like /new

then mount it

mount /dev/hdb1 /new

now you can copy your files to the new drive.

you can delete the old files on the original disk now to get the free space.


after that edit fstab to mount /dev/hdb1 where it goes.


make sure you leave the empty folder there where it will mount to.

when you reboot the new drives contents will be in the folder.


Weather the space is useful or not depends on your partitions already on your drive, If you don't have partitions under / it will be of use to all folders under /


Last edited by DavidPhillips; 10-10-2001 at 12:45 PM.
 
Old 10-11-2001, 03:40 AM   #9
KNeptune
LQ Newbie
 
Registered: Oct 2001
Posts: 9

Original Poster
Rep: Reputation: 0
Equality for all ... No masters or Slaves here ...

Re: "physically adjacent to the /var partition on the disk" ...

Meaning on the same HDD right?

Currently there is just one 9gig HDD .... I want to add another one

And in this case there will be no Masters or Slave drives ... As I mentioned above Im running SCSI so I dont have to worry about that little bit .... But us it similiar with SCSI as you mentioned with IDE type drives?
 
Old 10-11-2001, 03:31 PM   #10
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
you can run mount with no arguments like this

you will see scsi devices but the principle is the same.


[root@beta /root]# mount
/dev/hda5 on / type ext2 (rw)
none on /proc type proc (rw)
/dev/hda1 on /boot type ext2 (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
automount(pid834) on /misc type autofs (rw,fd=5,pgrp=834,minproto=2,maxproto=3)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

notice I have /boot on hda1 and / on hda5

/boot is given the space in the primary partition, / which is everything else mounted except swap partitions(see below) is on the extended partition which has the remaining space


this means I can put in another drive for any folder under root except /boot which is on another partition.

the new drive will not be accessable to the folders under / on the old drive unless you mount the new drive to that folder.


for instance, if you have everything under root then you can decide what folders you want to mount the new drive to and these folders will have the space.
In this case I could make a partition for /var and one for /home and one for /usr or whatever I want and mount them to those folders.

this will free up the space used by these folders on the old drive when you move the data to the new one, therefore the remaining folders on the old drive in the partition that you removed data from will have access to the space.

Or as DMR stated in one of his posts the adjacent partitions can be made bigger to consume the free space.

[root@beta /root]# fdisk /dev/hda

The number of cylinders for this disk is set to 2650.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/hda: 240 heads, 63 sectors, 2650 cylinders
Units = cylinders of 15120 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 7 52888+ 83 Linux
/dev/hda2 8 2650 19981080 5 Extended
/dev/hda5 8 1939 14605888+ 83 Linux
/dev/hda6 1940 2009 529168+ 82 Linux swap

Command (m for help):

See how hda5 ends on 1939 and hda6 starts on 1940

by removing hda6 to another drive the space would be available to hda5 but not hda1

hda2 is the extended partition, hda5 and hda6 are logical drives in the extended partition.

You may have many partitions on your system or just two or three.

You should at least have a swap and a / partition.

I recommend using a seperate /boot partition on the primary but this is up to you.

check out this system

mount
/dev/md1 on / type ext2 (rw)
none on /proc type proc (rw)
/dev/md0 on /boot type ext2 (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
automount(pid815) on /misc type autofs (rw,fd=5,pgrp=815,minproto=2,maxproto=3)
//winme/pub on /lan/winme type smbfs (0)
//win98/pub on /lan/win98 type smbfs (0)

md0 is a raid device which contains hda1 and hdb1 which is mounted on /boot

md1 is a raid device containing hda5 and hdb5 mounted on /


there are different types of raid.

one way to do it will add the two disks together for more space, or you can have a mirror image on one for data recovery in case of a disk failure.

other types require more than two drives.

Last edited by DavidPhillips; 10-11-2001 at 04:03 PM.
 
Old 02-08-2003, 01:49 AM   #11
xcon
Member
 
Registered: Jan 2002
Location: Ohio
Distribution: Slackware 9.1 (and some 9.0)
Posts: 181

Rep: Reputation: 30
i heard once-- at this site, i think-- that if you mount an empty partition as well as a full one **in the same place** on top of the full one, the first (full) one will continue to be visible & readable but all new files will be written to the new one. never tried it though...

until now. mounted a floppy in a directory with one file already, and saved another file into that directory... unmounted the floppy, remounted it in the usual place, and the only copy of the new file is in the floppy; the non-empty dir is untouched but the old files don't appear while the new one's mounted. so much for that... maybe the kernel changed since over a year ago, maybe it was never true
 
Old 02-08-2003, 08:25 PM   #12
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
That does not sound possible, When you mount a partition, the files in the folder you mounted it to if any, are not accessable.
 
Old 05-30-2003, 01:35 PM   #13
heiseltc
LQ Newbie
 
Registered: Aug 2002
Location: CA
Distribution: RH, MDK, YellowDog
Posts: 11

Rep: Reputation: 0
Just a couple of notes to help anyone going through this process:

1) When you mount a partition on an existing directory, what ever is in that directory (if anything) is hidden until the partition is unmounted.

2) The best way to copy a directory that you want to move to a new partition, is to use the "tar" command. Let's say you want to add another disk to use as /home. First use fdisk and mke2fs as explaned in previous posts in this thread. Then before you unmount (using "umount") /home, mount your new partition somewhere, like "/mnt/tmp".
"cd" to /home then run this command:

tar -cf - * | (cd /mnt/tmp; tar -xf -)

What this does is create a new unnamed tar ("-cf -") of everything in the directory ("*"), then pipes it ("|") to the next set of commands ( everything between the "()", which will return us to our current state when it's done) -- so, in the parentheses we tell the it to change to our new partition (" cd /mnt/tmp" -- this will be whatever your new partition will be) then run (";") tar again ("tar") extracting what was put in our unnamed tar ("-xf -").


Hope this can help someone.
 
Old 05-30-2003, 01:42 PM   #14
xcon
Member
 
Registered: Jan 2002
Location: Ohio
Distribution: Slackware 9.1 (and some 9.0)
Posts: 181

Rep: Reputation: 30
if you added stuff to /etc/fstab and you want to mount it, or to verify the correctness of the entry[ies], just
Code:
mount -a
it'll mount every item that isn't mounted such as a CDROM and your new items all at once
 
Old 05-30-2003, 02:13 PM   #15
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
# Clone a distro to another drive or move directories around
Install drive in box (assuming IDE1 slave for examples) and ensure BIOS can detect it. Boot into Linux and login to your user's account. Open an x terminal and partition and format the new drive as you wish
Code:
[phil@fancypiper phil]$ su -
Password: 
[root@fancypiper root]# fdisk /dev/hdb
Exit with w to write the partition table.

Format the partitions with the chosen filesystems:
mke2fs /dev/hdbX -> ext2
mke2fs -j /dev/hdbX -> ext3
mkswap -> swap
mkreiserfs -> reiserfs
mkfs.xfs -> xfs

Make directories for source and destination mount points. You need these to keep out of an endless loop of copying itsself over and over.
Code:
[root@fancypiper root]# mkdir /mnt/source
[root@fancypiper root]# mkdir /mnt/destination
Mount your os partitions that you want to clone on /mnt/source
Mount your partitions on the new drive, making directory entries for your separate partitions (/boot, /home, /var etc.). If you are just copying a directory such as var, just cd to the directory you wish to copy instead of mounting partitions on /mnt/source.

Now, cd to /mnt/source and pipe it over with tar
Code:
[root@fancypiper root]# cd /mnt/source
[root@fancypiper source]# tar cf - . | (cd /mnt/destination && tar xBfp -)
Edit /etc/fstab as needed, install the boot loader if you moved a whole distro, and it should work when it is installed in it's final position.

Last edited by fancypiper; 05-30-2003 at 02:20 PM.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
getting rid of rude/obscene members reddazz LQ Suggestions & Feedback 45 04-18-2007 09:42 AM
Rude boot up time.. xconspirisist Fedora 5 12-18-2003 11:51 AM
how many replies will it take? mymojo Linux - Games 27 11-05-2003 07:47 PM
No replies request dalek LQ Suggestions & Feedback 8 09-06-2003 09:12 PM
What to do if nobody replies, BUT... ? Debianewb LQ Suggestions & Feedback 5 10-27-2002 08:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:44 AM.

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