LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices



Reply
 
Search this Thread
Old 06-24-2005, 11:28 AM   #1
louisb
Member
 
Registered: Aug 2003
Posts: 132

Rep: Reputation: 15
Multiple Mounts for a device and move File systems


I have a Red Hat Linux 4 AS systems where I've create a software raid5 device the consist of 1.3TBs.

I would like to move the following file systems from /dev/hda to /dev/md0 which is my raid5 device: /usr, /usr/local, /var, /opt and /temp

I've create the raid5 device. Can I mount the same device multipe times with diferent mount points as follow:

mount /dev/md0 /usr
mount /dev/md0 /usr/local
mount /dev/md0 /var
mount /dev/md0 /opt
mount /dev/md0 /temp

To move the above file systems/partitions I plan to use the following command:

copy directories to temp area:

cp -r -v --remove-destintion -p /usr /temp/usr
cp -r -v --remove-destintion -p /var /temp/var
cp -r -v --remove-destintion -p /opt /temp/opt
cp -r -v --remove-destintion -p /temp /temp/temp

create mount point on new device:

mount /dev/md0 /usr
mount /dev/md0 /usr/local
mount /dev/md0 /var
mount /dev/md0 /opt
mount /dev/md0 /temp

copy directories from temp area to new device

cp -r -v --remove-destintion -p /temp/usr /
cp -r -v --remove-destintion -p /temp/var /
cp -r -v --remove-destintion -p /temp/opt /
cp -r -v --remove-destintion -p /temp/temp /

The above command will also preserve the attributes of the sub-directories and files.

Given the above information what changes to I need to make to /etc/fstab?

I'm not change the name of the sub-diretories but I am changing there location from /dev/hda to /dev/md0 which is a software raid5 device.

Does this make sense and will it work?

Please provide any comments you may have.

Thanks
 
Old 06-25-2005, 04:05 PM   #2
Noth
Member
 
Registered: Jun 2005
Distribution: Debian
Posts: 356

Rep: Reputation: 30
You don't want to mount it multiple times, you just need to mount it once and then copy everything over to it.

you also probably don't want to remove the old files until you're sure the copy works.
 
Old 06-26-2005, 12:19 PM   #3
louisb
Member
 
Registered: Aug 2003
Posts: 132

Original Poster
Rep: Reputation: 15
I see exactly what you're saying however, for each mount I'm using a different mount point/subdirectory. I guess my question is I want to move /var, /temp, /usr/local, /opt and /usr to a device with more disk space once Linux is installed.

The device is not present when I initially install Linux. The software raid device is created afte the install. Therefor, I want to use the software raid device by moving some standard linux directories to a device with more disk space.

Based on my first post and this one how do I accomplish my goal?

Any suggetions are WELCOME.


Thanks
 
Old 06-26-2005, 01:31 PM   #4
Noth
Member
 
Registered: Jun 2005
Distribution: Debian
Posts: 356

Rep: Reputation: 30
Quote:
Originally posted by louisb
I see exactly what you're saying however, for each mount I'm using a different mount point/subdirectory.
Yes and you're just going to break things. A single device is meant to contain a single filesystem. If you mount /dev/md0 on /tmp and /home, you'll see the same files in both places. If you delete a file from /tmp it'll disappear from /home as well.


Quote:
I guess my question is I want to move /var, /temp, /usr/local, /opt and /usr to a device with more disk space once Linux is installed.
Either partition that device into as many mount points as you want or fold them back into one mount point.

Quote:
Based on my first post and this one how do I accomplish my goal?
Mount /dev/md0 somewhere and copy all of the data from your current fs there one mount point at a time.
 
Old 06-26-2005, 01:48 PM   #5
louisb
Member
 
Registered: Aug 2003
Posts: 132

Original Poster
Rep: Reputation: 15
Ok is understand what you're telling me. I can copy the /var, /opt, /usr, /usr/local, and /temp to the md0 device. How do I tell the Linux Kernel/system to use the directories on the md0 device instead of the orignal mount points?

Thanks
 
Old 06-26-2005, 02:13 PM   #6
Noth
Member
 
Registered: Jun 2005
Distribution: Debian
Posts: 356

Rep: Reputation: 30
Quote:
Originally posted by louisb
Ok is understand what you're telling me. I can copy the /var, /opt, /usr, /usr/local, and /temp to the md0 device. How do I tell the Linux Kernel/system to use the directories on the md0 device instead of the orignal mount points?

Thanks
Tell it to use /dev/md0 as root, you'll need an initrd if you don't have everything you need in the kernel.
 
Old 06-26-2005, 04:35 PM   #7
louisb
Member
 
Registered: Aug 2003
Posts: 132

Original Poster
Rep: Reputation: 15
Does that mean I have to create an initrd file that will move the appropriate sub-directrories on the md0 device? After I've copy them to the md0 device.

I guest the basic question here is how do I get the startup of Linux to look at the directories on the md0 device instead of those located on the file systems that were created during the install.

I really appreicate all of the help you are giving me here. I'm still new to Linux.


Thanks
 
Old 06-26-2005, 04:38 PM   #8
Noth
Member
 
Registered: Jun 2005
Distribution: Debian
Posts: 356

Rep: Reputation: 30
No, the initrd would be used to start /dev/md0. If your kernel doesn't have the RAID autostart stuff in it, you would need the initrd to bring /dev/md0 up before everything else since it'll be holding the root filesystem.

After you copy all of the files from the old filesystems, in your bootloader (Grub or LILO) you'll need to change the root= line to use /dev/md0 and you'll need to change /etc/fstab.
 
Old 06-26-2005, 04:55 PM   #9
louisb
Member
 
Registered: Aug 2003
Posts: 132

Original Poster
Rep: Reputation: 15
I only wanted to have /var, /temp, /opt, /usr/local and /usr copied to /dev/md0. These files systems seem be affected the most when programs are added.

There are a number of files located in the /usr sub-directory that support system start-up as well as used when I do a rebuild using RPM sources. That being the case I wanted to make sure that the above files systems had lots of space. Since /dev/md0 contains 1.3TB of space.

What sparked this I was doing an rpmbuild for OpenOffice and ran out of disk space on the /usr file system during the build. Therefor, I wanted to move them to a device with plenty of disk space.

So when ever references are made to the above sub-directories I want the directories on the /dev/md0 to be used or written to.

Thanks
 
Old 06-26-2005, 05:08 PM   #10
Noth
Member
 
Registered: Jun 2005
Distribution: Debian
Posts: 356

Rep: Reputation: 30
Well just copying those won't be easy since their common parent is / and you don't want to put / on there.

You could create directories for them all on /dev/md0 and then create symlinks off of /, so /usr would be a symlink to /mnt/raid/usr or something but that's ugly.
 
Old 06-26-2005, 05:55 PM   #11
louisb
Member
 
Registered: Aug 2003
Posts: 132

Original Poster
Rep: Reputation: 15
So your suggestion to copy everything to /dev/md0 and only used that device. I can do that also not a problem I have plenty of space.

So then I just modify the initrd file to point or create symbolic links to point to directories on the md0 device.

Is this correct?
 
Old 06-26-2005, 06:05 PM   #12
Noth
Member
 
Registered: Jun 2005
Distribution: Debian
Posts: 356

Rep: Reputation: 30
Lets step back a moment.

Are you using an initrd already?
Do you know when the RAID device comes up? The kernel can be setup to detect and startup RAID devices without any help from an initrd, but I don't know if RH does it like that or not.
 
Old 06-26-2005, 07:05 PM   #13
louisb
Member
 
Registered: Aug 2003
Posts: 132

Original Poster
Rep: Reputation: 15
I'm using mdadm at a raid5 level. Once I configured the raid using command line from there the kernel knows about software raid. I have not made any config changes.
 
Old 06-26-2005, 09:03 PM   #14
Noth
Member
 
Registered: Jun 2005
Distribution: Debian
Posts: 356

Rep: Reputation: 30
What I'm getting at, is that if you're not already using an initrd and you need one, they're a bit of a pain to setup. If the kernel RAID autostart stuff is there you won't need one and it'll be a lot simpler.
 
Old 06-27-2005, 07:17 AM   #15
louisb
Member
 
Registered: Aug 2003
Posts: 132

Original Poster
Rep: Reputation: 15
I don't think I need one. Because just be configuring the raid5 device everything is running just fine. What are the next steps?
 
  


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
single ext3 journal device multiple journaled file systems? reelwylde Linux - General 4 09-08-2005 04:00 PM
UPS for multiple systems? BrianK Linux - Hardware 1 09-18-2003 09:45 PM
Multiple Operating Systems workerfly Linux - Newbie 2 09-06-2002 04:24 PM
Multiple Operating Systems workerfly Linux - General 1 09-06-2002 03:45 PM
When I try to move a file to a dir it says No Space Left on Device. Help KrazyKid Linux - Software 1 06-16-2002 10:06 PM


All times are GMT -5. The time now is 05:00 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration