This is a discussion on moving /home and /usr/local to partition? within the Linux Operating System forums, part of the Unix Operating Systems category; --> I have a large unused hda7 partition, unmounted. Currently everything (/) is on hda5. I would like to move ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I have a large unused hda7 partition, unmounted. Currently everything (/) is on hda5. I would like to move /home and /usr/local to the unmounted hda7 partition. How can I do that easily and safely? Larry Gagnon -- ******************************** to send direct email remove "fake" |
| |||
| Larry Gagnon <lagagnon@fakeuniserve.com> wrote: > I have a large unused hda7 partition, unmounted. Currently everything (/) is > on hda5. I would like to move /home and /usr/local to the unmounted hda7 > partition. Create two partition instead of one, copy the data from /home and /usr/local in the two new partition, restart the system in single-user mode, rename the old /home and /usr/local, mount the new one, change fstab, check that everything is working, when you're sure, delete the old /home and /usr/local directories. Davide -- | Q: How many Microsoft vice presidents does it take to change a light | bulb? A: Eight. One to work the bulb, and seven to make sure that | Microsoft gets $2 for every light bulb ever changed anywhere in the | world. | | |
| |||
| Davide Bianchi <davideyeahsure@onlyforfun.net> wrote: > Larry Gagnon <lagagnon@fakeuniserve.com> wrote: > > I have a large unused hda7 partition, unmounted. Currently everything (/) is > > on hda5. I would like to move /home and /usr/local to the unmounted hda7 > > partition. > Create two partition instead of one, copy the data from /home and /usr/local > in the two new partition, restart the system in single-user mode, rename > the old /home and /usr/local, mount the new one, change fstab, check > that everything is working, when you're sure, delete the old > /home and /usr/local directories. Should work, however I see now reason why you should reboot, or even change the runlevel, if there are some users at all, I'd log them out, touch /etc/nologin. Mount the new partition to /mnt, 'cp -a' everything over, umount /mnt, mv /home to /home.old, recreate /home, mount the new partition, edit fstab accordingly and proceed with the next partition. -- Michael Heiming Remove +SIGNS and www. if you expect an answer, sorry for inconvenience, but I get tons of SPAM |
| |||
| Michael Heiming <michael+USENET@www.heiming.de> wrote: > Should work, however I see now reason why you should reboot, or > even change the runlevel, I'm not really sure if something is using /usr/local or not, and hunting every single process is quite time-consuming, dropping in single user or rebooting into it it's the fastest way. Davide -- | Linux: The OS people choose without $200,000,000 of persuasion | | | | | |
| |||
| Larry Gagnon <lagagnon@fakeuniserve.com> writes: ]I have a large unused hda7 partition, unmounted. Currently everything (/) is ]on hda5. I would like to move /home and /usr/local to the unmounted hda7 ]partition. How can I do that easily and safely? (assuming an ext3 partition has already been defined on that drive) mkdir /extra mount -t ext3 /dev/hda7 /extra mkdir /extra/home mkdir /extra/local cd /usr/local tar -cf - . |(cd /extra/local&&tar -xpf - ) mv /usr/local /usr/local1 ln -sf /extra/local /usr/local cd /home tar -cf - . |(cd /extra/home&&tar -xpf - ) mv /home /home1 ln -sf /extra/home /home echo /dev/hda7 /extra ext3 defaults 1 4 >>/etc/fstab Once you are sure that everything got transfered fine, remove /usr/local1 and /home1 |
| |||
| Davide Bianchi <davideyeahsure@onlyforfun.net> wrote: > Michael Heiming <michael+USENET@www.heiming.de> wrote: > > Should work, however I see now reason why you should reboot, or > > even change the runlevel, > I'm not really sure if something is using /usr/local or not, > and hunting every single process is quite time-consuming, dropping > in single user or rebooting into it it's the fastest way. # time ps aux | awk 'NR!=1{system("lsof -p "$2"| grep \"/usr/local\"")}' [some lines about mozilla] real 0m5.130s user 0m1.830s sys 0m3.220s -- Michael Heiming Remove +SIGNS and www. if you expect an answer, sorry for inconvenience, but I get tons of SPAM |
| |||
| "Michael Heiming" <michael+USENET@www.heiming.de> wrote in message news:ct5isb.hua.ln@news.heiming.de... > Davide Bianchi <davideyeahsure@onlyforfun.net> wrote: > > Michael Heiming <michael+USENET@www.heiming.de> wrote: > > > Should work, however I see now reason why you should reboot, or > > > even change the runlevel, > > > I'm not really sure if something is using /usr/local or not, > > and hunting every single process is quite time-consuming, dropping > > in single user or rebooting into it it's the fastest way. > > # time ps aux | awk 'NR!=1{system("lsof -p "$2"| grep \"/usr/local\"")}' > [some lines about mozilla] > > real 0m5.130s > user 0m1.830s > sys 0m3.220s Well, yes. That's useful. However, if something is cron-job started or run by a user while this transfer is going on, it's a bit more dangerousl. Now me? I'd look at my partition table and consider simply expanding / to include all the previously unallocated space and leave /home and /usr/local the heck alone. I'm not a big believer in over-partitioning with modern large and reliable disks and backup tools that no longer require you to "dump" raw partitions, or restore them that way. Otherwise, to put /usr/local and /home on the new disk space, you really need to use two partitions, or maybe create a /home partition and make /usr/local a link to a directory there, such as /home/local. Been there, done that with weird disk allocations. |
| |||
| Nico Kadel-Garcia <nkadel@comcast.net> wrote: > "Michael Heiming" <michael+USENET@www.heiming.de> wrote in message > news:ct5isb.hua.ln@news.heiming.de... [..] > > # time ps aux | awk 'NR!=1{system("lsof -p "$2"| grep \"/usr/local\"")}' [..] > Well, yes. That's useful. However, if something is cron-job started or run > by a user while this transfer is going on, it's a bit more dangerousl. As written in this thread I'd log of users if any and touch /etc/nologin, stopping crond might be another good idea, usually I don't expect anything to write to /usr/local unless the box has a special setup. > Now me? I'd look at my partition table and consider simply expanding / to > include all the previously unallocated space and leave /home and /usr/local > the heck alone. I'm not a big believer in over-partitioning with modern > large and reliable disks and backup tools that no longer require you to > "dump" raw partitions, or restore them that way. Now I disagree, for some desktop this might be fine, albeit I'd put at least /home on a on partition. A server is much better & easier maintainable using separate partitions. -- Michael Heiming Remove +SIGNS and www. if you expect an answer, sorry for inconvenience, but I get tons of SPAM |
| |||
| Nico Kadel-Garcia <nkadel@comcast.net> wrote: > Now me? I'd look at my partition table and consider simply expanding / to > include all the previously unallocated space and leave /home and /usr/local > the heck alone. That's another solution, but the simple terms "expanding /" make me shiver... I'm not a big believer in those "partition mangling" tools... Davide -- | The BOFH's First Axiom: There are no inappropriate means for achieving | the goal of getting questions or silence. Named by Mike Andrews, | defined by Rebecca Ore |
| ||||
| "Davide Bianchi" <davideyeahsure@onlyforfun.net> wrote in message news:bsjdv3$d4lvb$1@ID-18487.news.uni-berlin.de... > Nico Kadel-Garcia <nkadel@comcast.net> wrote: > > Now me? I'd look at my partition table and consider simply expanding / to > > include all the previously unallocated space and leave /home and /usr/local > > the heck alone. > > That's another solution, but the simple terms "expanding /" make me > shiver... I'm not a big believer in those "partition mangling" tools... > > Davide They work pretty well. But I'm a sneaky weasel: I've done dirty tricks like turn off swap, move that where I want it to be, made it a filesystem, poured a compressed image of the OS into a tarball on that partition, repartitioned the rest, and poured the tarball back onto the new partitions, then re-formatted and enabled swap. But I'm a complete weasel and comfortable with that sort of filesystem mangling. |