Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
fstab operator error [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
lizardbrain
n00b
n00b


Joined: 03 Jun 2007
Posts: 64
Location: the swamp

PostPosted: Tue Mar 18, 2014 7:49 pm    Post subject: fstab operator error [solved] Reply with quote

50 or so years ago, when I was a young electronics technician, we called it "operator error". Here's what I stupidly did:

During the install process, while editing fstab, I forgot to add a line to mount /dev/sda4 at /home. Since then I've installed a bunch of packages, some with looooong compile times. I'd rather not start the install process again (although I will if necessary). Is there some way for me to move all /home data from /dev/sda3 to /dev/sda4 without trashing the system? dd? gparted?

Thanx for any help and/or recommendations.

Man, do I feel stupid.


Last edited by lizardbrain on Wed Mar 19, 2014 6:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
ferreirafm
Guru
Guru


Joined: 28 Jul 2005
Posts: 487
Location: Sao Paulo, Brazil

PostPosted: Tue Mar 18, 2014 7:59 pm    Post subject: Reply with quote

lizardbrain,
dd is likely to work but sda3 and sda4 partition should have strictly the same size. Otherwise I would use tar with ignore-failed-reads (see man).
Code:
dd if=/dev/sda3 of=/dev/sdb4

see manual for dd options.
Best
Back to top
View user's profile Send private message
lizardbrain
n00b
n00b


Joined: 03 Jun 2007
Posts: 64
Location: the swamp

PostPosted: Tue Mar 18, 2014 8:13 pm    Post subject: Reply with quote

Thanks for your reply, ferreirafm.

I apologize if my tendency to ramble resulted in a lack of clarity in my post. I don't want to move /dev/sda3 data to /dev/sda4; I just want to move the data in /home to /dev/sda4 from its current location on /dev/sda3. I'd like to leave all other data on /dev/sda3 intact. Am I correct in assuming that /dev/sda3 must be mounted for this operation?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54234
Location: 56N 3W

PostPosted: Tue Mar 18, 2014 8:43 pm    Post subject: Reply with quote

lizardbrain,

Log in as root, so /home is not in use.

Make a mountpoint /mnt/tmp and mount your home partition there.
Code:
cp -a /home/*   /mnt/tmp/


Now you have two copies of /home
Code:
touch  /mnt/tmp/newhome
so you can tell them apart.

With your fstab fixed, reboot and log in as a normal user.
Verify that /home/newhome exists.

Log out the normal user, log in an root,
Code:
umount /home

Verify that /home/newhome has gone away.

Remove the content of /home. (There is no hurry for this step)
Code:
mount /home

_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
ferreirafm
Guru
Guru


Joined: 28 Jul 2005
Posts: 487
Location: Sao Paulo, Brazil

PostPosted: Tue Mar 18, 2014 8:50 pm    Post subject: Reply with quote

lizardbrain,
dd requires unmounted partitions. However, from your second post, I would rather use tar. In this case, both partition should be mounted if you want to tar and copy at the same time. Otherwise, you may tar your data first if your source partition has enough space and mount your target partition and copy your tarfile afterwards.
Best.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54234
Location: 56N 3W

PostPosted: Tue Mar 18, 2014 9:00 pm    Post subject: Reply with quote

ferreirafm,

dd doesn't care but if the partition you copy is in use, you will get an image of that in use filesystem.
The image will be made but it may not be any use to you.

cp -a, tar and rsync all work for the copy operation.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
lizardbrain
n00b
n00b


Joined: 03 Jun 2007
Posts: 64
Location: the swamp

PostPosted: Tue Mar 18, 2014 9:49 pm    Post subject: Reply with quote

NeddySeagoon,

An elegant solution, and one that saves me much time and heartache. As I already use rsync -avz for backups and I'm comfortable with it, I think that's what I'll use for this. I may not get to it until tomorrow, but if I manage to accomplish it without further screwups I'll add a "solved" to the subject line.

Thank you very much.

ferreirafm, once again, thanks for your help, too.
Back to top
View user's profile Send private message
ferreirafm
Guru
Guru


Joined: 28 Jul 2005
Posts: 487
Location: Sao Paulo, Brazil

PostPosted: Wed Mar 19, 2014 1:13 pm    Post subject: Reply with quote

NeddySeagoon wrote:
dd doesn't care but if the partition you copy is in use, you will get an image of that in use filesystem.

Hi Neddy,
I just suggested unmount to prevent filesystem modifications on the copying process. Otherwise, he may not have an exact copy of his data. I haven't test but I think you'll not get a useful image if you modify your partition when using dd. Did you?
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Wed Mar 19, 2014 1:26 pm    Post subject: Reply with quote

ferreirafm wrote:
I just suggested unmount to prevent filesystem modifications on the copying process. Otherwise, he may not have an exact copy of his data. I haven't test but I think you'll not get a useful image if you modify your partition when using dd. Did you?

Even if it won't, you miss his important part there :
NeddySeagoon wrote:
Log in as root, so /home is not in use.

ps: NeddySeagoon is the Gentoo Forum nick of Chuck Norris. He is never wrong, even if you are certain he is wrong ; it's because you are wrong ; in fact, you are just wrong to even think NeddySeagoon could be wrong.
Back to top
View user's profile Send private message
ferreirafm
Guru
Guru


Joined: 28 Jul 2005
Posts: 487
Location: Sao Paulo, Brazil

PostPosted: Wed Mar 19, 2014 2:08 pm    Post subject: Reply with quote

Hi krinn,
I apologize other readers for this off-topic post and also lizardbrain for being so imprecise in my answers. I will be glad in remove my post if you judge necessary. I was just trying to help and learn a bit more.
Best.
Back to top
View user's profile Send private message
lizardbrain
n00b
n00b


Joined: 03 Jun 2007
Posts: 64
Location: the swamp

PostPosted: Wed Mar 19, 2014 6:55 pm    Post subject: fstab operator error [solved] Reply with quote

Success!

Once again the Gentoo community has come through for me. I would've given up on Gentoo years ago if not for the support I get here.

Thank you.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54234
Location: 56N 3W

PostPosted: Wed Mar 19, 2014 7:18 pm    Post subject: Reply with quote

ferreirafm,

There are many ways to be right including your use of dd.
dd makes an image of the object passed to in by if= if thats a partition, you get a partition image, including all of the unallocated space.
Its not wrong, just inefficient.

krinn is exaggerating. I have been wrong and when I am I'm pleased to be called for it too.
In our community we all learn from one another, including me and krinn :).
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum