Re: lazy old guy asks question
I'm a bit late to this party, but:
On 8/29/25 03:55, mick.crane wrote:
On 2025-08-29 02:05, Greg Wooledge wrote:
On Fri, Aug 29, 2025 at 00:52:24 +0100, mick.crane wrote:
If I've got 3 200Gb disks that are working and one 1 Tb disk and want to be
able to copy and replace the 3 disks.
OK.
Can I dd copy them to .isos on the 1 Tb disk then put them back on other
disks so they boot?
Ah, you mean one of them is your OS disk, and that you want to remove that
OS disk and put in a new OS disk.
I apologise for not being clear in my question I should know by now not to post if "tired".
For the purpose of backing up 3 ~200Gb disks, with Debian operating systems on them, I wondered if I can put them all on one 1Tb disk and be able to copy them back.
Yes, you can. It is, as Greg Wooledge and others have observed not necessarily the best comprehensive backup procedure.
You also could use "cp" or gzip to get a smaller image. Probably bzip2 also would, but I have personal experience only with the first two.
Examples (assuming the disk to be backed up is /dev/sda, the target disk is /dev/sdb and is formatted with a file system Linux knows about, and it has a data partition /dev/sdb1 with enough free space to hold the output that is mounted on /mnt (that is, you issued the command "mount /dev/sdb1 /mnt):
Either dd if=/dev/sda of=/mnt/<name-of-backup-file>
or cp /dev/sda /mnt
dd will run faster if you include also the option "bs=1M".
You can substitute "gzip" or (probably) bzip2 for cp to get a smaller image.
To copy the image back to its original location (or a different one at least as large as the original):
1. Boot from recovery media.
2. Mount the disk that contains the backup on /mnt
3.
dd if=/mnt/<name-of-backup-file> of=/dev/sda
or
cp /mnt/<name-of-backup-file> /dev/sda
(or "gunzip" or "bunzip2" if you used one of those.
In all cases the target disk (/dev/sda in the example) will be bootable if and only if the original was.
NOTE: These operations, like all backups, are best done from a quiescent system or after booting from recovery media. These commands copy what is on the disk. If the backup was made while /dev/sda held the running OS, the copy will not necessarily reflect the status of open files. This is unlikely to seriously affect the system as a whole, but might cause fsck to run when you boot a restored copy. And if you have applications like a dbms active during the backup they might be copied in an inconsistent state and need repair if started from a restored copy. (These considerations also affect similar backups by other methods like rsync, tar, and cpio.)
Not really understanding how dd works wondered if a bootable disk can be copied to a partition on another disk for the purpose of backup.
It can. cp, gzip, and as far as I know, bzip2, copy all of the data. So does dd except for dd when used with options like "conv" to manipulate the data.
Or if the disks should be copied to ISOs. I've not done that before.
There is no need to copy to ISO format unless you want to have a CD.
And re: a later post: no particular reason to get 3 200GB disks if you already have a 1TB disk on hand.
mick
Regards,
Tom Dial
Reply to: