| Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
06-24-2005, 10:28 AM
|
#1
|
|
Member
Registered: Aug 2003
Posts: 132
Rep:
|
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
|
|
|
|
06-25-2005, 03:05 PM
|
#2
|
|
Member
Registered: Jun 2005
Distribution: Debian
Posts: 356
Rep:
|
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.
|
|
|
|
06-26-2005, 11:19 AM
|
#3
|
|
Member
Registered: Aug 2003
Posts: 132
Original Poster
Rep:
|
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
|
|
|
|
06-26-2005, 12:31 PM
|
#4
|
|
Member
Registered: Jun 2005
Distribution: Debian
Posts: 356
Rep:
|
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.
|
|
|
|
06-26-2005, 12:48 PM
|
#5
|
|
Member
Registered: Aug 2003
Posts: 132
Original Poster
Rep:
|
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
|
|
|
|
06-26-2005, 01:13 PM
|
#6
|
|
Member
Registered: Jun 2005
Distribution: Debian
Posts: 356
Rep:
|
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.
|
|
|
|
06-26-2005, 03:35 PM
|
#7
|
|
Member
Registered: Aug 2003
Posts: 132
Original Poster
Rep:
|
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
|
|
|
|
06-26-2005, 03:38 PM
|
#8
|
|
Member
Registered: Jun 2005
Distribution: Debian
Posts: 356
Rep:
|
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.
|
|
|
|
06-26-2005, 03:55 PM
|
#9
|
|
Member
Registered: Aug 2003
Posts: 132
Original Poster
Rep:
|
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
|
|
|
|
06-26-2005, 04:08 PM
|
#10
|
|
Member
Registered: Jun 2005
Distribution: Debian
Posts: 356
Rep:
|
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.
|
|
|
|
06-26-2005, 04:55 PM
|
#11
|
|
Member
Registered: Aug 2003
Posts: 132
Original Poster
Rep:
|
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?
|
|
|
|
06-26-2005, 05:05 PM
|
#12
|
|
Member
Registered: Jun 2005
Distribution: Debian
Posts: 356
Rep:
|
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.
|
|
|
|
06-26-2005, 06:05 PM
|
#13
|
|
Member
Registered: Aug 2003
Posts: 132
Original Poster
Rep:
|
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.
|
|
|
|
06-26-2005, 08:03 PM
|
#14
|
|
Member
Registered: Jun 2005
Distribution: Debian
Posts: 356
Rep:
|
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.
|
|
|
|
06-27-2005, 06:17 AM
|
#15
|
|
Member
Registered: Aug 2003
Posts: 132
Original Poster
Rep:
|
I don't think I need one. Because just be configuring the raid5 device everything is running just fine. What are the next steps?
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 07:39 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|