0

I have a folder(mostly with postfix user mailboxes-homedirs) mounted on a disk A(raid1) and I want to move it from disk A to disk B(also raid1).

Currently it is like:

/h1(folder) /md120(diskA)

and I want:

/h1(folder) /md121(diskB)

should I simply umount and then mount to another disk?

UPDATE 1

Hi again!

Thank you guys for all your answers.

It seems that I was wrong in my question.

The proper would be

How to properly change mount point of the folder?

So I have /h1 mounted to /md120 and I want to change it's mount point to /md121.

UPDATE 2 mount -l

fstab doesn't contain mounting.

/dev/md121 on /home2

/dev/md125 on /h1

My idea is to move h1 under home2 so full path would be /home2/h1, which would be mounted into /dev/121 and /dev/md125 would be 'removed'. The problem is that h1 contains user homedirs(mailboxes) so I think to simply ln after removing.

Jevgeni Smirnov
  • 492
  • 1
  • 6
  • 22
  • 3
    Are you really just looking for the `mv` command? – R. S. Feb 12 '13 at 21:34
  • @kormoc, Hm, no, I guess. Because I need have the same folder but mounted on another device. – Jevgeni Smirnov Feb 13 '13 at 06:33
  • if both `/h1/md120` and `/h1/md121` are mounted, why wouldn't `mv /h1/md120/* /h1/md121/` work for your needs? – R. S. Feb 13 '13 at 06:36
  • @kormoc, check the post update. – Jevgeni Smirnov Feb 13 '13 at 07:24
  • In the light of your update, could you edit the contents of `/etc/fstab` into the question? – MadHatter Feb 13 '13 at 07:31
  • @MadHatter, updated. – Jevgeni Smirnov Feb 13 '13 at 07:36
  • That's not `fstab`, but OK. I fear your comments above contain so many misconceptions that I can't find a way to easily answer the question. I really do recommend that you do some reading about how file systems, device access, and mounting work under Linux before you even decide what changes you'd like to make, much less start making them. I'm **really** sorry if this sounds harsh or patronising - it's honestly not meant to be - but I fear you may shoot yourself in the foot really badly unless you get some understanding of what's going on first. – MadHatter Feb 13 '13 at 09:53
  • @MadHatter, well generally that's why I am asking for help here :) I understand clearly my lack of knowledge in Linux. So I appreciate your help. In general my goal is clearly stated in last 2 sentences of my post. Also bad thing is, that the system I currently deal with, was built in 2005 and then updated in 2010 or something, and the person who did this, lets say, can't give any piece of advice. But in general I think I will continue my research, if no over information will be opened here. TY. – Jevgeni Smirnov Feb 13 '13 at 09:58
  • The FAQ's pretty clear; SF is for people "needing expert answers related to managing computer systems in a professional capacity", and I'm not really sure this qualifies. Nevertheless, I've said what I'd do, below; hopefully, it'll be of some use to you. – MadHatter Feb 13 '13 at 10:13
  • @MadHatter, then SuperUser suits best? – Jevgeni Smirnov Feb 13 '13 at 10:17
  • Or maybe `unix.stackexchange.com`; but don't just post the question again there. If you want it moved, then flag this question for a moderator's attention, and ask them to move it. They're usually very happy to do so. – MadHatter Feb 13 '13 at 10:22

4 Answers4

4

You can use rsync -

   rsync -a --progress --remove-source-files /src/dir1/ /dst
Daniel t.
  • 9,291
  • 1
  • 33
  • 36
2

Are both raid partitions mounted? If they are you can use what you would normally do:

mv /h1 /h2

Make sure you stop postfix first.

mako_reactor
  • 398
  • 4
  • 11
0

use xar, this is better than all other as it preserves the original permissions, access times of files ... etc

the-wabbit
  • 40,737
  • 13
  • 111
  • 174
0
  1. Quiesce the system. This will probably mean rebooting single-user, and if you're right about those file systems not being mentioned in /etc/fstab, that will also unmount them. I'm assuming this does happen.
  2. mount /dev/md121 /home2
  3. mkdir /home2/h1
  4. mount /dev/md125 /home2/h1

Everything that is currently under /h1 will now appear under /home2/h1, which I think is what you want.

MadHatter
  • 79,770
  • 20
  • 184
  • 232