Hello i have a machine A with 2 disks 1 et 2 running Debian Jessie on 1 is the system and the boot and the swap on 2 different partitions like /home /opt ETC..... i have a machine B with 1 disk running kali-linux and *100G free* Can i clone the disk 1 of machine A on the 100G free on machine B with rsync? If it is possible, how to do that? Many thanks TG -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20150717/b2c32dcb/attachment.html>
Thierry Granier <th.granier at free.fr> wrote:> i have a machine A with 2 disks 1 et 2 running Debian Jessie > on 1 is the system and the boot and the swap > on 2 different partitions like /home /opt ETC..... > > i have a machine B with 1 disk running kali-linux and 100G free > > Can i clone the disk 1 of machine A on the 100G free on machine B with rsync? > > If it is possible, how to do that?Yes, it's easy to do, I do that for the primary backup on all my systems. Lets say you are doing it from machine a, and backing up to directory /backup_a on b. Logged in as root then you could do it with : rsync -avH --delete --exclude-from=/etc/rsync_excludes / root at b:/backup_a/ -a means "archive" and sets several parameters, v simply makes things verbose, H means correctly handle hard linked files. --delete means delete files from the destination that have been removed from the source, and --exclude-from specifies a file containing a list of exclusions to omit. You need to exclude a bunch of stuff, things like /dev/*, /proc/*, /sys/*, and so on. You can also exclude things you don't want to copy such as log files. However, this is interactive and also needs permission to log in as root on the destination (which I block for security). Far better, for regular backups, to use rsync as a service on the destination which only needs a few more steps. Also note that trailing "/"s on source and destination are significant. root at b:/backup_a/ will produce different results to root at b:/backup_a !
Hi TG, You can keep an up-to-date copy of the files/folders/pipes/etc. in the 100GB space using rsync, but not a true clone of the partition. To get a true clone of the boot partition, you'd need to boot from a rescue CD, mount the other machine's 100GB space and dd the boot partition device to a file on the 100GB space. You'd also probably want to get the Master Boot Record by grabbing the first 2K of the raw boot device into a separate file... i.e. something like: dd bs=512 if=/dev/sda1 of=/mnt/u/backup/jessie_sda1 dd bs=512 count=4 if=/dev/sda of=/mnt/u/backup/jessie_mbr_sda The device names might be different - the mount folder may be different - etc... But the idea works. - With a new, blank drive, you could recreate the partitions using fdisk, reverse the dd commands, boot and then work on getting the second partition back up and running. -- Larry Irwin On 07/17/2015 01:40 PM, Thierry Granier wrote:> Hello > i have a machine A with 2 disks 1 et 2 running Debian Jessie > on 1 is the system and the boot and the swap > on 2 different partitions like /home /opt ETC..... > > i have a machine B with 1 disk running kali-linux and *100G free* > > Can i clone the disk 1 of machine A on the 100G free on machine B with > rsync? > > If it is possible, how to do that? > Many thanks > TG > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20150717/266c8006/attachment.html>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This is good info for backing up the MBR (which includes the partition table). However, if you are going to image a partition use either ddrescue (does the same thing but has a status screen, can resume, and works around read errors) or partimage (has a status screen and it understands (most) filesystems so it can leave the empty space sparse). On 07/17/2015 02:48 PM, Larry Irwin (gmail) wrote:> Hi TG, You can keep an up-to-date copy of the > files/folders/pipes/etc. in the 100GB space using rsync, but not a > true clone of the partition. To get a true clone of the boot > partition, you'd need to boot from a rescue CD, mount the other > machine's 100GB space and dd the boot partition device to a file on > the 100GB space. You'd also probably want to get the Master Boot > Record by grabbing the first 2K of the raw boot device into a > separate file... i.e. something like: dd bs=512 if=/dev/sda1 > of=/mnt/u/backup/jessie_sda1 dd bs=512 count=4 if=/dev/sda > of=/mnt/u/backup/jessie_mbr_sda The device names might be different > - the mount folder may be different - etc... But the idea works. - > With a new, blank drive, you could recreate the partitions using > fdisk, reverse the dd commands, boot and then work on getting the > second partition back up and running. > > -- Larry Irwin > > On 07/17/2015 01:40 PM, Thierry Granier wrote: >> Hello i have a machine A with 2 disks 1 et 2 running Debian >> Jessie on 1 is the system and the boot and the swap on 2 >> different partitions like /home /opt ETC..... >> >> i have a machine B with 1 disk running kali-linux and *100G >> free* >> >> Can i clone the disk 1 of machine A on the 100G free on machine B >> with rsync? >> >> If it is possible, how to do that? Many thanks TG >> >> > > >- -- ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._., - -*~ Kevin Korb Phone: (407) 252-6853 Systems Administrator Internet: FutureQuest, Inc. Kevin at FutureQuest.net (work) Orlando, Florida kmk at sanitarium.net (personal) Web page: http://www.sanitarium.net/ PGP public key available on web site. ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._., - -*~ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlWpV+kACgkQVKC1jlbQAQc47gCeNqRbq5PGVmvC61Qby2saHo9z Q3wAn2ZSoBM080XyQ8j7DXJn7TBeEL6A =EhNc -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I would add --numeric-ids and --itemize-changes. Up to you if you need --xattrs or --acls. Also, I prefer to do backups by filesystem so I would add - --one-file-system and run one rsync per filesystem. This means you don't have to exclude things like /proc and /dev and any random thing that isn't normally connected but sometimes is but it also means you have to list all the filesystems that you do want to backup. On 07/17/2015 02:21 PM, Simon Hobson wrote:> Thierry Granier <th.granier at free.fr> wrote: > >> i have a machine A with 2 disks 1 et 2 running Debian Jessie on 1 >> is the system and the boot and the swap on 2 different partitions >> like /home /opt ETC..... >> >> i have a machine B with 1 disk running kali-linux and 100G free >> >> Can i clone the disk 1 of machine A on the 100G free on machine B >> with rsync? >> >> If it is possible, how to do that? > > Yes, it's easy to do, I do that for the primary backup on all my > systems. > > Lets say you are doing it from machine a, and backing up to > directory /backup_a on b. Logged in as root then you could do it > with : rsync -avH --delete --exclude-from=/etc/rsync_excludes / > root at b:/backup_a/ -a means "archive" and sets several parameters, v > simply makes things verbose, H means correctly handle hard linked > files. --delete means delete files from the destination that have > been removed from the source, and --exclude-from specifies a file > containing a list of exclusions to omit. You need to exclude a > bunch of stuff, things like /dev/*, /proc/*, /sys/*, and so on. You > can also exclude things you don't want to copy such as log files. > > However, this is interactive and also needs permission to log in as > root on the destination (which I block for security). Far better, > for regular backups, to use rsync as a service on the destination > which only needs a few more steps. > > Also note that trailing "/"s on source and destination are > significant. root at b:/backup_a/ will produce different results to > root at b:/backup_a ! > >- -- ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._., - -*~ Kevin Korb Phone: (407) 252-6853 Systems Administrator Internet: FutureQuest, Inc. Kevin at FutureQuest.net (work) Orlando, Florida kmk at sanitarium.net (personal) Web page: http://www.sanitarium.net/ PGP public key available on web site. ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._., - -*~ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlWpWJ8ACgkQVKC1jlbQAQfL5ACfT0vOkim+7HE53/pqfsSzaA1U KN8AoOKGhNGI2xzZrco9Li9jv9Y/6cFi =+mSP -----END PGP SIGNATURE-----