LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 02-26-2007, 01:40 PM   #1
parv
Member
 
Registered: Jul 2004
Location: USA
Distribution: Mint, Scientifc Linux, Ubuntu
Posts: 180

Rep: Reputation: 30
how to create a new partition for current /home directory?


Want to enable quota on users under /home.
but /home is not a partition so I cannot
mount it to /etc/fstab. The output of df -h is:

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
108G 64G 40G 62% /
/dev/sda1 99M 19M 75M 21% /boot
none 501M 0 501M 0% /dev/shm

I want to create a new partition so that I can
move all user data currently located at /home to it.
And, I want to keep the new partition name as "/home".
There is no /home entry in the current /etc/fstab

Please show me some details of the commands I should use.
I don't want to mess up current multi-user data.
So I have to be very careful.

Appreciate your advice.
 
Old 02-26-2007, 02:38 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Your output would indicate /home is a subdirectory (not a submount) of / which is the root filesystem. You could actually enable quotas on / but you'd have to be sure to give all administrative accounts unlimited quotas so it might be dangerous.

Output also indicates you're running Logical Volume Manager (LVM).

Whether you can make a separate /home depends on whether you have free space in the VG (Volume Group), VolGroup00 of LVM or alternately whether you had free space that was as yet unpartitioned. You probably don't have the latter.

You can run "fdisk -l /dev/sda" to see the partitions of your drive.

You run "vgdisplay" to see the free space of your VG. Look for the line that has "Free PE / Size" on it.

If you have space you can create a new partition or Logical Volume (LV).

You could do something like:
mv /home /home.old
mount <new partition or LV> /home
cp -pR /home.old/* /home

You could then do your quotas for /home.
 
Old 02-26-2007, 02:47 PM   #3
parv
Member
 
Registered: Jul 2004
Location: USA
Distribution: Mint, Scientifc Linux, Ubuntu
Posts: 180

Original Poster
Rep: Reputation: 30
thanks for your reply, here is part of the output of vgdisply:

VG Name VolGroup00
Format lvm2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 111.69 GB
PE Size 32.00 MB
Total PE 3574
Alloc PE / Size 3570 / 111.56 GB
Free PE / Size 4 / 128.00 MB

It seems to me that I have only 4 PEs free space. So I guess I should either resize the
current partition to get more free space or add another hard disk. Any other suggestions?


Quote:
Originally Posted by jlightner
Your output would indicate /home is a subdirectory (not a submount) of / which is the root filesystem. You could actually enable quotas on / but you'd have to be sure to give all administrative accounts unlimited quotas so it might be dangerous.

Output also indicates you're running Logical Volume Manager (LVM).

Whether you can make a separate /home depends on whether you have free space in the VG (Volume Group), VolGroup00 of LVM or alternately whether you had free space that was as yet unpartitioned. You probably don't have the latter.

You can run "fdisk -l /dev/sda" to see the partitions of your drive.

You run "vgdisplay" to see the free space of your VG. Look for the line that has "Free PE / Size" on it.

If you have space you can create a new partition or Logical Volume (LV).

You could do something like:
mv /home /home.old
mount <new partition or LV> /home
cp -pR /home.old/* /home

You could then do your quotas for /home.
 
Old 02-27-2007, 09:21 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Resizing root would be a bit of a problem but you're correct that you'd essentially have to do that.

You can try a Google search for how to do the resize. It's not something I've done in Linux. If it were me I'd probably just backup the whole thing and reload the OS making sure to size the LVs during the install. I'd then restore /home to the newly created /home from the backup.

During the FC install I typically tell it to do automatic disk layout but put a check in the box that allows me to edit the layout. Then in the layout screen I modify the LVs. (For some bizarre reason it defaults to having / as the entire VG - it even did this on a system I just loaded with 6 x 36 GB drives in RAID0 set. I was able to break that up into /home, /var, /opt, /usr, /oracle and of course /. (/boot by the way always goes on a partition rather than an LV).

Another idea to investigate:

Loopback mounts. I'm not sure if you can mount a sudbirectory as a loopback but if you can it would probably be the safest way to go. Essentially loopback mounting lets you mount an existing filesystem to another location (e.g. / as /tmp/newroot). You'd have to research the subdirectory idea. I see a Wikipedia entry that says it will mount regular files so it seems it *ought* to do subdirectories but in my brief look just now I didn't find it. (See also lofs man page.)

The loopback idea being something like:
mv /home /realhome
*loopback mount /realhome /home* (not a syntax just a step to be researched).
Then put your quotas on the loopback mounted /home.

I haven't really played much with loopback mounts but it seems the above approach might work.
 
  


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
useradd: cannot create directory /home/ amirzkria Red Hat 5 08-07-2014 09:11 AM
how to create a new partition to replace current /home? parv Fedora 2 02-26-2007 02:24 PM
Getting the home directory of current user in c++ jimsproch Programming 2 04-10-2006 01:15 AM
home directory auto create problem bobthehorrible Linux - Networking 2 10-13-2005 09:54 AM
adding a new user doesn't create a home directory abrakadabra Linux - General 6 08-09-2002 08:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 05:50 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