5

Although I've found numerous guides and questions already I still don’t seem to be able to get this to work.

Situation: I’m trying to move the home folders of 2 users to an already mounted disk. The home folders are now on the hard disk mounted as /. This is an SSD so it’s not really the safest way of storing data (including mbox files) so I’m trying to move everything to my RAID 1 disc already mounted at /media/dataB.

There are already some other folders and files located at this drive, so this differs from the guides and Ubuntu documentation I’ve found. The guides seem to focus on an entirely new partition.

Problem: I’ve been able to copy the home folder to the new partition as described in the guides using rsync. So the data is already at the correct disc. The problem is in mounting the directory as /home using fstab.

I’ve tried mounting /media/dataB/home as /home but this gives an error at boot. Can someone see what I’m doing wrong here or help me with the correct way of mounting /home at /media/dataB/home?

Additional info:

fstab

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
UUID=06b46ce6-fb4c-4483-889f-00c07d28c5d4 /               ext4    errors=remoun$
UUID=473ec3ce-dd2d-41a6-aad0-7ce5eb176473 none            swap    sw           $
/dev/sdb1       /media/dataC    ext4    defaults        0       2
/dev/sdc1       /media/dataA    ext4    defaults        0       2
/dev/sdd1       /media/dataB    ext4    defaults        0       2

Blkid

/dev/sda1: UUID="06b46ce6-fb4c-4483-889f-00c07d28c5d4" TYPE="ext4"
/dev/sda5: UUID="473ec3ce-dd2d-41a6-aad0-7ce5eb176473" TYPE="swap"
/dev/sdb1: UUID="c317e2c3-7a12-4bbc-bf10-bf7b988ca934" TYPE="ext4"
/dev/sdc1: UUID="7217a19a-e6c2-4e36-b584-aad1ae2ef622" TYPE="ext4"
/dev/sdd1: UUID="ecebe9eb-3838-42f4-8c53-9b391b6ca9c2" TYPE="ext4"
4
  • How exactly did you try mounting it? Using bind?
    – terdon
    May 29, 2014 at 13:12
  • Using mount, and editing fstab, mount /home /media/dataB/home. However only mounting it with mount is not sufficient I think, you have to edit fstab for mounting at startup too right?
    – elmex
    May 29, 2014 at 13:16
  • Yes. I'm not at my computer right now, so I can't check the details, but adding a line that mounts the directory with bind should work. Search for mount bind. Anyway, that's not needed, see my answer for another approach.
    – terdon
    May 29, 2014 at 13:20
  • I'm not sure if I understand the question, but would you need to change the users home directory in /etc/passwd?
    – Dan
    May 29, 2014 at 13:20

2 Answers 2

4

From what I can see /media/dataB/home is a directory and not a device, therefore you can not mount it on /home

What you could do is:

  • Edit the profiles of both users so their home directory becomes /media/dataB/home/user1 and /media/dataB/home/user2 rather than /home/user1 and /home/user2. To do that use sudo gedit /etc/passwd, locate the lines for the 2 users and carefully replace their home directory.
  • Remove (OK, rename for the time being) their existing home directories
  • Make a link from /home/user1 to /media/dataB/home/user1 to help these programs that insist on looking into /home
3

It should be perfectly possible to mount the directory using the bind option but it's not necessary anyway. Just make /home a symlink to /media/dataB/home:

sudo mkdir /media/dataB/home
sudo cp -rp /home/* /media/dataB/home/
sudo rm -r /home
sudo ln -s /media/dataB/home /home

Make sure you have a backup of the data, just in case.

1
  • Thank you this worked perfectly!!, this is in essence the same as smurf’s solution I think. I’ve never had heard of binding/symlink before (…this shows my inexperience with Linux hehe).
    – elmex
    May 29, 2014 at 13:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .