LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-24-2009, 06:43 AM   #1
Tom6
Member
 
Registered: May 2009
Posts: 116

Rep: Reputation: 16
HowTo setup a /home partition?


Hi
I want to try out different puplets on my hard-drive without having to mess around with setting and preferences for the same packages each time. Also it would be handy to avoid having to use my backup dvd's to put my data back onto the machine after each install.

Does puppy have a /home folder or something that i could put on a separate partition?

Thanks in advance
Regards from
Tom
 
Old 05-24-2009, 07:32 AM   #2
vashsna
Member
 
Registered: Oct 2006
Location: USA
Distribution: Mint, FreeBSD, Gentoo
Posts: 50

Rep: Reputation: 15
I have never used puppy but i would assume that it has fdisk or cfdisk to create an new partition to be /home, again assuming that you have free space on your hard drive to mess around without having to resize an current partition. Although to note use at your own risk, i would recommend doing some homework before rushing into it.
 
Old 05-24-2009, 08:14 AM   #3
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
While installing use a separate partition or lvm volume for /home directory
 
Old 05-24-2009, 11:23 AM   #4
Tom6
Member
 
Registered: May 2009
Posts: 116

Original Poster
Rep: Reputation: 16
Ok, partitioning is the easy part, for me, the tricky bit is trying to find /home (in Puppy) and move it onto the new partition.

Lol, the opposite way around from normal no doubt although i would guess that if it involves messing around with fstab then others may find that bit tricky too

Err i forgot to mention that i already have an existing Puppy and want to move it's existing /home (if i can find it) onto a new partition

Lol, thanks for your help so far chaps
Regards from
Tom
 
Old 05-24-2009, 05:08 PM   #5
Tom6
Member
 
Registered: May 2009
Posts: 116

Original Poster
Rep: Reputation: 16
I was expecting to find that going up a few levels from "My Documents" would get me to the root of the filesystem which would contain /mnt /etc /var /boot /home but /home seems to be missing?
 
Old 05-25-2009, 01:42 AM   #6
vashsna
Member
 
Registered: Oct 2006
Location: USA
Distribution: Mint, FreeBSD, Gentoo
Posts: 50

Rep: Reputation: 15
Yes, in every linux distro i have seen so far you should be able to see /home from doing a "cd /". Did you create a partition for /home in the first place?
 
Old 05-25-2009, 07:46 AM   #7
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

I really don't think that 'puppy' would create a separate partition to mount 'home' on therefore your 'home is probably on the same partition as the '/'.

You could use the cli to see the directory of choice by 'ls /' to see what is available;

Code:
~# ls /
archive/  boot/  etc/   lib/         media/  opt/   root/  srv/  tmp/  var/
bin/      dev/   home/  lost+found/  mnt/    proc/  sbin/  sys/  usr/
Notice the '/home'. If you do a 'mount';

Code:
~# mount
/dev/sda5 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda6 on /home type ext3 (rw)
/dev/sda7 on /usr type ext3 (rw)
/dev/sda8 on /var type ext3 (rw)
/dev/sda9 on /tmp type ext3 (rw)
/dev/sda1 on /mnt/winxp type fuseblk (rw,nosuid,nodev,noatime,allow_other,blksize=4096)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sdd2 on /media/Linux_Archive type ext3 (rw,nosuid,nodev,uhelper=hal,data=ordered)
Notice the '/home is on device '/dev/sda6' via;

Code:
~# cat /etc/fstab
/dev/sda2        swap             swap        defaults         0   0
/dev/sda5        /                ext3        defaults         1   1
/dev/sda6        /home            ext3        defaults         1   2
/dev/sda7        /usr             ext3        defaults         1   2
/dev/sda8        /var             ext3        defaults         1   2
/dev/sda9        /tmp             ext3        defaults         1   2
/dev/sda1        /mnt/winxp       ntfs-3g     umask=000        1   0
#/dev/cdrom      /mnt/cdrom       auto        noauto,owner,ro  0   0
/dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
tmpfs            /dev/shm         tmpfs       defaults         0   0
If you want to move your '/home' to another device or another partition on the existing device then you will need to prepare the partition or create it. You would first create the partition using 'fdisk' or 'cfdisk'. After you create the partition then you will need to prepare the partition for the filesystem. The mkfs is a front end for creating/formatting/preparing a partition for a filesystem. Type of filesystem can be a personal choice.

