how to create a new partition for current /home directory?
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.