Moving /home to its own partition.

Ask a Question related to Debian, Design and Development.

  1. #1

    Default Moving /home to its own partition.

    Suppose Debian was installed on hda with only two partitions, swap
    and / and you have accumulated much data in /home.

    Later, you add another hard drive, hdb, and decided to place swap
    and a separate /home partition on this new drive while keeping / on
    the original hda.

    How would you create new swap and /home partitions om hdb so Debian
    would use these instead of the original /home and swap?

    Additionally, how could you best utilize the space gained by
    transferring data from the original /home to the new /home partition?

    alex



    --
    To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
    with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
    alex Guest

  2. Similar Questions and Discussions

    1. Moving Randomly Moving Sprite To New Location on mouseEnter
      Hi All, This is way over my head. I am currently using Director 8. I have a randomly moving sprite(call it X) on stage (I accomplished this...
    2. Moving /home out of rootvg
      I installed AIX 4.3.3 on my system and want to move /home to a separate disk. I umount'ed /home, deleted hd1 from the rootvg, created a new volume...
    3. Jaguar - Moving Appplications Folder to seperate partition (/etc/fstab)
      Dear Readers, I have just installed Mac OSX 10.2.6 onto my power book. I have partitioned my drive with Mac OSX, Applications and Users. (12 Gb...
    4. Moving PC from work to home ( from network to standalone)
      PLEASE HELP! I tried this for my windows xp professional, the problem is step 5 this option is greyed out and can not be selected the only...
    5. XP Pro another partition w/ XP Home?
      I have an evalution of Win2K Adv Serv on my laptop, partition C I have WinXP Home on Partition E - I use for school and work. I have Data on...
  3. #2

    Default Re: Moving /home to its own partition.

    Hello

    alex (<radsky@ncia.net>) wrote:
    > Suppose Debian was installed on hda with only two partitions, swap
    > and / and you have accumulated much data in /home.
    >
    > Later, you add another hard drive, hdb, and decided to place swap
    > and a separate /home partition on this new drive while keeping / on
    > the original hda.
    >
    > How would you create new swap and /home partitions om hdb so Debian
    > would use these instead of the original /home and swap?
    First, you make the partitions, for example with cfdisk.

    Then you need to create a file system on your new home partition (with
    mkfs.ext3 for example, depending on what filesystem you want to use)
    and use mkswap with your swap partition. Use swapon to activate swap
    partitions.

    Next, mount your new partition somewhere, e.g. in /mnt, move the data
    from /home there, unmount the partition and remount it in /home. Add a
    line for the partition in your fstab.

    best regards
    Andreas Janssen

    --
    Andreas Janssen
    [email]andreas.janssen@bigfoot.com[/email]
    PGP-Key-ID: 0xDC801674
    Registered Linux User #267976


    --
    To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
    with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
    Andreas Janssen Guest

  4. #3

    Default Re: Moving /home to its own partition.

    On Sun, 2003-08-03 at 17:31, alex wrote:
    > Suppose Debian was installed on hda with only two partitions, swap
    > and / and you have accumulated much data in /home.
    >
    > Later, you add another hard drive, hdb, and decided to place swap
    > and a separate /home partition on this new drive while keeping / on
    > the original hda.
    >
    > How would you create new swap and /home partitions om hdb so Debian
    > would use these instead of the original /home and swap?
    Hi Alex,
    This is the basic step -- THIS IS NOT TESTED. wait for a few GURUS to
    debug.
    edit partition table with
    cfdisk /dev/hdb
    create file system with
    mkfs.ext2 /dev/hdb1
    mount new partition with
    mount /dev/hdb1 /mnt/home2
    move data to new partition with
    mv /home/* /mnt/home2
    get rid of old home directory with
    rmdir /home
    modify /etc/fstab to point to new partition with
    edit /etc/fstab
    add "/dev/hdb1 /home ext2 ?????? 1 1" (not sure what to put for ????)
    make changes active with
    reboot

    the swap is similar:
    cfdisk /dev/hdb
    mkswap /dev/hdb2
    edit /etc/fstab by changing /dev/<old-swap> to /dev/hdb2
    reboot
    >
    > Additionally, how could you best utilize the space gained by
    > transferring data from the original /home to the new /home partition?
    >
    > alex
    >
    >

    --
    To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
    with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
    Kevin Mark Guest

  5. #4

    Default Re: Moving /home to its own partition.

    > mkdir /b2
    > mount -t ext2 /dev/hdb2 /b2
    >
    > # Drop to single user; kills any pesky daemons writing stuff in background.
    > telinit 1
    >
    > # Anything here we don't understand? If not, proceed.
    > cd /home && ls -la
    >
    > # Copy everything whose name does not start with a dot.
    > cp -a * /b2 && sync
    >
    I was questioning the thing about not getting the dot files, but now I
    realize that this means not the dot files in /home. It would get the dot
    files in /home/<username> though. You would get the config files for the
    users. A little slow this morning.

    Question: What is the 'sync' for? I haven't done this before and am
    wondering what I've been missing.

    Thanks,
    Anita


    --
    To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
    with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
    ajlewis2@intac.com Guest

  6. #5

    Default Re: Moving /home to its own partition.

    Thanks all.... a lot of good info.


    --
    To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
    with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
    alex Guest

  7. #6

    Default Re: Moving /home to its own partition.

    On Mon, Aug 04, 2003 at 03:33:17AM -0400, Kevin Mark wrote:
    > On Sun, 2003-08-03 at 17:31, alex wrote:
    > > Suppose Debian was installed on hda with only two partitions, swap
    > > and / and you have accumulated much data in /home.
    > >
    > > Later, you add another hard drive, hdb, and decided to place swap
    > > and a separate /home partition on this new drive while keeping / on
    > > the original hda.
    > >
    > > How would you create new swap and /home partitions om hdb so Debian
    > > would use these instead of the original /home and swap?
    > Hi Alex,
    > This is the basic step -- THIS IS NOT TESTED. wait for a few GURUS to
    > debug.
    I wouldn't call myself a GURU, but I seem to have done this sort of
    thing quite a lot recently...
    > edit partition table with
    > cfdisk /dev/hdb
    > create file system with
    > mkfs.ext2 /dev/hdb1
    > mount new partition with
    > mount /dev/hdb1 /mnt/home2
    ... assuming that /mnt/home2 exists; if not, either create it or just
    use /mnt
    > move data to new partition with
    > mv /home/* /mnt/home2
    Everyone has their own recipe for this, it seems... I prefer 'cp -a',
    which preserves permissions, handles special files correctly, doesn't
    ignore dot files, and stuff.

    cp -a /home/* /mnt/home2
    > get rid of old home directory with
    > rmdir /home
    if you used cp -a instead of mv:

    rm -rf /home (gets rid of old stuff)
    mkdir /home (you still need a /home as a mount point)

    Note that:
    rm -rf /home/* won't get rid of those pesky dot files
    rm -rf /home/.* gets rid of a little bit too much...
    > modify /etc/fstab to point to new partition with
    your-favourite-editor /etc/fstab
    > add "/dev/hdb1 /home ext2 ?????? 1 1" (not sure what to put for ????)
    Make that "/dev/hdb1 /home ext2 defaults 0 2"
    > make changes active with
    umount /mnt/home2
    mount /home

    (no need to reboot!)
    > the swap is similar:
    > cfdisk /dev/hdb
    (if you forgot to define a swap partition the first time you ran cfdisk)
    > mkswap /dev/hdb2
    Turn off swap while editing swap entry in /etc/fstab:

    swapoff -a
    > edit /etc/fstab by changing /dev/<old-swap> to /dev/hdb2
    Turn on new swap:

    swapon -a

    (again, no need to reboot)

    cfdisk tends to moan at you to reboot to make sure that the kernel
    re-reads the partition table. IME this is a "safety message" which is
    given irrespective of whether it's needed; if nothing is using the
    disk in question (as is the case when partitioning a brand-new disk)
    the kernel re-reads the partition table quite happily. You know it has
    done this by the line that appears which messes up the screen layout
    and is recognisable as similar to the lines in dmesg produced by the
    kernel when it reads the partition table on bootup. If you don't see
    such a line, you need to reboot immediately on quitting cfdisk, before
    you do anything else. You still don't need to reboot at any other point.
    > > Additionally, how could you best utilize the space gained by
    > > transferring data from the original /home to the new /home partition?
    Define 'best' - there are loads of possible answers here... For an
    ordinary home PC I'd say just leave it in / and the system will use it
    as it needs it.

    To make available the space used by your original swap partition,
    you'll need to use parted. Assuming your old swap is on /dev/hda1 and
    your / is on /dev/hda2:

    parted /dev/hda
    p (prints out a listing of the current partition table. You need this
    information for resizing)
    rm 1 (deletes /dev/hda1)
    resize 2 START END (START = what p gave you for Start on /dev/hda1
    END = what p gave you for End on /dev/hda2
    This resizes /dev/hda2 to include the space
    originally used for /dev/hda1)
    q (quit)

    You'll need to boot off a rescue disk, install CD or something to do
    this, as it is dangerous to do it on a mounted filesystem.

    --
    Pigeon

    Be kind to pigeons
    Get my GPG key here: [url]http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x21C61F7F[/url]

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.0.6 (GNU/Linux)
    Comment: For info see [url]http://www.gnupg.org[/url]

    iD8DBQE/Ln1UUxADjyHGH38RAvUaAJ4z48ivTv8kuIH/AVfULVpC85F+2ACfXuqo
    MNjVzUAl9NZ1zL3SrixU0TA=
    =P71D
    -----END PGP SIGNATURE-----

    Pigeon Guest

Posting Permissions

  • You may not post new threads
  • You may 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