Clone my 2TB disk to a new 4TB (WD Green). Help needed

Got problems with your B2 or B3? Share and get helped!
Post Reply
spaceuser
Posts: 40
Joined: 28 Jul 2011, 02:29

Clone my 2TB disk to a new 4TB (WD Green). Help needed

Post by spaceuser » 15 Sep 2014, 14:48

I have installed the >2TB disk fix on my B3, and also tried to clone my 2TB to a new 4TB disk using clonezilla with both disk connected on an old PC. The result was not as expected, so I need help from anyone that may have done the similar before. My goal is to have all on the 2TB disk moved to the 4TB disk and then increase the LVM area (/dev/sda2) to the end of size of the disk.

Any link, hint or two in the right direction would be appreciated.

Thanks

Gordon
Posts: 1390
Joined: 10 Aug 2011, 03:18

Re: Clone my 2TB disk to a new 4TB (WD Green). Help needed

Post by Gordon » 18 Sep 2014, 05:01

Cloning, moving, extending partitions is way too tedious and time consuming. It is also not guaranteed that data will not be corrupted during such processes. Just create a new partition table on the new disk and copy the data from the old drive using 'cp -a' or rsync

Also, I would suggest that you move the swap partition to be in between root and home partitions. Don't forget to change fstab, as swap will now be /dev/sda2.

spaceuser
Posts: 40
Joined: 28 Jul 2011, 02:29

Re: Clone my 2TB disk to a new 4TB (WD Green). Help needed

Post by spaceuser » 18 Sep 2014, 09:32

I may buy a new B3 with no disc if I could install my new 4TB drive there and then copy as you suggested after I've got the system up and running.

Cheeseboy
Posts: 789
Joined: 08 Apr 2007, 12:16

Re: Clone my 2TB disk to a new 4TB (WD Green). Help needed

Post by Cheeseboy » 23 Sep 2014, 02:17

I would advise the following (having done it several times myself):

Use a PC with an eSATA port and an external transformer to attach your disks to a PC through eSATA, and an eSATA/SATA adapter cable.
Or if you could be bothered, just open your PC to attach the B3 disks if you have a spare internal SATA channel and power supply.

1. Remove the old disk from the B3, attach to PC, boot with CloneZilla and make a backup image of /dev/sda1 on the old B3 disk (including the boot sector).

2. Boot the PC with a Linux/GNU (bootstick if you only have Windows on the PC) with the new disk attached to via eSATA.

3. Find out the name of the new disk (dmesg, or something like gnome-disks if you have a GUI).

4.

Code: Select all

sudo gdisk /dev/<YOURDISK>
5. Get the help menu by entering "?"

EDIT: Changes start around here...

6. Create a new GPT partition table ("o" command).

7. Create 3 partitions ("n" command), make sure that the the first one is at least as large as /dev/sda1 on the old disk (should be around 10 GiB). Accept gdisk's suggested first sector (2048), and then when asked about the last sector use the format "+11G", or what ever size you want to give your soon to be /dev/sda1.

Make partition number 2 smaller than it has to be, like 256 GiB or something, again accepting default first sector and using the "+sizeG" syntax rather than trying to work out the maths worrying about virtual or physical block sizes.

The 3rd partition will be the swap partition. It will be called /dev/sda3. You could either just create it right after the second partition, or at the end of the disk if you are not worried about the names not being in order. The rest of the instructions assume you create it at the end of the new disk by setting the first sector of partition 3 as "-1G" and accepting the default as the last sector (just because that's what I've always done).

8. You can check that everything is to your liking with the "p" command, which should show there is a big gap between partition 2 and 3.

9. Set the partion type codes ("t" command). Make the first partition of type 0700 (Microsoft Basic Data), second 8e00 (Linux LVM), and last 8200 (Linux SWAP).

10. Exit gdisk saving your changes ("w").

11. You now need to install the default B3 installation on your new disk to get the boot sector right, but adjusted to your aligned partitions.
This means putting the new disk back into the B3. Make sure the boot/install stick is configured to install and format, but NOT partition the disk.

12. Put the new disk in the B3, boot with the install stick and let it install. Reboot, upgrade to the latest version in the web interface, make sure it works. You will now have a rather small but empty /home/storage and all your settings lost.

13. You need to create one or more new partitions to fill up the rest of the disk, and make it available as LVM PV(s). Either do it from the CLI in your new B3 installation (you would have to create a user, probably install some missing things), or move it back to the PC again and use more comfortable tools like gparted.

14. Use pvcreate to make your new partition(s) PVs. Again, it doesn't matter where you do it, as long as they know they are PVs.

15. Now comes the big swap-over. You could do this in several ways but in the end this is what needs to be done:
- The second partition of the new disk must be made cleared of the status of being part of "bubba/storage" while still being available as a free PV.
- Your FileZilla backup of the original /dev/sda1 needs to be put on the new disk.

However you choose to do this will require several more trips in and out of the B3 and PC cases and boots with FileZilla, editing of /etc/fstab, and so on, but you should be able to do all of the above in a reasonable short time, and then still have a usable B3, even if your actual data happens to be sitting on the old disk attached to it via the eSATA port. I will not go into details. This edited version will be slightly shorter.

16. Once you have managed to get your new disk bootable with your restored original /dev/sda partition and access to the old /home/storage (even if it's on the other disk) you can move the data while the system is still on-line by adding PVs to the LV, and then use the pvmove command.

The last step might take days, but you don't have to attend it, and it should be safe, and have your system on line while it is happening. When it is done, you just remove the now empty PV that was the second partition on the original disk from your LV and get rid of the old disk. You can now expand the existing bubba/storage LV with all your new space, or leave it until you need it. Or use it for something else.

Let me know if it is still confusing as hell, and I'll try to review it again when it is not so late :-)
Last edited by Cheeseboy on 25 Sep 2014, 22:57, edited 1 time in total.

spaceuser
Posts: 40
Joined: 28 Jul 2011, 02:29

Re: Clone my 2TB disk to a new 4TB (WD Green). Help needed

Post by spaceuser » 25 Sep 2014, 14:01

Thanks, Cheeseboy! That was quite a comprehensive info. I will check that out as soon as possible.

Cheeseboy
Posts: 789
Joined: 08 Apr 2007, 12:16

Re: Clone my 2TB disk to a new 4TB (WD Green). Help needed

Post by Cheeseboy » 25 Sep 2014, 21:32

Eh, I'm sorry, I think there was a bit of copy/paste problem there, leading to incorrect instructions.
I'll do some edits, hopefully you aren't too confused yet :-)

Post Reply