Once you have a partition to accept your new/old filesystem data then it's just a matter of copying or moving the files to that partition. Then you must edit your '/etc/fstab' to mount your new partition to the '/' of your current filesystem. As you wish to mount your new 'home' on '/home' then look at;

Code:
/dev/sda6        /home            ext3        defaults         1   2
as a sample. This technique is used all the time during system regeneration or expansion.
 
Old 05-25-2009, 08:31 AM   #8
Tom6
Member
 
Registered: May 2009
Posts: 116

Original Poster
Rep: Reputation: 16
Hey OneBeck, thanks i think that solves my troubles there. i was beginning to think Puppy was weirdly different but it looks like your commands will help me find out what's going on and then fix it.

Vashsna & Contusion, thanks too

Thanks and regards from
Tom

Last edited by Tom6; 05-25-2009 at 08:32 AM.
 
Old 05-26-2009, 03:08 PM   #9
Tom6
Member
 
Registered: May 2009
Posts: 116

Original Poster
Rep: Reputation: 16
Aargh, i'm too nervous about the fstab! Her's the way it looks right now

1 /dev/sda1 / ext2 defaults 01
2 none /proc defaults 00
3 none /sys sysfs defaults 00
4 none /dev/tpts devpts gid=2.mode+620 0.0
5 /dev/fdo /mnt/floppy auto noauto.rw 00

i think that's right, there might be a typo in there. I can't see any mention of /home so i should just add a line

6 /dev/sda4 /home ext2 defaults 1 2

Does that look ok?

Last edited by Tom6; 05-26-2009 at 03:39 PM.
 
Old 05-26-2009, 03:52 PM   #10
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98
Questions:
  1. Have you created a seperate partition for /home?
  2. Have you formated the partition as ext2?
  3. Have you backed up the current contents of /home?

Once you modify the /etc/fstab to include your new /home partition, the filesystem you have created will be mounted over the top of the existing /home (this is not something to worry too much about, but you need to do a little forward planning)

