Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

During the installation I thought I had generated the correct fstab, but now, after cp complains that the filesystem is full, I discover that fstab is empty.

I have this configuration:

# lsblk 
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 232.9G  0 disk 
├─sda1   8:1    0   238M  0 part 
├─sda2   8:2    0   1.9G  0 part 
├─sda3   8:3    0  23.3G  0 part /
└─sda4   8:4    0 207.5G  0 part

But this is absolutely not what I want. I'd like to mount /dev/sda1 as /boot and /dev/sda4 as /home/user. /dev/sda2 is swap.

The problem is that I already added a ton of files in /home/user, all of which went in /dev/sda3, because that one was the only one mounted.

How do I fix this?

I could boot from a live cd, mount the partitions, run genfstab, but then? Where do my files under /home/user go? Is it safe?

Should I move all my home content into a temporary directory, mount /dev/sda4 and copy everything back?

share|improve this question
    
your files are in the sda3 so changing fstab by itself won't move the files. You could mkdir /home.new; mount /home.new /dev/sda4; mv /home/user /home.new; umount /home.new; rmdir /home; mv /home.new /home; mount /dev/sda4 /home; and then edit fstab to mount /home. –  bdowning Jun 29 '14 at 10:21
    
@bdowning: Ah, thank you for confirming what I was thinking. At which point should I run genfstab, at the end, after having mounted the right /home? –  rubik Jun 29 '14 at 10:26
    
@bdowning: Since I don't think there is a better way to do it, if you make an answer out of your comment, I'll gladly accept it. –  rubik Jun 29 '14 at 10:28
    
Well it didn't let me use mv because it was an inter-device operation, so I had to cp first and then rm. But now everything's ok! –  rubik Jun 29 '14 at 12:26
    
I made this as comment rather than an answer because it's not a general answer to a general problem encountered by many, but rather a specific prob encountered by you. –  bdowning Jun 29 '14 at 16:31

1 Answer 1

up vote 2 down vote accepted

Your files are in the sda3 partition, so changing fstab by itself won't move the files.
You could (among several alternatives)

mkdir /home.new
mount /dev/sda4 /home.new 
cp -a /home/user /home.new
umount /home.new
rf -fr /home
mv /home.new /home
mount /dev/sda4 /home

then edit fstab to include /home /dev/sda4

share|improve this answer
    
Just a typo in the first mount! Argument order should be reversed. :) –  rubik Jun 29 '14 at 20:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.