A
A
Agatnet2021-07-23 08:16:23
linux
Agatnet, 2021-07-23 08:16:23

How to clone a system with all users and settings to a smaller disk?

Worth Debian, 2 users. Terabyte disk. All two now occupy 120 gb and will not occupy more than 200.
I want to change the HDD from 1tb to 200gb. While saving the entire folder structure, user settings, etc.
The disk is divided into:
/ -50gb ext4
/home -800gb ext4
swap - 16gb
I would like to reduce the root to 25. Well, the home folder, according to the size of the new disk.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
X
xotkot, 2021-07-23
@xotkot

  1. insert disk2
  2. prepare disk2 by creating and formatting partitions
  3. mount disk2 partitions to your system
  4. read this carefully
  5. put in rsync what you need and copy data from disk1 to disk2
  6. on disk2 edit fstab and repair your bootloader
  7. disconnect disk1 and start the system from disk2

you can do it from the system that we are transferring without backup (since we do not touch the main system and in which case you can simply boot from disk1)

A
Armenian Radio, 2021-07-23
@gbg

1) backup
2) gparted - reduce the partitions (fs will decrease automatically), shift the partitions so that everything is nearby and at the beginning of the disk.
3) dd to the desired disk
If you like it when APASNA - backup can not be done. I warned.

D
Drno, 2021-07-23
@Drno

Using gparted, reduce the partitions and the disk itself to the desired capacity (slightly less than the second disk)
Insert the second disk
Clone from the first to the second using r-drive image, booting from a cd or flash drive with it
Disconnect the first disk, you may get swearing at the boot partition, then do fscheck at the first start
On virtual machines, I constantly practice this option, it’s convenient for me

D
Damian Lewis, 2021-07-23
@DamianLewis

How would I do
Option 1:
1. Set TimeShift and backup the entire system via rsync to external media. It is possible without TimeShift via console rsync if you know how to use
it 2. We will make a backup of the home directory via Deja Dup
3. Boot through any live distribution, make the necessary disk layout via gparted or similar, install TimeShift and Deja Dup in the same live distribution.
4. Restoring backups that were previously made
5. Installing the GRUB bootloader. Look like that's it.
Option 2:
1. Stupidly copy the entire system partition to an external drive, by simple copying. We will do the same for the home directory. For example, just create the System and Home folders on an external drive and drop the files into the corresponding folders.
2. Boot through any live distribution, make the necessary disk partitioning using gparted or an equivalent
3. After partitioning, copy the files back to the desired partitions
4. Install the GRUB bootloader

R
rPman, 2021-07-23
@rPman

clonezilla in a text interface allows you to do what you want, not only with linux but also with windows.
If anything, it uses the standard partclone utility. Prepare the partitions yourself using fdisk / gparted / kde partitionmanager
You also need to re-install / update grub so that it registers a bootloader for legacy mode or the efi menu
grub-install /dev/sda --root-directory=/mnt
where sda ​​is the new disk and / mnt is where the new copy of the system root is mounted (the new copy must be mounted there /boot and /boot/EFI).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question