Create back up from RAID with dd command.

Issues related to applications and software problems
Post Reply
hack3rcon
Posts: 184
Joined: 2014/11/24 11:04:37

Create back up from RAID with dd command.

Post by hack3rcon » 2018/12/08 12:28:24

Hello.
Can I create a backup of the RAID HDDs and recover it by "dd" command? I have a server and its HDDs are RAID 10:

Code: Select all

# fdisk -l

Disk /dev/sda: 599.9 GB, 599932581888 bytes
255 heads, 63 sectors/track, 72937 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disk identifier: 0x000802c7

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         131     1048576   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2             131       72938   584821760   8e  Linux LVM

Disk /dev/mapper/VolGroup-LogVol04: 96.6 GB, 96636764160 bytes
255 heads, 63 sectors/track, 11748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-LogVol00: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-LogVol05: 25.5 GB, 25476202496 bytes
255 heads, 63 sectors/track, 3097 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-LogVol01: 429.5 GB, 429496729600 bytes
255 heads, 63 sectors/track, 52216 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-LogVol03: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-LogVol02: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disk identifier: 0x00000000
I want to create a backup of it and restore it on the same server and boot it. Is it possible with "dd" command? if I just use

Code: Select all

$ dd if=/dev/sda of=/another place
is it enough?

Thank you.
Last edited by hack3rcon on 2018/12/08 19:46:08, edited 1 time in total.

User avatar
TrevorH
Forum Moderator
Posts: 24052
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Create back from RAID with dd command.

Post by TrevorH » 2018/12/08 14:41:17

Well, sort of. It won't be very reliable. You're backing up a filesystem that's open so there could be gigabytes of files cached in RAM that have yet to be written to disk and the filesystem will be open and marked as in use. It'll be a bit like walking up to the server and pulling the power cord out of the wall. Most of the time fsck will run afterwards and fix up the errors it finds. Other times, it'll scramble everything and you'll need to reach for your backups... oh, wait, this _is_ your backup :-(
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

hack3rcon
Posts: 184
Joined: 2014/11/24 11:04:37

Re: Create back up from RAID with dd command.

Post by hack3rcon » 2018/12/08 19:45:36

TrevorH wrote:
2018/12/08 14:41:17
Well, sort of. It won't be very reliable. You're backing up a filesystem that's open so there could be gigabytes of files cached in RAM that have yet to be written to disk and the filesystem will be open and marked as in use. It'll be a bit like walking up to the server and pulling the power cord out of the wall. Most of the time fsck will run afterwards and fix up the errors it finds. Other times, it'll scramble everything and you'll need to reach for your backups... oh, wait, this _is_ your backup :-(
If turn off the server and boot by live CD then use "dd" command, is it OK? Is my command enough? My concern is the image can't boot other server :(
As you see, it is LVM and when I restore image all of them created again automatically?

lightman47
Posts: 764
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: Create back up from RAID with dd command.

Post by lightman47 » 2018/12/08 20:33:38

I'd also given thought to doing this - then decided against it after wondering about the dynamic directories and open files issues. Then there was the SPACE issue - I may be wrong, but I think dd will actually copy all the blank space on that partition/drive as well. This seemed a waste of time/space to me.

Perhaps Clonezilla or similar may be more help to you? I also wanted a bootable image with the least amount of work. I'm not entirely sure that exists. I eventually opted for rsyncing particular directories off of the root that contained settings I needed after I did a clean install. While a clean install is rare, it turned out easier than messing with the time/fiddling with a saved image (that may include the actual problem that required the re-imaging in the first place).

- just a few thoughts to help you along (or not) -
;)
"The more I learn, the behinder I get"

hack3rcon
Posts: 184
Joined: 2014/11/24 11:04:37

Re: Create back up from RAID with dd command.

Post by hack3rcon » 2018/12/09 06:15:08

I don't know is it possible or not?

User avatar
TrevorH
Forum Moderator
Posts: 24052
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Create back up from RAID with dd command.

Post by TrevorH » 2018/12/09 17:48:17

My concern is the image can't boot other server
As in another machine? Then no, that's not a reliable backup unless your other machine is identical in all respects. And even if it is identical hardware there will be differences that cause it not to work without some amendments (like ethernet MAC addresses f.e.).
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

Post Reply