LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 06-03-2015, 03:13 PM   #1
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Rep: Reputation: 11
Post Separate linux parts after installing.


Hello.
Can I separate linux parts after installing? For example, I installed Linux in one partition but want to move "home" or "usr" to other partition.

Tnx.
 
Old 06-03-2015, 03:26 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,623

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
just reinstall

The Linux file system is like Microsoft and apples

can you MOVE C:\\users\yourName or move C:\\Program Files or C:\\WINDOWS\system32
 
Old 06-03-2015, 04:14 PM   #3
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 814

Rep: Reputation: 265Reputation: 265Reputation: 265
Reinstalling is not necessary, though I suggest that you be familiar with things like fstab and gparted before you proceed.

You're going to need a LiveCD/LiveUSB. All it really needs is to be able to mount your partitions and edit partitions. I use the Gparted LiveCD, though you can use almost any other live disto.


Once you're booted into your live distro, resize and create the new partitions. Once you've done that, mount your root partition to /mnt. Then rename the directory, (like "home" to "oldhome"). Then make a new directory ("newhome") and mount the new partion there. Then copy everything from the old directory to the new one. MAKE SURE THAT WHEN YOU COPY YOU PRESERVE PERMISSIONIS AND OWNERSHIPS. Then unmount the new partition and delete both directories (both oldhome AND newhome), and re-create the original directory ("home"). Then edit your fstab to mount the new partition to the mount point.

Hope this helps!
 
Old 06-04-2015, 03:27 AM   #4
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by John VV View Post
just reinstall

The Linux file system is like Microsoft and apples

can you MOVE C:\\users\yourName or move C:\\Program Files or C:\\WINDOWS\system32
I can.
With some tools like "Wintools.net" you can rename and change the location of Windows OS directories.

---------- Post added 06-04-15 at 03:27 AM ----------

Quote:
Originally Posted by maples View Post
Reinstalling is not necessary, though I suggest that you be familiar with things like fstab and gparted before you proceed.

You're going to need a LiveCD/LiveUSB. All it really needs is to be able to mount your partitions and edit partitions. I use the Gparted LiveCD, though you can use almost any other live disto.


Once you're booted into your live distro, resize and create the new partitions. Once you've done that, mount your root partition to /mnt. Then rename the directory, (like "home" to "oldhome"). Then make a new directory ("newhome") and mount the new partion there. Then copy everything from the old directory to the new one. MAKE SURE THAT WHEN YOU COPY YOU PRESERVE PERMISSIONIS AND OWNERSHIPS. Then unmount the new partition and delete both directories (both oldhome AND newhome), and re-create the original directory ("home"). Then edit your fstab to mount the new partition to the mount point.

Hope this helps!
Can you learn it to me step by step?
 
Old 06-04-2015, 03:55 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,802

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
1. boot live cd,
2. create a new partition/filesystem on your new disk (gparted, big enough)
3. copy the whole /usr, /home (whatever you wanted to move) onto the new drive (keep permissions)
4. move/rename the old /usr, /home dir for example to /usr.removed, mkdir mount points, /usr or /home
5. modify your original /etc/fstab, add mount of the new filesystem(s)
6. if you made it properly you can boot the original system and will use the new, mounted filesystems. In case of any problem you can use the /usr.removed for reference or in case of any problem
restore: boot live cd, restore fstab, restore renamed dirs and you will get back the original config
7. finally if everything was really ok and tested and working you can really remove /usr.removed

If any point is unclear just ask
 
Old 06-04-2015, 08:46 PM   #6
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 814

Rep: Reputation: 265Reputation: 265Reputation: 265
I'll give an example, one that I actually did a month ago. I moved my /var to a separate partition.

Shut down the computer.
Boot from a LiveCD.
Open Gparted and move the partitions around until you have a new partition. I'll call it sda3.
Click "apply" and let it do its thing. Depending on what you moved around, it may take a while.
Close Gparted.

Then get a root terminal.
Mount the root filesystem to /mnt. For this example, it's sda1.
Code:
mount /dev/sda1 /mnt
Once you've mounted it, rename the directory that you want to move.
Code:
mv /mnt/var /mnt/oldvar
Then create a new directory, and mount the partition there.
Code:
mkdir /mnt/newvar
Copy everything from oldvar to newvar, making sure to keep permissions. I used rsync, but I think you can just use cp if you want to.
Code:
rsync -av /mnt/oldvar/ /mnt/newvar/
Note that you MUST include the trailing / on both paths. Rsync is really picky about that.

Once that's done, you can unmount the new partition
Code:
umount /mnt/newvar
Then delete both of the directories
Code:
rm -rf /mnt/oldvar/ /mnt/newvar
Then create the directory to mount it to
Code:
mkdir /mnt/var
Then edit your fstab (/mnt/etc/fstab) and add a line for the new partition. For the example I'm using, I would add a line like this:
Code:
/dev/sda3   /var   ext3   rw,noatime    0   2
Then shut down the live session, boot from the hard drive, and you should be good to go!

Hope this helps
 
Old 06-05-2015, 10:20 PM   #7
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,841

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Since sysytemd is installed you may have to rebuld initrd so that systemd does't complain about sepreate .usr.
 
  


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
[SOLVED] Using '_' or '-' to separate parts of object names (e.g. files) LawrenceCuda@waob.org Linux - Newbie 1 02-24-2012 03:01 PM
installing windows and Linux in separate hard disk muvendrann Linux - Newbie 2 10-22-2009 08:24 AM
Installing Linux from a Separate Partition LinTech Linux - General 2 10-06-2004 03:33 PM
Installing Linux and WinXP on separate partitions rosol11 Linux - Newbie 5 06-26-2004 06:11 AM
Installing linux on a separate hard-drive Hawkboy Linux - Newbie 4 08-16-2002 12:04 PM

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

All times are GMT -5. The time now is 02:37 AM.

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