LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-06-2017, 02:00 AM   #1
dalvikvm
LQ Newbie
 
Registered: Sep 2017
Posts: 4

Rep: Reputation: Disabled
Question Moving /root directory to another drive


I installed Linux on SSD and mounted /home to another drive. How can I swap /home to /root?
 
Old 10-06-2017, 03:47 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 15,446

Rep: Reputation: 2173Reputation: 2173Reputation: 2173Reputation: 2173Reputation: 2173Reputation: 2173Reputation: 2173Reputation: 2173Reputation: 2173Reputation: 2173Reputation: 2173
Quote:
Originally Posted by dalvikvm View Post
I installed Linux on SSD and mounted /home to another drive. How can I swap /home to /root?
Some clarification on terminology:
/home = home partition housing user directories
/root = /root's personal user directory
/ = the root partition.

I would not move /home to /root - it would be a permissions nightmare.
If you want to move the contents of your home partition to /, log out all users except root, [if there's no root login, use 'su -' as some user] choose some empty directory in /mnt or /media (I will use /mnt/tmp in the example) then do something like
Code:
# mount -o remount </home device, e.g, /dev/sdb1> /mnt/tmp
# cp -a /mnt/tmp/* /home && sync
 
1 members found this post helpful.
Old 10-06-2017, 10:18 AM   #3
Rickkkk
Senior Member
 
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,363

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
... ABSOLUTELY in agreement with business_kid's comments ... Unless I'm misunderstanding your question, what you are suggesting is at best very unusual and potentially destabilizing.

If you could explain what you are attempting to accomplish, it may make it easier for members to provide helpful answers and advice.

Cheers.
 
Old 10-06-2017, 12:20 PM   #4
dalvikvm
LQ Newbie
 
Registered: Sep 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
I'm just swapping /home and /root. I want to move /root not / (I know). I didn't see mount point /root on installation so I use /home instead now I want to swap it with /root.
 
Old 10-06-2017, 12:48 PM   #5
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,789

Rep: Reputation: 427Reputation: 427Reputation: 427Reputation: 427Reputation: 427
Maybe I'm missing something here, but it seems like a rather simple task that could be done by booting off a live medium, then, as root mounting the drives containing /home and /root, making any moves, and, finally, adjusting ownerships and permissions.

On second thought, back up /home and /root before trying to pull off the switch.
 
Old 10-06-2017, 03:03 PM   #6
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,406
Blog Entries: 8

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
You really really really do not want to move /home to /root. I'm not even going to begin to say how to do that, because it's crazy how much of a bad idea it is and what weird stuff would be necessary to actually do it.

Instead, I'll tell you what you really want to do:

1) Log out with all regular users (if any are logged in).

2) Log in as root on a console (ctrl-alt-f1 to get to the text console login; ctrl-alt-f7 to get back to the GUI login)

I'm assuming you're not running Ubuntu or any Ubuntu derivative. If so, then yippee! You've just discovered one of the reasons doing things the Ubuntu way is dumb. (I think that if you are running an Ubuntu derivative, making it so you can log in as root is "sudo passwd"...prepare for confusion about the passwords it's asking you though...)

3) While logged in as root, do the following commands:

Code:
mkdir /home2
cp -vax /home/* /home2/
umount /home
mv -vi /home2/* /home/
4) edit /etc/fstab and comment out the entry for /home

Pretty easy, really.
 
Old 10-06-2017, 05:39 PM   #7
Rickkkk
Senior Member
 
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,363

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Quote:
Originally Posted by dalvikvm View Post
I'm just swapping /home and /root. I want to move /root not / (I know). I didn't see mount point /root on installation so I use /home instead now I want to swap it with /root.
IsaacKuo has detailed instructions in an above post as to how to go about doing something different than what you are asking. With respect, I would recommend you consider his alternative and definitely rethink your plan.

As mentioned earlier, the /root directory is the "root" user's home directory ... Moving or copying anything into this is an unusual thing to want to do and I am not convinced you are aware of the potential impacts and permissions issues involved.

I do apologize for insisting, but a bit more detail might help members here understand your motivation for suggesting this.

Cheers.
 
  


Reply

Tags
mount, mount point


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] Invoke root directory owner/group while moving file/directory yogesh_attarde Linux - Security 5 04-14-2014 11:36 PM
[SOLVED] Moving a file to the root of the drive via command line 1234rewq Linux - Newbie 8 10-17-2010 07:40 AM
Moving Application from root Directory in Solaris10 techM Solaris / OpenSolaris 2 06-14-2010 02:27 AM
Having problems moving home directory to second drive. coldbeer Slackware 4 02-08-2008 10:38 PM
Moving root directory tree to new hardrive paul.nel Linux - General 3 01-22-2004 12:28 AM

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

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