Restauring Database From Old Drive ?

Discussion in 'Site & Server Administration' started by DnHype, May 24, 2008.

  1. #1
    Hi there, we recently changed our hard drive + fresh Os installation on our server.

    our main site was backedup using automated script.
    So when time came for restauration everything went well.
    However we have other site that had important Database information that have not ben backedup.
    We still have our old drive connected to the new installation.
    How and where is stored these database can i manualy restaure them ?
    they should of course be somewhere on the drive ?
     
    DnHype, May 24, 2008 IP
  2. gate2vn

    gate2vn Peon

    Messages:
    809
    Likes Received:
    33
    Best Answers:
    1
    Trophy Points:
    0
    #2
    which OS you have in the old drive?
     
    gate2vn, May 24, 2008 IP
  3. DnHype

    DnHype Active Member

    Messages:
    1,011
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    80
    #3
    centos 5

    what should i do ?
     
    DnHype, May 25, 2008 IP
  4. xous

    xous Active Member

    Messages:
    173
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    #4
    You will first need to see if you can mount the drive.

    Login to your server as root.

    run fdisk -l to get a list of the drives on your system. it will look something like:

    
    # fdisk -l
    
    Disk /dev/sda: 500.1 GB, 500107862016 bytes
    255 heads, 63 sectors/track, 60801 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1       60801   488384001   fd  Linux raid autodetect
    
    Disk /dev/sdb: 500.1 GB, 500107862016 bytes
    255 heads, 63 sectors/track, 60801 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1       60801   488384001   fd  Linux raid autodetect
    
    Disk /dev/sdc: 500.1 GB, 500107862016 bytes
    255 heads, 63 sectors/track, 60801 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdc1               1       60801   488384001   fd  Linux raid autodetect
    
    Code (markup):
    You can see a list of already mounted file systems by typing:

    # df

    By comparing the two lists you will know which drive is not mounted and so you will know the name of the drive you want to mount.

    create a mount point for the old disk:
    # mkdir /mnt/olddisk

    try and mount the old disk
    # mount /dev/sdb1 /mnt/olddisk

    Note that your disk probably has more than one partition depending on how it is formatted you will probably want the last partition.
     
    xous, May 25, 2008 IP
  5. DnHype

    DnHype Active Member

    Messages:
    1,011
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    80
    #5
    Thank mate, but i know how to mount a drive or list connected drive.
    My question is, where or how can i restaure mysql database from old drive.
    Thank
     
    DnHype, May 25, 2008 IP
  6. gate2vn

    gate2vn Peon

    Messages:
    809
    Likes Received:
    33
    Best Answers:
    1
    Trophy Points:
    0
    #6
    You might want to create a new db normally with the same database name. After that, copy tables data from the old db location. Usually, it's located in /var/lib/mysql
     
    gate2vn, May 25, 2008 IP
    DnHype likes this.
  7. DnHype

    DnHype Active Member

    Messages:
    1,011
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    80
    #7

    God thank mate !
    Rep +

    Quick follow to for those who get the same problem.


    Mount your old drive to somewhere in a folder.
    If database was already exists and you want to overright say (y) to all.
     
    DnHype, May 25, 2008 IP