Results 1 to 8 of 8
  1. #1
    Join Date
    May 2009
    Location
    Atlanta,GA
    Posts
    85

    * Move a file from one hdd to another . How to ?

    I have a dedicated server with centos 5 and whm/cpanel.i have 2 X 320 GB hard drives.

    the first hard drive sda is that from which i run my forum.the second hard drive sdb is mounted on /backup.

    i use mysqldump daily to backup my db.the backup is saved into my ftp root folder on my first hard drive and i download a copy to my home pc.now that i have a second drive i wish to keep a copy of the backup on the second drive also.

    so,how do i move the .sql file from my first hard drive to the second hard drive through ssh ? the exact command would be helpful.

    Also,if i use the "full backup" option in cpanel,how do i get the backup to be saved to the second drive ?

    thanks
    Last edited by Gearbox; 09-30-2009 at 01:02 AM.

  2. #2
    Join Date
    Sep 2007
    Posts
    369

    *

    Quote Originally Posted by Gearbox View Post
    I have a dedicated server with centos 5 and whm/cpanel.i have 2 X 320 GB hard drives.

    the first hard drive sda is that from which i run my forum.the second hard drive sdb is mounted on /backup.

    i use mysqldump daily to backup my db.the backup is saved into my ftp root folder on my first hard drive and i download a copy to my home pc.now that i have a second drive i wish to keep a copy of the backup on the second drive also.

    so,how do i move the .sql file from my first hard drive to the second hard drive through ssh ? the exact command would be helpful.

    thanks
    Hi,

    first check mount command if it shows your secondary drive in which directory.

    check from fdisk -l [ if it sdb1, sdc1, sdd1], it will tell you hard drive and partition detail.

    if hard disk not mounted then

    mkdir /backup-drive

    mount /dev/sdb1 /backup-drive [*sdb1 this will see after fdisk -l, if hdd partitioned and formatted]

    now you can copy anyfile to /backup-drive

    mv yourbackup.sql /backup-drive [it will move your sql file to backup hdd]

    now you can access secondary drive, if hard disk is not partition it by using fdisk and need to format it by mke2fs.
    Last edited by nomankhn; 09-30-2009 at 06:41 AM.
    Thanks,
    Noman
    noman@linuxonsupport.com
    O Canada, we stand on guard for thee

  3. #3
    Join Date
    Jun 2008
    Posts
    205
    You may want to read up on rsync, then you could set up cron to have it copy a folder of daily backups so you have a fall back to a day before and can restore from a day or two ago if the database gets trashed somehow.

  4. #4
    Join Date
    Oct 2004
    Location
    Ohio
    Posts
    1,668
    I use a combination of the following to make backups,

    http://knaddison.com/technology/mysq...ll-databases-0
    http://www.rasnapshot.org

    I run a cron to automate the sql dumps and another to later run rsnapshot and backup all of the files for my sites.

  5. #5
    Join Date
    May 2009
    Location
    Atlanta,GA
    Posts
    85
    Here is the output from fdisk -l

    Disk /dev/sda: 320.0 GB, 320072933376 bytes
    255 heads, 63 sectors/track, 38913 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 33 265041 83 Linux
    /dev/sda2 34 294 2096482+ 82 Linux swap / Solaris
    /dev/sda3 295 555 2096482+ 83 Linux
    /dev/sda4 556 38913 308110635 5 Extended
    /dev/sda5 556 38913 308110603+ 83 Linux

    Disk /dev/sdb: 320.0 GB, 320072933376 bytes
    255 heads, 63 sectors/track, 38913 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sdb1 * 1 38913 312568641 83 Linux


    is it good to go ?

  6. #6
    Join Date
    Jul 2009
    Location
    India
    Posts
    54
    Hi gearbox,

    yes, it is good.

    You have to mount your 2nd drive partition as a backup using command:

    #mount /dev/sdb1 /backup

    Then copy the .sql file using command:

    mv /path to ftp root/filename.sql /backup { this will parmanently move your database backup file }


    If you want to use "full backup" utility from WHM the you have to also have to set the path of the folder where you want to save the backup just set it /backup. Then the exact path of your backup will be /backup/cpbackup/[daily, weekly or monthly].

    One more important thing...

    You have to make a entry of the new partition in /etc/fstab file so that every time you will not have to mount the drive manually.

    just run the command without hash:

    #echo "/dev/sdb1 /backup ext3 defaults 0 0" >> /etc/fstab

    before doing the above command you have to take the backup of your fstab file. because if you mess anything, this file can be restored.

    # cp -a /etc/fstab /etc/fstab-bk
    Expert in Server Management, Server Hardening & Server Optimization.
    https://www.servermanagementadmins.com
    24x7 Whitelabel Outsourced Support - Helpdesk, Livechat, Messenger.
    IM (skype): servermanagementadmins Email: sales[@]servermanagementadmins[.]com

  7. #7
    Join Date
    May 2009
    Location
    Atlanta,GA
    Posts
    85
    here is something which i copied from ssh




    root@prototype [~]# df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/sda5 285G 5.1G 265G 2% /
    /dev/sdb1 289G 191M 274G 1% /backup
    /dev/sda3 2.0G 42M 1.8G 3% /tmp
    /dev/sda1 251M 22M 217M 10% /boot
    tmpfs 2.0G 0 2.0G 0% /dev/shm



    it shows that the drive is mounted /backup.right ? i had told the host that i would be using that drive to store my backups locally.so they might have set it up.i didnt run the command.



    root@prototype [~]# ls
    ./ .cpanel/ .MirrorSearch/ .spamassassin/
    ../ cpanel3-skel/ .my.cnf .ssh/
    anaconda-ks.cfg .cpobjcache/ .pearrc .tcshrc
    .bash_history .cshrc public_ftp/ tmp/
    .bash_logout .gnupg/ public_html/
    .bash_profile install.log .rnd
    .bashrc install.log.syslog security/
    root@prototype [~]# cd ..


    root@prototype [/]# ls
    ./ backup/ etc/ lost+found/ net/ sbin/ sys/ var/
    ../ bin/ home/ media/ opt/ scripts/ tmp/
    .autofsck boot/ lib/ misc/ proc/ selinux/ tmp.tar
    .autorelabel dev/ lib64/ mnt/ root/ srv/ usr/


    I see a folder which says backup in the above part.is that the drive i m referring to ?

    thanks

    btw,i have an account with a well known server management company.but i just read their tos and it says they dont offer support for mounting drives,so i have to get help from wht.i just got this box last week.

  8. #8
    Quote Originally Posted by Gearbox View Post
    it shows that the drive is mounted /backup.right ? .
    /dev/sdb1 289G 191M 274G 1% /backup

    Yes, /backup is the backup drive. BTW, if you have cPanel on your server, why don't you use the WHM >> "Configure Backup" option to configure the backups. Just enable the backups and schedule them as per your needs and specify the backup directory as /backup.

    The backup on cPanel servers runs at 1.00AM by default and you will see a /backup/cpbackup directory once the backup executes.

    If you need any help in setting backups the other way, let me know and I will forward you some other options.
    | LinuxHostingSupport.net
    | Server Setup | Security | Optimization | Troubleshooting | Server Migration
    | Monthly and Task basis services.
    | MSN : madaboutlinux[at]hotmail.com | Skype : madaboutlinux

Similar Threads

  1. Move index.asp file
    By fm78 in forum Programming Discussion
    Replies: 1
    Last Post: 03-24-2009, 04:23 PM
  2. How to move a file via ssh ?
    By chengaz in forum Hosting Security and Technology
    Replies: 12
    Last Post: 08-08-2008, 10:03 AM
  3. How can I zip one file with Shell and move it
    By Hawi in forum Hosting Security and Technology
    Replies: 3
    Last Post: 12-29-2007, 11:04 PM
  4. How i can move big file by ssh ?
    By Titus_com in forum Hosting Security and Technology
    Replies: 3
    Last Post: 02-12-2005, 01:50 AM
  5. How can I move 10 GB file?
    By RashidJ in forum Hosting Security and Technology
    Replies: 8
    Last Post: 03-12-2003, 11:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •