Linux - GeneralThis 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
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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I wanted to put /usr/local on its own partition, so I can preserve it during re-installs.
I tried to do this the last time I installed RH9, but for some reason, it didn't work. I generally pre-partition the drives using PartitionMagic, allocate them during setup, but allow Disk Druid to then reformat the partitions.
I'd like to move /usr/local onto a new partition, but am not sure exactly how to go about this. I think I could mount the new partiton manually, move everything under /usr/local onto it, and then set a mount point in fstab, leaving the /usr/local folder itself on /usr as the mount point.
Originally posted by rparkes I wanted to put /usr/local on its own partition, so I can preserve it during re-installs.
I tried to do this the last time I installed RH9, but for some reason, it didn't work. I generally pre-partition the drives using PartitionMagic, allocate them during setup, but allow Disk Druid to then reformat the partitions.
I'd like to move /usr/local onto a new partition, but am not sure exactly how to go about this. I think I could mount the new partiton manually, move everything under /usr/local onto it, and then set a mount point in fstab, leaving the /usr/local folder itself on /usr as the mount point.
I'd appreciate any advice.
First find which partition it is
This can be done by
cat /proc/partitions
or
fdisk -l /dev/hda
I think you can find which partition it is and mount it.
Now for your query about /usr/local create a new partition through partition magic or fdisk whichever you prefer
Find the partition number of the partition through
fdisk -l /dev/hda
mount the partition and copy the content of /usr/local
now do
rm -rf /usr/local/*
now modify your fstab and mount the created partition on /usr/local
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152
Rep:
My suggestion would be to do this a little more safely than rm -rf /usr/local/*. . .
If you are moving /usr/local to a new partition, mount that partition on /mnt (or wherever you want to, but it should not be /usr/local). do a:
Code:
tar cf - /usr/local | (cd /mnt; tar xvf -)
This copies all of your data under /usr/local to /mnt, preserving symlinks, etc.
Edit your fstab and change the /usr/local mount line so that the partition you have mounted under /mnt will mount under /usr/local.
reboot.
If this doesn't work, you have not lost any of your data. The rm command will cause a loss of data. If it does work, you can then remove that data from the old partition and go on. . .
It should work just fine, I do it all the time. =-}
Thanks to both of you. I followed the first answer (which was basically what I had in mind), because I didn't see the second one in time. Anyway, it all worked.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.