Home linux How in Linux cloning disk into a different size

How in Linux cloning disk into a different size

Author

Date

Category

Have Linux – Fedora 22,
HDD – on which the system is installed,
It is required to move onto an SDD which is twice as smaller, but there is little data on HDD, so you will fit.
Both disks are connected to a computer.
Question: How to cloning the disk? Preferably with GNU Linux.

Clarifications:
1. CD / DVD – no.
2. Gparted – does not work with an active system section.
3. Where to place TAR archive? in / dev / null? Two discs total.
4. Discs of different sizes!


Answer 1, Authority 100%

Everything can be done, the main thing is neat. Needs the following things:

  • livecd disc or better flash drive. You can another compatible distribution, for example Ubuntu.
  • both disks must be connected to the computer.

Transfer procedure.

  • will boot from Live
  • Open Gparted or any other favorite disk breakout utility.
  • split ssd as needed (home, root, swap and further according to preferences), format
  • Mount new discs and old. I recommend to make an OLD folder to / mount (for the old disk) and new (for the new).
  • Copy the data. Since it is Linux, you can use CP, the main thing to save rights. For example, Home CP -A / MOUNT / OLD / HOME / / MOUNT / NEW / Home .
  • similarly copied root. But here there is a feature – not everyone needs to be copied. For example, the TMP folder is not necessary (although nothing bad will be). If you don’t need to copy it to the / Mount / OLD / PROC and / MOUNT / OLD / SYS folder – it does not need to copy this (the contents of these folders creates the system itself).
  • Do not forget about the boot section.
  • if the device names changed (for example, home it was / dev / sda * 1 *, and became / dev / sdb * 4 * – there is an important number, not the letter), then open the file / Mount / NEW / ETC / FSTAB and Rules on Fenchee.
  • Last remains – transfer the boot record. First you copy the old dd if = / dev / sdx of = / patch / to / mbr_file.img bs = 512 count = 1 , and then transfer to a new one. Since we do not want to lose partition table, you need not to copy everything. dd if = / path / to / mbr_file.img of = / dev / sdx bs = 446 count = 1 .

All, you can turn off, put discs on the places, fix the boot device in the BIOS and try.

What should I do if nothing got used?

The old disk is most likely not damaged. So they can be booted. Plus there is a flash drive. Can be restored.

But to be honest, I transferred a little differently. Everything as above, broke the disk, copied the home partition, then pulled out the old disk, and booted from the flash drive. And started the installation as usual. In the process of installation, the main thing is not to format the home section (although then you can still copy). Since the Home section is, you will save all program settings. Then it will only be possible to adjust the missing programs.


Answer 2, Authority 33%

I highly recommend to look at the project Clonezilla .
Copying both Linux and Windows sections. Loads from flash drive, blanks, networks, knows how to work in server mode and hand out the image through a multicast. Starts in the wizard mode, the overwhelming majority of dialogs are translated into Russian.

Yes, you may need the same Gparted Live Cress the partitions to the sizes of the crawls on SSD, but the other DD and CP -R are not needed there . There is a copy mode from iron to iron, you can first in the image, and then from the image.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions