So you need to transfer Ubuntu from a regular disk to an SSD drive. At once I will make a reservation, in this note system file transfer is considered (for example, SSD-disk of other volume) instead of cloning of a disk image by means of dd. Also, we only use one mount point (without having to mount the partition to / home separately). We connect the SSD drive to the computer in a convenient way. For normal file transfer we will need a bootable USB flash drive with Ubuntu. Instructions on how to do it can be easily found on the web. Boot from the flash drive and become a superuser by running the command sudo -s.
See how an SSD is defined in the system with a command fdisk -l. My drive is formatted like this:
Disk /dev/sdb: 447,1 GiB, 480103981056 байтов, 937703088 sectors.
We need to prepare and format a new disk. We execute the command fdisk /dev/sdx (in my case /dev/sdb) . Commands that support fdisk can be viewed by pressing the m key and then Enter. Press n to create a new partition. & Nbsp; We will be asked which partition (choose primary - letter p), which cylinder will start the partition (I recommend leaving it by default) and the required partition size (to mount only the root 447 - 7 = 440 gigabytes ) by typing + 440G. Create a swap partition of 7 gigabytes. It is created in the same way only you need to change the type of the partition. The type changes using the letter t (see hints for all types of partitions using the letter L). Select linux swap. By typing the letter p from the main menu, you can see the created partition table. If everything suits, write it with the letter w.
Partition table created. Now create file systems with commands, for example, mkfs -t ext4 /dev/sdb1 and mkswap /dev/sdb2 . The disc is ready. We open 2 terminals and become superusers (sudo -s) in them. In the first, type the command blkid , which will display the uuid table of the file systems. In the second, we type fdisk -l again to determine the drive letters. For example, we have /dev/sda1 - partition with Ubuntu and /dev/sdb1 - partition on which we copy. Create two folders mkdir /mnt/diskDonor and mkdir /mnt/diskAcceptor . We mount both sections: mount /dev/sda1 /mnt/diskDonor and mount /dev/sda1 /mnt/diskAcceptor . Transfer the data by executing the command: rsync -avx /mnt/diskDonor /mnt/diskAcceptor . The -x option in rsync is not to go over the file system boundaries, so it does not get into the jitter /dev /proc and /etc. After the copying of the files is completed, it is necessary to replace the uuid of the disk file system and swap (uuid is the result of executing the command blkid in the first terminal) in the file /etc/fstab and boot/grub/grub.cfg (in the last file you need to replace all old uuid). Now you need to skip sections /proc, /sys and /dev in /mnt/diskAcceptor. Run the commands:
Now let's go to the chroot environment: chroot / mnt / diskAcceptor . There, run the grub-install /dev/sdb commands (in my case, the sdb acceptor disk) and update-initramfs -u -k all .
Exit the chroot environment by issuing the exit command. Unmounted file systems:
Check carefully whether you did everything correctly and turn off the system. We remove the old disk and boot. If you did everything carefully and did not miss anything, a new copy of the system will be loaded.
Еще интересное в сети.