Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #188564 > unrolled thread

how to add a /home partition

Started byLong Wind <longwind2@yahoo.com>
First post2017-11-03 22:10 +0100
Last post2017-11-04 08:50 +0100
Articles 6 — 4 participants

Back to article view | Back to linux.debian.user

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  how to add a /home partition Long Wind <longwind2@yahoo.com> - 2017-11-03 22:10 +0100
    Re: how to add a /home partition Pol Hallen <deben@fuckaround.org> - 2017-11-03 22:40 +0100
    Re: how to add a /home partition <tomas@tuxteam.de> - 2017-11-03 22:40 +0100
      (solved) Re: how to add a /home partition Long Wind <longwind2@yahoo.com> - 2017-11-03 23:30 +0100
      Re: how to add a /home partition Michael Lange <klappnase@freenet.de> - 2017-11-04 00:40 +0100
        Re: how to add a /home partition <tomas@tuxteam.de> - 2017-11-04 08:50 +0100

#188564 — how to add a /home partition

FromLong Wind <longwind2@yahoo.com>
Date2017-11-03 22:10 +0100
Subjecthow to add a /home partition
Message-ID<uHRnY-C9-1@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

i have installed wheezy at /dev/sda3, no swapdisk space isn't enough nowi want to add /dev/sda4 as /home partitionbut how to do it? Thanks!

[toc] | [next] | [standalone]


#188568

FromPol Hallen <deben@fuckaround.org>
Date2017-11-03 22:40 +0100
Message-ID<uHRQZ-Nz-1@gated-at.bofh.it>
In reply to#188564
> i have installed wheezy at /dev/sda3, no swap
> disk space isn't enough now
> i want to add /dev/sda4 as /home partition
> but how to do it? Thanks!

mkfs.ext4 -v /dev/sda4

login from shell (no xorg) with root and mount sda4 to /home2, copy 
/home to /home2, rm home and rename home2 to home

Pol

[toc] | [prev] | [next] | [standalone]


#188569

From<tomas@tuxteam.de>
Date2017-11-03 22:40 +0100
Message-ID<uHRQZ-Nz-13@gated-at.bofh.it>
In reply to#188564
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, Nov 03, 2017 at 09:06:28PM +0000, Long Wind wrote:
> i have installed wheezy at /dev/sda3, no swapdisk space isn't enough nowi want to add /dev/sda4 as /home partitionbut how to do it? Thanks!

First, take a backup. Things tend to go wrong if they can!

