Professional Web Applications Themes

moving /home and /usr/local to partition? - Linux Setup, Configuration & Administration

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"...

  1. #1

    Default moving /home and /usr/local to partition?

    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 Guest

  2. #2

    Default Re: moving /home and /usr/local to partition?

    Larry Gagnon <com> wrote: 

    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 Guest

  3. #3

    Default Re: moving /home and /usr/local to partition?

    Davide Bianchi <net> wrote: [/ref]
     

    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 Guest

  4. #4

    Default Re: moving /home and /usr/local to partition?

    Michael Heiming <michael+heiming.de> wrote: 

    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
    |
    |
    |
    |
    |
    Davide Guest

  5. #5

    Default Re: moving /home and /usr/local to partition?

    Larry Gagnon <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




    Bill Guest

  6. #6

    Default Re: moving /home and /usr/local to partition?

    Davide Bianchi <net> wrote: [/ref]
     

    # 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 Guest

  7. #7

    Default Re: moving /home and /usr/local to partition?


    "Michael Heiming" <michael+heiming.de> wrote in message
    news:heiming.de... [/ref]

    >
    > # 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[/ref]

    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 Guest

  8. #8

    Default Re: moving /home and /usr/local to partition?

    Nico Kadel-Garcia <net> wrote:
     
    [..] [/ref]
    [..] 

    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 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
    Michael Guest

  9. #9

    Default Re: moving /home and /usr/local to partition?

    Nico Kadel-Garcia <net> wrote: 

    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 Guest

  10. #10

    Default Re: moving /home and /usr/local to partition?


    "Davide Bianchi" <net> wrote in message
    news:bsjdv3$d4lvb$news.uni-berlin.de... [/ref]
    to [/ref]
    /usr/local 
    >
    > That's another solution, but the simple terms "expanding /" make me
    > shiver... I'm not a big believer in those "partition mangling" tools...
    >
    > Davide[/ref]

    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.


    Nico Guest

  11. #11

    Default Re: moving /home and /usr/local to partition?


    "Michael Heiming" <michael+heiming.de> wrote in message
    news:heiming.de... 
    > [..] [/ref][/ref]
    \"/usr/local\"")}' [/ref]
    run 
    >
    > 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.
    > [/ref]
    to [/ref]
    /usr/local 
    >
    > 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.[/ref]


    No its not.
    You'd been brainwashed by the 'thats the way it was done on the PDP11'
    crowd.

    If you have small partitions, you have to maintain the balance between the
    partitions, which is some maintenance.

    The sum of the small partitions cant exceed the size of the large
    partitition that would replace them.
    So there is no win in size - there is nothing 'better'.

    Having one large partition does delay the time that there is a disk space
    crisis - now dont use the argument that when that crisis occurs there is a
    big crisis. you can do maintenance at any threshold you want. you can
    clean out the garbage when the drive is 90% empty if you like.

    Waiting until crisis is your fault.




    Leon. Guest

  12. #12

    Default Re: moving /home and /usr/local to partition?

    Leon. <noemail.com> wrote:
     
    [..] [/ref]
    ^^^^^^^^^ [/ref]

     
     
     
     
     

    Now can you resize / while running, no you can't. The first
    reason out of numerous for setting up partitions.

    How do you want to add storage while running, without rebooting?
    It doesn't work out with your approach and you obviously have no
    clue about enterprise computing, so please creep under the stone
    were you cam from, thx.

    --
    Michael Heiming

    Remove +SIGNS and www. if you expect an answer, sorry for
    inconvenience, but I get tons of SPAM
    Michael Guest

  13. #13

    Default Re: moving /home and /usr/local to partition?

    Michael Heiming <michael+heiming.de> writes:

    ]Leon. <noemail.com> wrote:

    ]> "Michael Heiming" <michael+heiming.de> wrote in message
    ][..]
    ]> > 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.


    ]> No its not.
    ]> You'd been brainwashed by the 'thats the way it was done on the PDP11'
    ]> crowd.

    ]> If you have small partitions, you have to maintain the balance between the
    ]> partitions, which is some maintenance.

    ]> The sum of the small partitions cant exceed the size of the large
    ]> partitition that would replace them.
    ]> So there is no win in size - there is nothing 'better'.

    ]> Having one large partition does delay the time that there is a disk space
    ]> crisis - now dont use the argument that when that crisis occurs there is a
    ]> big crisis. you can do maintenance at any threshold you want. you can
    ]> clean out the garbage when the drive is 90% empty if you like.

    ]> Waiting until crisis is your fault.

    ]Now can you resize / while running, no you can't. The first
    ]reason out of numerous for setting up partitions.

    ]How do you want to add storage while running, without rebooting?
    ]It doesn't work out with your approach and you obviously have no
    ]clue about enterprise computing, so please creep under the stone
    ]were you cam from, thx.
    ????
    Are you babbling, because what you say does not make much sense.With jut
    one partition, why would you want to resize / or add storage. You have
    it all. / is as large as it can be as is the storage.
    The key reason for partitions is for backup and reinstallation. When
    reinstalling you do NOT want to have to erase all fo the /home stuff or
    the /usr/local stuff that you installed from tarballs. You want to be
    able to erase the / partition to reinstall while keeping all of the user
    or root added stuff. Thus at least two partitions ( / and say /local
    which contains /local/home and has a pointer from /usr/local)

    Bill Guest

  14. #14

    Default Re: moving /home and /usr/local to partition?

    Bill Unruh <physics.ubc.ca> wrote: 

    I'm afraid it does, Bill. You really don't manage multiuser systems for
    a living, you know!
     

    You'd want to split it up so that you could mount your /usr readonly,
    so that when the next power-outage happens (or the airconditioning
    breaks down and the disks explode, as happened here the other day),
    you come back on line with minimal damage suffered - the o/s intact. In
    fact you want everything on a different *disk*, just to minimize damage,
    but different partitions will do if you can't manage different disks.
     

    Which is baaaaaaaad. You want / to be as SMALL as you can make it.
    Believe me, you really do not want to restore a 50TB partition from
    tape. Not only will it not work, even if it does work, you will not
    like it. In fact, I refuse to make any partition bigger than the size
    of our backup media (about 4GB or 8GB, depending on type). Been there,
    done that.

    / is a good example of a partition that you want separate and as small
    as possible. As small as possible because the chance of damaging a
    partition is proportional to its size (among other things). And / is
    kinda vital.

    /boot is something you want separate so that you can share it between
    different o/s's. I mirror / to another partition or disk, so I *always*
    have at least two installations. And if I raid it, I don't want to
    raid the boot partition - too complicated. In fact, the one thing
    likely to go is your raid controller, at which point you are SOL
    anyway, because that controller isn't made any more and no other
    controller can read disks formatted with it.

    /tmp is another thing you often want separate - if only because you are
    sharing it between two o/s's! I personally eschew that and link it to
    /var/tmp, but that ruins peoples expectations (what, but I put my files
    in /var/tmp for safekeeping, what do you mean they aren't there after
    a reboot ...).

    /var you *always* want separate, because it is heavily written to.
    I've given up on using journalled filesystems for /var, because the high
    i/o wears a hole in the disk under the journal (honest! :-). But
    of course I use ext3fs for / and /usr and /usr/share and /usr/local ...
    even though most of those are mounted readonly.

    In fact I have taken to separating /var/spool to keel the mail out of
    harm from the partition filling up with people writing to /var/tmp,
    or logs filling /var/log. I can't afford mail to be down, because
    people *notice*.

    And even /var/spool/mqueue and /var/spool/mail I keep separate these
    days, because of the vicious mail loop that occurs when they nearly
    fill up and the system starts sending mail messages to root saying
    that the system is nearly full. And other horror error conditions.

     

    And for minimizing damage, and for minimizing downtime, and for
    maximizing portability. And for managing space taken by different
    people, and groups. Etc.
     

    /usr/local is the standard place for it, but I must say I like the idea
    of /local!

    Peter
    P.T. Guest

  15. #15

    Default Re: moving /home and /usr/local to partition?

    Bill Unruh <physics.ubc.ca> wrote: 
     
     

    [..]
     

    You did read the word "server"? Meaning more then one disk
    and the ability of adding/removing storage while running might
    be important.
     

    For some desktop it's usually fine to keep things simple, perhaps
    mount /home from some NFS server if possible.

    Regards

    --
    Michael Heiming

    Remove +SIGNS and www. if you expect an answer, sorry for
    inconvenience, but I get tons of SPAM
    Michael Guest

Similar Threads

  1. Replies: 2
    Last Post: November 30th, 07:31 AM
  2. question about moving /usr from / to separate partition in solaris 7 / sparc
    By dlbrewe@xspamxhotmail.com in forum Sun Solaris
    Replies: 11
    Last Post: September 20th, 10:56 AM
  3. Moving /home to its own partition.
    By alex in forum Debian
    Replies: 15
    Last Post: August 8th, 08:00 PM
  4. XP Pro another partition w/ XP Home?
    By Martin Schmid in forum Windows XP/2000/ME
    Replies: 2
    Last Post: July 3rd, 07:41 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139