Re: Cloning hdds of different sizes
On Tue, 27 May 2014 21:15:45 -0700 Patrick Bartek nemomm...@gmail.com wrote: 8. Create a new grub.cfg: Use grub-mkconfig. 9. Install to MBR of the 300GB drive: Use install-grub. I use LILO, but make sure you install GRUB on your new (300GB) drive, use fdisk -l /dev/sd[a-z] to find what is what. -- http://markorandjelovic.hopto.org Please make your donation for humanitarian aid for flood victims in Serbia: http://www.floodrelief.gov.rs/eng/ -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20140529150733.29381...@eunet.rs
Re: Cloning hdds of different sizes
On Wed, 28 May 2014 21:34:12 +0100 Philip Ashmore cont...@philipashmore.com wrote: On 28/05/14 21:02, Steve Litt wrote: If you want to expand a partition to include the unallocated space, I think you have to use whatever partition butts up against the unallocated space to make bigger. If there's a tool to enlarge a different partition and move the others to compensate, Im not aware of it. gparted can do this. Cool! Everything the OP asked for, in two simple steps. SteveT Steve Litt* http://www.troubleshooters.com/ Troubleshooting Training * Human Performance -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20140529124934.569b19b6@mydesk
Re: Cloning hdds of different sizes
On May 29, 2014 7:50 PM, Steve Litt sl...@troubleshooters.com wrote: On Wed, 28 May 2014 21:34:12 +0100 Philip Ashmore cont...@philipashmore.com wrote: On 28/05/14 21:02, Steve Litt wrote: If you want to expand a partition to include the unallocated space, I think you have to use whatever partition butts up against the unallocated space to make bigger. If there's a tool to enlarge a different partition and move the others to compensate, Im not aware of it. gparted can do this. Cool! Everything the OP asked for, in two simple steps. SteveT Steve Litt* http://www.troubleshooters.com/ Troubleshooting Training * Human Performance -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20140529124934.569b19b6@mydesk Awesome! Thank everyone for your responses. And sorry for not replying sooner. The thing is, I forgot to mention that I had one more partition. Some /mnt/data0 drive where I was keeping some backups and photos. I used dd from an older Knoppix 7.0 I found at hand when I started. dd was running like so: dd if=/dev/sdb of=/dev/sda. In another lxterm tab, I left a while true kill -SIGUSR1 (PID_of_dd) and sleep 300 to see its progress. However, when I woke up (was getting ready to leave for my parents place), I saw that the lxterminal window was gone, and so was the lxde taskbar, buttons. As I was in a rush, I didn't think much of that, pressed ctrl+alt+f1, turned off, removed 250gb drive and turned on the computer to see the result. As pointed, Debian did boot, however I noticed that the data partition was not imaged completely (lxde/lxterm crash). This is because when I did an ls /mnt/data0 I got the following: ls: cannot access /mnt/data0/backup: Input/output error ls: cannot access /mnt/data0/hdd mic: Input/output error ls: cannot access /mnt/data0/iso_library: Input/output error ls: cannot access /mnt/data0/download: Input/output error I wasn't able to identify any other issues, however this looks bad enough. So again, thank everyone for the valuable suggestions, however I will now have to redo the process again, and this time I think I will use ddrescue. (I do get the second chance since, in a rush, I removed the hdd, closed the computer case, booted, etc; when I grabbed the hdd I took an older 80 GB ATA drive that was on my desk instead of the 250 GB SATA.) Best regards,
Re: Cloning hdds of different sizes
On Thu, 2014-05-29 at 22:05 +0300, Catalin Soare wrote: dd was running like so: dd if=/dev/sdb of=/dev/sda. #!/bin/sh dd if=/dev/sdb of=/dev/sda echo dd exit status: $? dd.log exit Assumed the exit status isn't 0, there was an error. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/1401392971.1303.12.camel@archlinux
Re: Cloning hdds of different sizes
On May 29, 2014 10:50 PM, Ralf Mardorf ralf.mard...@alice-dsl.net wrote: On Thu, 2014-05-29 at 22:05 +0300, Catalin Soare wrote: dd was running like so: dd if=/dev/sdb of=/dev/sda. #!/bin/sh dd if=/dev/sdb of=/dev/sda echo dd exit status: $? dd.log exit Assumed the exit status isn't 0, there was an error. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/1401392971.1303.12.camel@archlinux Yes, didn't think of this. Thank you Ralf
Re: Cloning hdds of different sizes
Gah no seriously got has nothing to do with your disk size it is just Far far more flexible with partition layouts. Extended partition slices are IMHO a horrible hack. Got hasn't got the 4 primary partitions limits of msdos labels and is just more flexible. I wasn't suggesting uefi which is a slightly different rant. Gpt disk labels with MBR style booting works well and is IMHO the most flexible setup without getting into esoteric Filesystem land - for managing disk partitions labels. On 28/05/2014 4:16 pm, Patrick Bartek nemomm...@gmail.com wrote: On Wed, 28 May 2014, Catalin Soare wrote: In one of my computers I have 2 HDDs. One of them is a 250 GB drive (debian) and the other is a 300 GB (data). I've decided to give one of them to my parents because the one they have right now makes some strange noises. So I've backed up and cleaned up the drive, and as we speak I am cloning my debian install (from the 250 GB disk) onto the other drive. My fstab contains blkids to identify the root, swap, and home partitions. Will the new clone just boot as if it was on the old drive? Also is there a simple method to resize the future home partition and move the root partition so that I don't end up with unallocated space on the drive? Basically I'd like to have a bootable system while also being able to use the entire space on the disk. I found rsync more suitable than dedicated cloning software. I, too, only had three parttions -- /, /home, and swap -- that I wanted to enlarge and rearrange on a new larger drive. Generally, here's the procedure specific to your set up, not mine. 1. Boot with old system. 2. Partition the 300GB drive how you want it, and format the partitions. For safety, I called for a badblock check before formatting. 3. Use blkid to get the UUIDs of each new partition and write them down. 3. Shutdown the system and boot with a Linux LiveCD. Use a 64-bit Live if your system is 64-bit. Similarly, if 32-bit. 4. Use rsync to copy the files on each partition of the 250GB drive to the appropriate one on the 300GB. 5. Once the above copying is done, edit /etc/fstab on the 300GB drive by inserting the new UUIDs for each partition. Change labels, if needed. 6. Set up a chroot to the new cloned system on the 300GB drive. NOTE: I initially used a 32-bit LiveCD when cloning my system, and when I got to this step, the chroot to the 64-bit system on the drive wouldn't work. Booted with a 64-bit LiveCD, and it did. 7. Create a new initrd.img: Use grub-mkimage, IIRC. This is probably not necessary since we're cloning, but I did it on my system anyway. 8. Create a new grub.cfg: Use grub-mkconfig. 9. Install to MBR of the 300GB drive: Use install-grub. 10. Un-chroot, shutdown, remove or disconnect 250GB drive. 11. Reboot and see if it works. That's as best as I can remember. I made notes, but can't find them right now. Be sure to read and study all the mans for rsync, blkid, chroot, and the grub utilites. A search of the web for this procedure wouldn't hurt either, especially the proper procedure for chrooting. I didn't bother using GPT partitioning as MY new drive as it was only 500GB. The old one was 160GB. So, neither should you. Why make trouble for yourself. However, use a contemporary partitioning utility that automatically begins the first partition at the proper sector and aligns all the partitions. Good luck. B -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20140527211545.21de9...@debian7.boseck208.net
Re: Cloning hdds of different sizes
On Wed, 28 May 2014 02:03:48 +0300 Catalin Soare lolinux.so...@gmail.com wrote: Hello, In one of my computers I have 2 HDDs. One of them is a 250 GB drive (debian) and the other is a 300 GB (data). I've decided to give one of them to my parents because the one they have right now makes some strange noises. So I've backed up and cleaned up the drive, and as we speak I am cloning my debian install (from the 250 GB disk) onto the other drive. Sounds to me like a job for dd, or more specifically, ddrescue. ddrescue is featured on the System Rescue CD (http://www.sysresccd.org/SystemRescueCd_Homepage). With ddrescue's logs and many ways of writing, you can be assured of the maximum possible likelihood of getting the job done, and finding out if either drive has problems that should concern you. If you want a quick way of cloning the drive that isn't particularly error prone, this is it, especially if your 250 is fairly full so that file by file copy wouldn't save you much. If both drives are in good shape so there are no misreads or miswrites, I'd imagine the clone will take about an hour, unattended. If there are disk problems it will take longer, but file by file might have missed that fact and written bad data. My fstab contains blkids to identify the root, swap, and home partitions. Will the new clone just boot as if it was on the old drive? After cloning the 250 onto the 300, the 300 will boot just like the 250, always assuming your last step before doing the clone is to get rid of the 300's entry in fstab. Labels and blkids on the 300 will be identical to the 250's after cloning. Also is there a simple method to resize the future home partition and move the root partition so that I don't end up with unallocated space on the drive? Now you're getting a little complicated. What I always do in this situation is just make an additional partition to consume that last bit of drive space, and usually find a use as a scratchpad area for that partition. Or, if you really want to make /home bigger, you can take the biggest subdirectory in /home significantly smaller than the new partition, rsync its contents to the new partition after mounting it, back them up somewhere else, remove them leaving only the empty directory on the original, and mount the new partition as that directory. If you want to expand a partition to include the unallocated space, I think you have to use whatever partition butts up against the unallocated space to make bigger. If there's a tool to enlarge a different partition and move the others to compensate, Im not aware of it. SteveT Steve Litt* http://www.troubleshooters.com/ Troubleshooting Training * Human Performance -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20140528160229.1e959ac3@mydesk
Re: Cloning hdds of different sizes
Hi there. I've commented in-line below. On 28/05/14 21:02, Steve Litt wrote: On Wed, 28 May 2014 02:03:48 +0300 Catalin Soare lolinux.so...@gmail.com wrote: Hello, In one of my computers I have 2 HDDs. One of them is a 250 GB drive (debian) and the other is a 300 GB (data). I've decided to give one of them to my parents because the one they have right now makes some strange noises. So I've backed up and cleaned up the drive, and as we speak I am cloning my debian install (from the 250 GB disk) onto the other drive. Sounds to me like a job for dd, or more specifically, ddrescue. ddrescue is featured on the System Rescue CD (http://www.sysresccd.org/SystemRescueCd_Homepage). With ddrescue's logs and many ways of writing, you can be assured of the maximum possible likelihood of getting the job done, and finding out if either drive has problems that should concern you. If you want a quick way of cloning the drive that isn't particularly error prone, this is it, especially if your 250 is fairly full so that file by file copy wouldn't save you much. If both drives are in good shape so there are no misreads or miswrites, I'd imagine the clone will take about an hour, unattended. If there are disk problems it will take longer, but file by file might have missed that fact and written bad data. My fstab contains blkids to identify the root, swap, and home partitions. Will the new clone just boot as if it was on the old drive? After cloning the 250 onto the 300, the 300 will boot just like the 250, always assuming your last step before doing the clone is to get rid of the 300's entry in fstab. Labels and blkids on the 300 will be identical to the 250's after cloning. Also is there a simple method to resize the future home partition and move the root partition so that I don't end up with unallocated space on the drive? Now you're getting a little complicated. What I always do in this situation is just make an additional partition to consume that last bit of drive space, and usually find a use as a scratchpad area for that partition. Or, if you really want to make /home bigger, you can take the biggest subdirectory in /home significantly smaller than the new partition, rsync its contents to the new partition after mounting it, back them up somewhere else, remove them leaving only the empty directory on the original, and mount the new partition as that directory. If you want to expand a partition to include the unallocated space, I think you have to use whatever partition butts up against the unallocated space to make bigger. If there's a tool to enlarge a different partition and move the others to compensate, Im not aware of it. gparted can do this. SteveT Steve Litt* http://www.troubleshooters.com/ Troubleshooting Training * Human Performance Regards, Philip Ashmore -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/53864844.2020...@philipashmore.com
Cloning hdds of different sizes
Hello, In one of my computers I have 2 HDDs. One of them is a 250 GB drive (debian) and the other is a 300 GB (data). I've decided to give one of them to my parents because the one they have right now makes some strange noises. So I've backed up and cleaned up the drive, and as we speak I am cloning my debian install (from the 250 GB disk) onto the other drive. My fstab contains blkids to identify the root, swap, and home partitions. Will the new clone just boot as if it was on the old drive? Also is there a simple method to resize the future home partition and move the root partition so that I don't end up with unallocated space on the drive? Basically I'd like to have a bootable system while also being able to use the entire space on the disk. Thank you for any suggestions, -- Sent from my Brick (TM)
Re: Cloning hdds of different sizes
You can do this several ways. Way 1) Filesystem level copy + grub install. a)Use a rescue or minimal live boot environment, partition your new disk as you like; complete the minimal install. b)Drop to a shell in the live environment, and mount the new root and fstab layout under a tmp target mount point (i tend to use /mnt/newsubfilesystems) creating each of the sub file system mount directorys under the root then mounting them in turn c)Mount the old filesystem (i.e /mnt/old ) and any subfilesystems d) Use rsync to copy everything under /mnt/old to /mnt/new (rsync -pPvra /mnt/old /mnt/new) - you may want to exclude /mnt/old/dev and /mnt/old/proc ) e) Bind mount the live filesystems proc,sysfs and dev mounts to the /mnt/new ( i.e mount -o bind /dev /mnt/new/dev ; mount -t sysfs /mnt/new/sysfs mount -t proc none /mnt/new/proc ) d) chroot to the new directory ( chroot /mnt/new /bin/bash ) e) fix up any device pointers in /etc/fstab (you might need to change around /dev/sdX etc to accord to the new filesystem parition/device ID - a better method is to get the UUID of the block device using blkid and add that into the /etc/fstab for each fo the mount points than using changable /dev entrys) f) run grub-install from the chroot. g) Done. Way2) (actually more risky and less easy than the above IMHO and will only work with an msdos disk label ) Block copy + fixup disk boundrys by hand + add paritions at the end a) Boot a live environment b) ddrescue /dev/old to /dev/new after running sfdisk on the old and new and keeping a copy of the cylinder/layout info somewhere to refer to c) partprobe the new /dev/new e) Run gparted/parted and align sectors etc f) Add/resize the last parition to fill the space g) Cross fingers. -Joel http://gplus.to/aenertia @aenertia On 28 May 2014 11:03, Catalin Soare lolinux.so...@gmail.com wrote: Hello, In one of my computers I have 2 HDDs. One of them is a 250 GB drive (debian) and the other is a 300 GB (data). I've decided to give one of them to my parents because the one they have right now makes some strange noises. So I've backed up and cleaned up the drive, and as we speak I am cloning my debian install (from the 250 GB disk) onto the other drive. My fstab contains blkids to identify the root, swap, and home partitions. Will the new clone just boot as if it was on the old drive? Also is there a simple method to resize the future home partition and move the root partition so that I don't end up with unallocated space on the drive? Basically I'd like to have a bootable system while also being able to use the entire space on the disk. Thank you for any suggestions, -- Sent from my Brick (TM) -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/CAKiAkGSDzFQ=fnergtysqwzrtapusfe8qfztgkwogtnp_cj...@mail.gmail.com
Re: Cloning hdds of different sizes
When I say - will only work with an msdos disklabel, I meant will only work for msdos disklabels IF you have free primary parition slots. GPT doesn't have this issue and if you can boot GPT labeled disks you should go with this. On 28 May 2014 12:22, Joel Wirāmu Pauling j...@aenertia.net wrote: You can do this several ways. Way 1) Filesystem level copy + grub install. a)Use a rescue or minimal live boot environment, partition your new disk as you like; complete the minimal install. b)Drop to a shell in the live environment, and mount the new root and fstab layout under a tmp target mount point (i tend to use /mnt/newsubfilesystems) creating each of the sub file system mount directorys under the root then mounting them in turn c)Mount the old filesystem (i.e /mnt/old ) and any subfilesystems d) Use rsync to copy everything under /mnt/old to /mnt/new (rsync -pPvra /mnt/old /mnt/new) - you may want to exclude /mnt/old/dev and /mnt/old/proc ) e) Bind mount the live filesystems proc,sysfs and dev mounts to the /mnt/new ( i.e mount -o bind /dev /mnt/new/dev ; mount -t sysfs /mnt/new/sysfs mount -t proc none /mnt/new/proc ) d) chroot to the new directory ( chroot /mnt/new /bin/bash ) e) fix up any device pointers in /etc/fstab (you might need to change around /dev/sdX etc to accord to the new filesystem parition/device ID - a better method is to get the UUID of the block device using blkid and add that into the /etc/fstab for each fo the mount points than using changable /dev entrys) f) run grub-install from the chroot. g) Done. Way2) (actually more risky and less easy than the above IMHO and will only work with an msdos disk label ) Block copy + fixup disk boundrys by hand + add paritions at the end a) Boot a live environment b) ddrescue /dev/old to /dev/new after running sfdisk on the old and new and keeping a copy of the cylinder/layout info somewhere to refer to c) partprobe the new /dev/new e) Run gparted/parted and align sectors etc f) Add/resize the last parition to fill the space g) Cross fingers. -Joel http://gplus.to/aenertia @aenertia On 28 May 2014 11:03, Catalin Soare lolinux.so...@gmail.com wrote: Hello, In one of my computers I have 2 HDDs. One of them is a 250 GB drive (debian) and the other is a 300 GB (data). I've decided to give one of them to my parents because the one they have right now makes some strange noises. So I've backed up and cleaned up the drive, and as we speak I am cloning my debian install (from the 250 GB disk) onto the other drive. My fstab contains blkids to identify the root, swap, and home partitions. Will the new clone just boot as if it was on the old drive? Also is there a simple method to resize the future home partition and move the root partition so that I don't end up with unallocated space on the drive? Basically I'd like to have a bootable system while also being able to use the entire space on the disk. Thank you for any suggestions, -- Sent from my Brick (TM) -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/cakiakgrb_uoalxwxpnqvt2c7ok8xoqxmv++zmdnp9vx1+zr...@mail.gmail.com
Re: Cloning hdds of different sizes
On Wed, 28 May 2014, Catalin Soare wrote: In one of my computers I have 2 HDDs. One of them is a 250 GB drive (debian) and the other is a 300 GB (data). I've decided to give one of them to my parents because the one they have right now makes some strange noises. So I've backed up and cleaned up the drive, and as we speak I am cloning my debian install (from the 250 GB disk) onto the other drive. My fstab contains blkids to identify the root, swap, and home partitions. Will the new clone just boot as if it was on the old drive? Also is there a simple method to resize the future home partition and move the root partition so that I don't end up with unallocated space on the drive? Basically I'd like to have a bootable system while also being able to use the entire space on the disk. I found rsync more suitable than dedicated cloning software. I, too, only had three parttions -- /, /home, and swap -- that I wanted to enlarge and rearrange on a new larger drive. Generally, here's the procedure specific to your set up, not mine. 1. Boot with old system. 2. Partition the 300GB drive how you want it, and format the partitions. For safety, I called for a badblock check before formatting. 3. Use blkid to get the UUIDs of each new partition and write them down. 3. Shutdown the system and boot with a Linux LiveCD. Use a 64-bit Live if your system is 64-bit. Similarly, if 32-bit. 4. Use rsync to copy the files on each partition of the 250GB drive to the appropriate one on the 300GB. 5. Once the above copying is done, edit /etc/fstab on the 300GB drive by inserting the new UUIDs for each partition. Change labels, if needed. 6. Set up a chroot to the new cloned system on the 300GB drive. NOTE: I initially used a 32-bit LiveCD when cloning my system, and when I got to this step, the chroot to the 64-bit system on the drive wouldn't work. Booted with a 64-bit LiveCD, and it did. 7. Create a new initrd.img: Use grub-mkimage, IIRC. This is probably not necessary since we're cloning, but I did it on my system anyway. 8. Create a new grub.cfg: Use grub-mkconfig. 9. Install to MBR of the 300GB drive: Use install-grub. 10. Un-chroot, shutdown, remove or disconnect 250GB drive. 11. Reboot and see if it works. That's as best as I can remember. I made notes, but can't find them right now. Be sure to read and study all the mans for rsync, blkid, chroot, and the grub utilites. A search of the web for this procedure wouldn't hurt either, especially the proper procedure for chrooting. I didn't bother using GPT partitioning as MY new drive as it was only 500GB. The old one was 160GB. So, neither should you. Why make trouble for yourself. However, use a contemporary partitioning utility that automatically begins the first partition at the proper sector and aligns all the partitions. Good luck. B -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20140527211545.21de9...@debian7.boseck208.net