Forums

Resolved
0 votes
Hello all,
I'm migrating my ClearOS server 6.3 to a new 7.2 one. I installed the new one on a new machine. Now, I'd like to transfert the datas from my old /flexshares to the new machine. So I'm trying to make a mount -t cifs //my-old/datas /mnt/transert -o username=... but I always get the following error :

mount: //my-old/datas/ is write-protected and will be mounted in read-only
mount: impossible to mount //my-old/datas/ in read-only

Does anyone habe an idea howto mount it ?
thanks :)
Thursday, June 15 2017, 01:25 PM
Share this post:
Responses (10)
  • Accepted Answer

    Thursday, June 07 2018, 10:34 AM - #Permalink
    Resolved
    0 votes
    My way is a bit Mickey Mouse and not really recommended with systemd. Their preferred method is to write a proper unit file (in /usr/lib/systemd/system) with the relevant start up dependencies.

    I know nothing about xinetd and it may be a good alternative.
    The reply is currently minimized Show
  • Accepted Answer

    tomas
    tomas
    Offline
    Thursday, June 07 2018, 09:56 AM - #Permalink
    Resolved
    0 votes
    There was an error in rsync xinetd config file. Once I corrected it all is working well.

    The rsync xinetd config file is:

    service rsync
    {
    disable = no
    socket_type = stream
    port = 873
    protocol = tcp
    wait = no
    user = root
    server = /usr/bin/rsync
    server_args = --daemon
    log_on_failure += USERID
    }


    This starts rsync --daemon automatically after boot. BTW the way Nick suggested to start it works too.

    On the slave system /etc/rsyncd.conf contains:

    [BACKUP]
    path = /var/flexshare/shares/data-2
    comment = Flexshare backup
    uid = root
    gid = root
    use chroot = false
    max connections = 4
    pid file = /var/run/rsyncd.pid
    log file = /var/log/rsyncd.log
    exclude = lost+found/
    transfer logging = yes
    timeout = 900
    ignore nonreadable = yes
    hosts allow = 192.168.2.1
    read only = no
    list = yes


    On master in /etc/crontab I put:

    15 22 * * * root rsync -a /var/flexshare/shares/data/ root@192.168.2.2::BACKUP --exclude=.trash --delete


    All is working well. First full backup was 2 days ago, then yesterday just incremental. Happy days :) I will change this and put a proper script in the future to backup more stuff and send email notification once completed. For now this will do and I can check /var/log/rsyncd.log if needed.

    BTW there is a way to mount flexshares from another server by using mount -t cifs e.g.

    mount -t cifs -o username=[username],password=[password] //192.168.2.1/data /mnt/source


    and then backup that folder using rsync.

    The problem is you need to use a username and password, and use fstab to mount flexshare on boot. This means fstab would contain a username and password of one of the users of the system. This doesn't sound secure to me even on closed networks like ours that's why I decided to go with the above solution. You can use "guest" account too - then you don't need a password, so if data you would like to backup doesn't need to be secured by password going with "mount - t cifs" makes perfect sense.

    Hope this helps someone in the future.
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, June 05 2018, 04:47 PM - #Permalink
    Resolved
    0 votes
    What is the contents of your /etc/rsync.conf file on the backup device?

    Also do you have any orphaned processes on your main server ("ps aux | grep rsync")?
    The reply is currently minimized Show
  • Accepted Answer

    tomas
    tomas
    Offline
    Tuesday, June 05 2018, 03:52 PM - #Permalink
    Resolved
    0 votes
    Nick Howitt wrote:

    tomas wrote:
    Good progress here. Will post the full solution once I try to figure out how to automatically start rsync daemon on server reboot ... ;)
    Put the line in /etc/rc.d/rc.local and make the file executable.


    I have installed on the slave xinetd and created rsync containing:

    # default: off
    service rsync
    {
    disable = no
    socket_type = stream
    port = 873
    wait = no
    user = root
    server = /usr/bin/rsync
    server_args = --daemon --config /etc/rsync.conf
    log_on_failure += USERID
    }


    But now I get:

    rsync: read error: Connection reset by peer (104)

    when I start

    rsync -a /var/flexshare/shares/data/ root@192.168.2.2::BACKUP --exclude=.trash --delete &

    on the master for some reason no matter if I use xinetd to start rsync daemon or start it manually. It was working fine before - tested more than 5 times...
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, June 05 2018, 02:58 PM - #Permalink
    Resolved
    0 votes
    tomas wrote:
    Good progress here. Will post the full solution once I try to figure out how to automatically start rsync daemon on server reboot ... ;)
    Put the line in /etc/rc.d/rc.local and make the file executable.
    The reply is currently minimized Show
  • Accepted Answer

    tomas
    tomas
    Offline
    Tuesday, June 05 2018, 02:50 PM - #Permalink
    Resolved
    0 votes
    Good progress here. Will post the full solution once I try to figure out how to automatically start rsync daemon on server reboot ... ;)
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, June 05 2018, 01:33 PM - #Permalink
    Resolved
    0 votes
    On my local slave (Pi running OSMC) my rsync.conf is much simpler so I don't know if your options will work. Start simple and build it up. Most of what you've added is not in the "Daemon Options" bit of the man page.

    On your BDC did you remember to start the rsync daemon with an:
    rsync --daemon
    It may need an "&" after it to detach from the terminal. I put one in for safety. It should return a PID number when it starts manually. You can check it is running with a "ps aux | grep rsync".

    The -r flag is not needed (even though you got it from me!) as -a also implies -r.

    By default the following files are not compressed: gz/zip/z/rpm/deb/iso/bz2/t[gb]z/7z/mp[34]/mov/avi/ogg/jpg/jpeg but you have bot asked for any compression (-z) in your rsync line.

    I also have the excluded on my rsync line and you will want a --delete or the backup will grow indefinitely
    The reply is currently minimized Show
  • Accepted Answer

    tomas
    tomas
    Offline
    Tuesday, June 05 2018, 12:33 PM - #Permalink
    Resolved
    0 votes
    Hi

    We have a similar problem - running Master (PDC; 192.168.2.1) and Slave (BDC; no firewall; 192.168.2.2) servers here and we need a flexshare backup solution.

    I think this is doable using rsync and cron.

    We have flexshares on the master running (/var/flexshare/shares/data) and I just created flexshare on the slave system (/var/flexshare/shares/data-2).

    After reading Nick's suggestion I set up on the Slave the following in the /etc/rsyncd.conf file:

    [BACKUP]
    path = /var/flexshare/shares/data-2
    comment = Flexshare backup
    uid = root
    gid = root
    use chroot = false
    max connections = 4
    pid file = /var/run/rsyncd.pid
    exclude = lost+found/
    transfer logging = yes
    timeout = 900
    ignore nonreadable = yes
    dont compress = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2
    hosts allow = 192.168.2.1
    read only = no
    list = yes


    But when I try to run on the master system:

    rsync -ra /var/flexshare/shares/data root@192.168.2.2::BACKUP/var/flexshare/shares/data-2


    I get:

    rsync: failed to connect to 192.168.2.2 (192.168.2.2): Connection refused (111)
    rsync error: error in socket IO (code 10) at clientserver.c(122) [sender=3.0.9]
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, June 15 2017, 05:53 PM - #Permalink
    Resolved
    0 votes
    Hello Nick,
    Thanks for your answer. I did what you said and everything went right, thanks :)
    :D
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, June 15 2017, 04:57 PM - #Permalink
    Resolved
    0 votes
    Not the answer you want but can I suggest you use rsync? You can run rsync as a daemon on the receiving server then push everything across from your sending server.

    On the receiving server set up a file /etc/rsyncd.conf similar to mine (on a Pi):
    lock file = /var/run/rsync.lock
    log file = /var/log/rsyncd.log
    pid file = /var/run/rsyncd.pid

    [PI_Disk]
    path = /mnt/USBDisk
    comment = Raspberry Pi USB Disk
    uid = root
    gid = root
    read only = no
    list = yes
    hosts allow = 172.17.2.1
    use chroot = false
    I don't think you need the first three lines or the "hosts allow" line. Set the path to the head of your flexshare data. Then a command on the old server similar to the next will push the files across:
    rsync -ra /shares/shared/ root@172.17.2.114::PI_Disk/shared/ --exclude=.trash --delete &
    Instead of /shares/shared you want your source folder and instead of my IP address you'll want your new server's LAN IP.

    The great thing about rsync is that it will run incrementally only transferring the files which have changed. This means you can abort it. Or do a massive transfer days before you bring the server on line then do an rsync for any changes just before you take the old server offline.

    The command I've given will run quietly in the background. If you want to see what is happening, remove the "&" and change the -ra to -rav.

    On the receiving server to run rsync you just use the command "rsync --daemon". You can note the process ID. To kill it you'll need the command "kill rsync_process_id". If you lose the process ID a "ps aux | grep rsync" gives it as the second field in the correct line.
    The reply is currently minimized Show
Your Reply