Do all of this as root. Best if no user is logged in (since
this might change the contents of /home during the procedure;
safest is if you boot in single user mode)

 - if not done yet, set up a file system of your choice (I'll
   assume ext4, adjust to taste)

   mkfs.ext4 /dev/sda4

   *THIS WILL WIPE THE CONTENT OF /dev/sda4*

 - add /dev/sda4 to your /etc/fstab:

   a line like this

   /dev/sda4 /home           ext4    defaults        0       2

   (instead of /dev/sda4 you can insert the disk's UUID, which
   you find out with "sudo blkid /dev/sda4". This has the advantage
   that the blkid is sometimes more stable than the device name)

   Adjust your file system 

   *DON'T REBOOT YET*

 - copy the content of /home to your new disk:
   for example
   - mount /dev/sda4 somewhere suitable:

     mount /dev/sda4 /mnt

  - copy the contents of /home to its future location:

    rsync -av /home/ /mnt/
    (slashes are important)

    or cp -a /home/* /mnt

  - test your setup. Either issue "mount -a" and login as normal user
    or just reboot normally (if you were in single user mode, just
    reboot). All working?

  - if yes, you can wipe the content of your old /home, which is
    still taking up space on your /dev/sda3:

  - boot into single user mode

  - unmount /home (which is now /sda4)

    umount home

  - now your old home becomes visible. Wipe it

    rm -Rf /home/*

  - reboot. Done!

You didn't forget to take a backup, did you?

Don't hesitate to ask if anything is unclear. Proceed with caution!

Cheers
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAln84MkACgkQBcgs9XrR2kbz7wCfeWc8yEixUpWTzGc1hg3hW5Y0
JSQAnA0ivC9LtlVJ0xNBiUcMapKbEofl
=Zjy3
-----END PGP SIGNATURE-----

[toc] | [prev] | [next] | [standalone]


#188575 — (solved) Re: how to add a /home partition

FromLong Wind <longwind2@yahoo.com>
Date2017-11-03 23:30 +0100
Subject(solved) Re: how to add a /home partition
Message-ID<uHSDn-2fO-1@gated-at.bofh.it>
In reply to#188569

[Multipart message — attachments visible in raw view] — view raw

 Thank Pol Hallen and tomas@tuxteam.de!
tomas's instruction is detailed and professional, many thanks! 




 

    On Friday, November 3, 2017 5:34 PM, "tomas@tuxteam.de" <tomas@tuxteam.de> wrote:
 

 -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, Nov 03, 2017 at 09:06:28PM +0000, Long Wind wrote:
> i have installed wheezy at /dev/sda3, no swapdisk space isn't enough nowi want to add /dev/sda4 as /home partitionbut how to do it? Thanks!

First, take a backup. Things tend to go wrong if they can!

Do all of this as root. Best if no user is logged in (since
this might change the contents of /home during the procedure;
safest is if you boot in single user mode)

 - if not done yet, set up a file system of your choice (I'll
  assume ext4, adjust to taste)

  mkfs.ext4 /dev/sda4

  *THIS WILL WIPE THE CONTENT OF /dev/sda4*

 - add /dev/sda4 to your /etc/fstab:

  a line like this

  /dev/sda4 /home          ext4    defaults        0      2

  (instead of /dev/sda4 you can insert the disk's UUID, which
  you find out with "sudo blkid /dev/sda4". This has the advantage
  that the blkid is sometimes more stable than the device name)

  Adjust your file system 

  *DON'T REBOOT YET*

 - copy the content of /home to your new disk:
  for example
  - mount /dev/sda4 somewhere suitable:

    mount /dev/sda4 /mnt

  - copy the contents of /home to its future location:

    rsync -av /home/ /mnt/
    (slashes are important)

    or cp -a /home/* /mnt

  - test your setup. Either issue "mount -a" and login as normal user
    or just reboot normally (if you were in single user mode, just
    reboot). All working?

  - if yes, you can wipe the content of your old /home, which is
    still taking up space on your /dev/sda3:

  - boot into single user mode

  - unmount /home (which is now /sda4)

    umount home

  - now your old home becomes visible. Wipe it

    rm -Rf /home/*

  - reboot. Done!

You didn't forget to take a backup, did you?

Don't hesitate to ask if anything is unclear. Proceed with caution!

Cheers
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAln84MkACgkQBcgs9XrR2kbz7wCfeWc8yEixUpWTzGc1hg3hW5Y0
JSQAnA0ivC9LtlVJ0xNBiUcMapKbEofl
=Zjy3
-----END PGP SIGNATURE-----



   

[toc] | [prev] | [next] | [standalone]


#188578

FromMichael Lange <klappnase@freenet.de>
Date2017-11-04 00:40 +0100
Message-ID<uHTJ8-5Fu-7@gated-at.bofh.it>
In reply to#188569
Hi,

On Fri, 3 Nov 2017 22:34:02 +0100
<tomas@tuxteam.de> wrote:

> 
>   - copy the contents of /home to its future location:
(...)
>     or cp -a /home/* /mnt

to be nitpicking, shouldn't this rather be

         cp -a /home/. /mnt

just to cover the (admittedly unlikely) case there is some hidden
file or folder in /home ?

Best regards

Michael

.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

Killing is wrong.
		-- Losira, "That Which Survives", stardate unknown

[toc] | [prev] | [next] | [standalone]


#188582

From<tomas@tuxteam.de>
Date2017-11-04 08:50 +0100
Message-ID<uI1nj-541-1@gated-at.bofh.it>
In reply to#188578
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Nov 04, 2017 at 12:33:48AM +0100, Michael Lange wrote:
> Hi,
> 
> On Fri, 3 Nov 2017 22:34:02 +0100
> <tomas@tuxteam.de> wrote:
> 
> > 
> >   - copy the contents of /home to its future location:
> (...)
> >     or cp -a /home/* /mnt
> 
> to be nitpicking, shouldn't this rather be
> 
>          cp -a /home/. /mnt
> 
> just to cover the (admittedly unlikely) case there is some hidden
> file or folder in /home ?

Yes. Definitely. Thanks for the correction!

Cheers

> Killing is wrong.

:-)

- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAln9cJcACgkQBcgs9XrR2kbJ0QCfc5KlPXVk2sXn4dFu/5Cb9eCz
UowAn0QQHZXx9S80pcB0JvpqkN5NIZf7
=jd5t
-----END PGP SIGNATURE-----

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web