First, backup /home:
Code:
tar xvf /home.tar /home
Second, create a temporary mount point for your new partition and mount it:
Code:
mkdir /home2
mount /dev/sda4 /home2
Third, copy the files from /home to /home2:
Code:
cp -pR /home/* /home2
Forth, change the /etc/fstab as per your question.

Fifth, unmount/remount /dev/sda4:
Code:
umount /home2
mount /home
Sixth, test...

When happy, unmount /home and remove the contents from the sub-mounted folder.

UPDATE:

Puppy doesn't use /home (and logs you in as root)

The home area for the root account is /root in this instance.

It doesn't even provide a friendly way of creating new accounts (no /usr/sbin/useradd; no /usr/sbin/groupadd) .... I manually edited the /etc/passwd and /etc/shadow files to create an account, but you can't run the passwd command to change the password, there is no mkpasswd to create an encrypted passwd.

Now don't get me wrong, I like Puppy. It's just that I use it as a "Live Distro", the old rule of thumb "Don't leave yourself logged in as root" is just too ingrained for me to use Puppy as my main distro.

Last edited by Disillusionist; 05-26-2009 at 04:14 PM.
 
Old 05-26-2009, 04:44 PM   #11
soleilarw
Member
 
Registered: Apr 2009
Posts: 107

Rep: Reputation: 19
If you keep your old /home directory just as it is, and you mount any other device on top of it (like mount -t ext3 /dev/sda6 /home), then the mounted device will be available at your /home. Your old /home contents remain intact, but are hidden and not accessible as long as the other device is mounted on top of it. Of course make sure that the mounted device really has proper user home directories, otherwise only your root account will work properly.

Linux Archive

Last edited by soleilarw; 06-18-2009 at 04:13 AM.
 
Old 05-27-2009, 01:08 AM   #12
Tom6
Member
 
Registered: May 2009
Posts: 116

Original Poster
Rep: Reputation: 16
Thanks both of you there. I don't have anything i want to save in /home at the moment. On sda1 i have the usual 15 folders /boot /mnt /etc /dev and all that but no /home whereas on sda4 i only have a /home (and a "Lost&Found", which is the wastebin i think?). sda1 and sda4 are both ext2

Regarding user accounts, lol, typical - i think i'm going to have to stick with puppy on this machine tho. It's only got 256Mb Ram and even Puppy is quite slow. I've had a look at TinyCore, Dsl and AntiX on this machine but Puppy seemed to be the best one for some odd reason

Anyway, if my first paragraph helps you help me further then great
Thanks and regards from
Tom
 
Old 05-27-2009, 01:46 AM   #13
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98
Before you can mount a filesystem there needs to be a directory for it to be mounted on. If there is no /home directory, then you need to make one before you mount the filesystem there.

Puppy is not based on another distribution, but is custom built to only contain the components that it needs. This makes for a very small/efficient operating system, but does mean that you are restricted to what the designers considered to be required.

As I stated in my previous post, Puppy logs you on with the root account with root's home directory being /root.

Assuming you have already created the filesystem (and the /etc/fstab entry for /home)

Now you could copy the contents of /root to /home/root and modify the /etc/passwd entry to use the new home:
Code:
if [ ! -d /home ]
then
   mkdir /home
   mkdir /home/root
else
   if [ ! -d /home/root ]
   then
      mkdir /home/root
   fi
fi

cp -pR /root/* /home/root/.
rm /home/root/icewm
rm /home/root/bin
ln -s /usr/share/icewm /home/root/icewm
ln -s /home/root/my-applications/bin /home/root/bin
Then modify the root entry in /etc/passwd from:
Quote:
root:x:0:0:root:/root:/bin/sh
to:
Quote:
root:x:0:0:root:/home/root:/bin/sh
 
Old 05-27-2009, 02:54 AM   #14
Tom6
Member
 
Registered: May 2009
Posts: 116

Original Poster
Rep: Reputation: 16
Ooo, i'm not sure about moving the /root i'm quite happy that staying where it is. Really i was now just wondering what to do to fstab to make it pickup on the empty /home that i have put on sda4 which is an ext2 primary partition. Does this look about right?

1 /dev/sda1 / ext2 defaults 01
2 none /proc defaults 00
3 none /sys sysfs defaults 00
4 none /dev/tpts devpts gid=2.mode+620 0.0
5 /dev/fdo /mnt/floppy auto noauto.rw 00
6 /dev/sda4 /home ext2 defaults 1 2

Is the "defaults 1 2" something to do with permissions? I think i will worry about creating a non-root user later. It's not my main machine, just an old one i'm trying to get working for a friends sister. Hopefully she just wants emailing and web-surfing because that's kinda what she's saying. I've never tried setting up a separate /home before although Wolvix and Ubuntu seem to make it a lot easier than this worry about fstab. It's about time i got to grips with fstab tho.

Thanks and regards from
Tom

Last edited by Tom6; 05-27-2009 at 02:55 AM.
 
Old 05-27-2009, 02:00 PM   #15
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98
Quote:
Originally Posted by Tom6 View Post
Is the "defaults 1 2" something to do with permissions?
No..

defaults(in the fourth field) shows the mount options to be used.

1 (in the fifth field) tells the system that the filesystem needs to be dumped.

2 (in the sixth field) tells fsck to check this filesystem after it has finished with /

man fstab for more info
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot write $(HOME).dmrc file home is on a seperate partition Person_1873 Linux - Newbie 5 12-07-2008 01:41 PM
,dmrc problem after moving /home partition to NTFS partition yeehung Linux - Newbie 1 11-14-2007 06:17 AM
HowTo setup a proxy for my home lan fedix Linux - Networking 9 11-03-2007 04:18 AM
Partition Free Space - Move /home to the new partition gregkise Linux - General 5 12-16-2003 10:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration