Click to See Complete Forum and Search --> : New Drive
Ok, here's the situation. I have RedHat 7.2 running at home which is my web server and email server. This is all on a 5GB Hard Drive. Now, usually it wouldn't be a problem since I don't have a huge robust site yet, but I am serving a few people with email accounts, and well, my needs are growing. I have a 9GB SCSI drive that I haven't installed, and want to put that in there for storage and web stuff. Run my /html and /horde off of that.
This is currently how I have my partitions defined:
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/hda3 1510060 1365508 67844 96% /
/dev/hda1 38859 6245 30608 17% /boot
/dev/hda2 1510060 697408 735944 49% /home
/dev/hda6 2213668 227872 1873344 11% /html
none 127564 0 127564 0% /dev/shm
df: `/mnt/SANDBOX/Sandbox': No such file or directory
df: `/mnt/SANDBOX/Storage': No such file or directory
Is there a way for me to add the 9GB drive and get my /html (whick is a d0link from /var/www/html, because i have /html defined as it's won partition--if that makes any sense). Basically, I want to make sure that when I add the 9GB drive, I can get my web and email up without any problems, be it with partitions or permissions or whatever?
Anyone have any tips, info, help.
I would rather not rebuild my server as that was a pain in the *** to get everything from web, horde, IMP, imap, SSL, etc. working perfectly with each other. So, that is a last resort.
Also, can you give me ideas on how I should partition the thing? If I need to rebuild it which I don't want to (did I mention I DON'T WNAT TO??? ;) ) what would be a good partition layout. I will keep my 5GB IDE drive for the os and such, and the 9GB SCSI for the web, storage, email. Thanks a bunch.
mdwatts
03-20-2002, 05:46 PM
Actually it's a very easy process though to save a bit of typing, I will refer you to the NHF on Adding a HD in 10,000 easy steps (http://www.linuxnewbie.org/nhf/intel/hardware/hd_add.html) j/k
Just adapt for your scsi drive (sda# etc.).
I know how to add a drive in linux, I guess that's not the main question. I'm wondering if it is really that easy? I'm more concerned about what to do with my existing partitions. Like I want /var/www/html to be on the new drive. Then, really, what would be nice would be to get rid of the /var/www/html partition on the IDE drive /hda and include that space into the /home partition.
Now, I'm taking it that what I just said above is not that simple. Anyone know what I should do here?
Bryan
slapNUT
03-21-2002, 01:00 PM
WARNING: Untested advice below! Use at your own risk!
First you need to fdisk and make a linux partition. Then create a filesystem on the new drive.
mkfs -t <fstype> /dev/hdb1
Mount the drive
mount -t <fstype> /dev/hdb1 /temp
Copy /var/www/html to new drive
cp -pR /var/www/html/* /temp #double check this, I'm using windows right now but I think this will do.
Create the fstab entry and save.
/dev/hdb1 /html <fstype> defaults 0 0
Now you can reboot or remount the new partition manually.
umount /dev/hda6
umount /dev/hdb1
mount -t <fstype> /dev/hdb1 /html
If everything is ok then you can reclaim the space on hda6. Since that is an extended partition you can only add the space to the primary partition it is on.
<edit> On the copy command you have a choice of R or r. One copies the actual files and I think the other only makes symlinks.
[ 21 March 2002: Message edited by: slapNUT ]
demian
03-21-2002, 01:07 PM
I'd say slapNUT's suggestions will do. Two things I might change:
cp -pR /var/www/html/* /temp
Use cp -a /var/www/html/* /temp. This is the same as using cp -dpR ...
/dev/hdb1 /html <fstype> defaults 0 0
Change to
/dev/hdb1 /html <fstype> defaults 0 2
The last number should be higher than the corresponding number for the root fs.
mdwatts
03-21-2002, 05:50 PM
The NHF has everything except for the copying of the data to the new drive.
1. Create the partition
2. Create the filesystem
3. Mount the new partition
4. Copy over data etc. (Not in NHF)
5. Create/change entry in /etc/fstab to point to new HD partition
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/hda3 1475 1335 65 96% /
/dev/hda1 38 7 29 17% /boot
/dev/hda2 1475 685 715 49% /home
/dev/hda6 2162 225 1827 11% /html
none 125 0 124 0% /dev/shm
But look, my / partition is CRITICAL :eek:
This is what I'm thinking.
1) Add the new drive
2) Partition it accordingly
3) Move the data (/var/ww/html) to the new partition
4) some how merge the / partition with the /html partition that i move the data from?
Can anyone help me with step 4? I have 64 MB left on the root partition and you know what happens then, ka boom!!! So, can I merge the / with the old /html with no problems? Thanks for the help.
Bryan
slapNUT
03-21-2002, 09:50 PM
Partition Suprise (http://sourceforge.net/projects/surprise/)
Partition Surprise is a GPL partition managing software for Linux. Partition resizes, moves and conversions is implemented. Limited support of operations on mounted ext2-filesystem included as well.
Found this, maybe it will help, I've never used it.
[ 21 March 2002: Message edited by: slapNUT ]
demian
03-21-2002, 10:36 PM
Originally posted by Reko:
<STRONG>4) some how merge the / partition with the /html partition that i move the data from?</STRONG>
Somehow merge is very vague. I guess you have various possibilities here. I'd opt for this one:
You don't have /usr on a separate partition. And because /dev/hda6 is larger than /dev/hda3 you will have no problem to fit the whole /usr dir on /dev/hda6. This would take quite a load off /dev/hda3 and leave you with enough free space.
So here's what I would do:
First off, these are very critical operations so make sure you understand the commands and know what they are doing before you issue them. Take your time and don't hit 'return' too hastily.
Move the /var/www/html data to the new drive by following the steps outlined in the previous replies. Then make absolutely sure everything is there and works properly.
Now you can create a new filesystem on /dev/hda6 (mke2fs /dev/hda6 (if you use ext2)) and mount it to some temporary position eg /mnt. Then copy over the whole stuff from /usr. You can use the cp -a command I guess but I often used the following command to do similar stuff. And I know that it works.
cd /usr
tar cSpf - . | (cd /mnt ; tar xvSpf - )
(this, of course, implies that you indeed mounted /dev/hda6 to /mnt)
Now you change the fstab and add a new line for the /usr partition
/dev/hda6 /usr <fstype> defaults 0 2
Mount it with mount /usr. This will work despite the fact that there is still data in the /usr directory (on you root partition). Now play around, run some programs from /usr/bin and make sure everything works as before.
Now you need to get rid of the contents of the /usr directory and reclaim that space for your / partition: Go into single user mode if your not already there (init 1). Unmount the /usr partition and make sure it's really unmounted. Delete the contents of the /usr directory (rm -r /usr/*). Mount the new /usr partition and go back to the default runlevel. That's it.
DISCLAIMER: I wrote the above to the best of my knowledge and would do exactly that were I in your position. However, as I said these are very critical operations and I can't rule out the possibility that something breaks your system.