one day, I want much more bigger space…

so I need to replace my SSD with a 2TB one…

_warning: mntx folder recommand to create at the path of “/“, and exclude it in the rsync step. that is recommanded, the core is to avoid recursively copy of your new folder, for example, if you create the mntx at /home/usr_name/mntx, when I copy old system to the /home/usr_name/mntx, it will create /home/usr_name/mntx/home/usr_name/mntx/home/usr_name/mntx…….. _

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# create new partition on new SSD
cfdisk(parted, gdisk) /dev/sdx
# formulation just like old one, but space you should adjust...


# format the partition
sudo mkfs.ext4 /dev/sdx1(2)
sudo mkfs.fat /dev/sdx2(1)



# mount partition of two disk
# default sdx1 for boot, sdx2 for store of sys.

mkdir /mntx
sudo mount /dev/sdx2 mntx
sudo mkdir -p mntx/boot/efi
sudo mount /dev/sdb1 mntx/boot/efi



# use rsync to synchronize files and links
sudo rsync -aAXHvL --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/mntx/*"} / mnt

#annotate: this command (rsync -aAXHvL) will recursively copy all files in "/" to "mnt", which mean copy the system from old device to new one;
# --exclude mean except this files:

# dev: device file, controlled by system;
#proc: kernel's virtual file system;
#sys: kernel's virtual file system;
#tmp: temporary files;
#run: files during running, will be create when start machine;
#mnt: device that have mounted;
#media: removable device;
#lost+found: ext's special folder;
#mntx: the target folder.


# and the -aAXHvL explain:

#-a: archive mode, copy the authority, time, symbol links and so on.
#
#-A: remain the ACL.
#
#-X: remain the extended properties.
#
#-H: remain the hard links.
#
#-v: show the progress.
#
#-L: copy the real files that are pointed by other files' link(s).







# mount essential directories
for dir in dev proc sys run; do
sudo mount --bind /$dir /mntx/$dir
done
# it is to bind the current system's dev proc sys to your new space of mnt.

# if use arch, you can also use:
# arch-chroot mnt



# enter the new system
sudo chroot /mntx

# re-generate the grub file

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg


# and then we can exit the system
exit

sudo umount -R mnt

play with arch homepage

click here to come back to play with arch
homepage.