Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 820  / 2 Years ago, wed, september 7, 2022, 10:23:20

I'd like to backup my system without turning it off. The system clone should also able to run in an other machine.



I've tried to "dd" the entire system partition on another disk, after that I'm ensured that there's no administrative tasks launched.
I think I had to tell to the grub to boot on that disk, so I've executed the command:



grub-install  /dev/sdc1 


but I got this error:



The file /boot/grub/stage1 not read correctly.


I know that I am doing is not very clean, so have you a good solution to reach my goals or a idea to solve the grub problem?


More From » grub2

 Answers
4

There are several options that each have tradeoffs. You can not use dd to clone a filesystem while it is mounted read/write or the clone will end up corrupt since the source is being changed during the copy so the destination will be partially out of date and partially not. If you really want to be able to use dd to hot copy a partition, you can do so with LVM snapshots. This requires that you have installed the system using LVM in the first place, but then you can create a snapshot at any time, and since the snapshot is frozen and not mounted, you can safely dd the snapshot, then remove the snapshot. The other down side to using dd is that it wastes time copying all of the unused space in the volume, and requires the destination be at least as large, even if most of the source is unused.



Rather than use dd, you can simply use traditional backup tools such as tar or dump to backup the snapshot. This has the advantage of not wasting time copying free space, and can be restored to a smaller partition as long as it has space for the files. You can also extract only some of the files to do a partial restore. You also don't have to use LVM with this method: as long as you are reasonably sure that no files are being modified when you make the backup, it is safe to do on a mounted filesystem. The worst thing that can happen is that an individual file that is modified during the backup will be corrupt, rather than the entire backup being corrupt, as can happen with dd.



As you seem to have realized, after restoring the filesystem, you still need to reinstall grub to get the system to boot. I'm not sure why you got that error when you tried, but it seems you were using grub-legacy, since grub2 does not have a stage1.


[#34388] Thursday, September 8, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sator

Total Points: 258
Total Questions: 119
Total Answers: 101

Location: Sweden
Member since Fri, Apr 16, 2021
3 Years ago
;