new hdd booting using old hdd mbr and partition tables

General support questions
nike
Posts: 72
Joined: 2018/05/07 14:05:24

new hdd booting using old hdd mbr and partition tables

Post by nike » 2023/05/12 11:46:49

sir,
i have one centos 7 server (not raid) and it is running fine . I have copied its mbr and partition tables to a new hdd. now i want to boot new Hard disk(size-320GB) with all things as old Hard disk(size -1TB). How it can be done and what i will do for that ..please any help

BShT
Posts: 585
Joined: 2019/10/09 12:31:40

Re: new hdd booting using old hdd mbr and partition tables

Post by BShT » 2023/05/12 14:07:00

320GB -> 1TB YES
1TB -> 320GB NO

you can´t copy 1TB structure to a 320GB disk

you can dd a 320GB to a 1TB then expand LVM

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: new hdd booting using old hdd mbr and partition tables

Post by TrevorH » 2023/05/12 14:33:54

Show us the output from fdisk -lu /dev/xda from the server with the to-be-copied disk and also the same for the target disk. You'll need to change /dev/xda in that command to the device name for the correct disks.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

nike
Posts: 72
Joined: 2018/05/07 14:05:24

Re: new hdd booting using old hdd mbr and partition tables

Post by nike » 2023/05/13 07:17:56

TrevorH wrote:
2023/05/12 14:33:54
Show us the output from fdisk -lu /dev/xda from the server with the to-be-copied disk and also the same for the target disk. You'll need to change /dev/xda in that command to the device name for the correct disks.
sir
thank you for quick reply ... i have already copied mbr and partition tables (512) to target disk

below the to-be-copied disk------

[root@BACKUP-SRV admin]# fdisk -lu /dev/sda

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x0002d51d

Device Boot Start End Blocks Id System
/dev/sda1 2048 6143 2048 83 Linux
/dev/sda2 * 6144 4102143 2048000 83 Linux
/dev/sda3 4102144 1953523711 974710784 8e Linux LVM


and the target disk
[root@BACKUP-SRV admin]# fdisk -lu /dev/sdb

Disk /dev/sdb: 320.1 GB, 320072933376 bytes, 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0002d51d

Device Boot Start End Blocks Id System
/dev/sdb1 2048 6143 2048 83 Linux
/dev/sdb2 * 6144 4102143 2048000 83 Linux
/dev/sdb3 4102144 1953523711 974710784 8e Linux LVM

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: new hdd booting using old hdd mbr and partition tables

Post by TrevorH » 2023/05/13 10:38:38

So, the other poster is correct. You cannot coerce 1TB of data into 320GB of space so it's not possible to directly copy from A to B. Since the 3rd partition on A is an LVM PV, maybe you can shrink the used space inside that so that it uses less than ~300GB and then you can pvresize that to occupy less space and then reduce the size of the partition so that it will all fit on the new disk. Or just get a similarly sized 1TB disk and copy to that! What you want to do may be possible but only with a lot of effort and danger..
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

nike
Posts: 72
Joined: 2018/05/07 14:05:24

Re: new hdd booting using old hdd mbr and partition tables

Post by nike » 2023/05/16 07:09:46

TrevorH wrote:
2023/05/13 10:38:38
So, the other poster is correct. You cannot coerce 1TB of data into 320GB of space so it's not possible to directly copy from A to B. Since the 3rd partition on A is an LVM PV, maybe you can shrink the used space inside that so that it uses less than ~300GB and then you can pvresize that to occupy less space and then reduce the size of the partition so that it will all fit on the new disk. Or just get a similarly sized 1TB disk and copy to that! What you want to do may be possible but only with a lot of effort and danger..
sir,
sorry for late.
operating system of disk A is not recoverable(say) and i need to access database of it . Hence, if I copy all from disk-A to disk-B so far i know , Disk-B also not be accessable through operating system. At this point what I will do. Is there any solution? ..please

BShT
Posts: 585
Joined: 2019/10/09 12:31:40

Re: new hdd booting using old hdd mbr and partition tables

Post by BShT » 2023/05/16 15:48:09

try to install that disk as secundary and dump your data base to another place

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: new hdd booting using old hdd mbr and partition tables

Post by TrevorH » 2023/05/16 16:44:47

Or if you want to clone a larger disk to a smaller one, make sure you do not use any of the space on the larger one that won't fit on the smaller one!
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

nike
Posts: 72
Joined: 2018/05/07 14:05:24

Re: new hdd booting using old hdd mbr and partition tables

Post by nike » 2023/05/17 06:01:20

BShT wrote:
2023/05/16 15:48:09
try to install that disk as secundary and dump your data base to another place
How to dump database to another place.? I have already installed it as secondary had disk and can access it as secondary. I have only idea to take backup of database after accessing operating system of that particular Hard disk. Hence, i cannot access operating system of that Disk. So please help to recover database so that i can take backup of it.

User avatar
jlehtone
Posts: 4531
Joined: 2007/12/11 08:17:33
Location: Finland

Re: new hdd booting using old hdd mbr and partition tables

Post by jlehtone » 2023/05/17 08:06:22

A disk has partition/volume(s). Those have filesystem. Filesystem has files.

When you say that you "can access the secondary disk", we do assume that you mean
that you have mounted the filesystem that is on the disk and therefore can access the files.

A database engine is an application that reads/writes files of specific (database format).
The files have the data. If you can install the same (or compatible) database application
to you functional operating system and configure the engine to use the existing files, then
you should have access to the data.

Assuming the 1TB disk is unreliable or to be decommissioned, the first step would be to copy
the files of the database into the 320GB disk. Then configure the database engine.

You did not tell which database engine was used in the old system, so we can't even start
to guess where within the filesystem the database files are.

Post Reply