mandag den 23. december 2019
Replacing root disk with a smaller one.
In this example we will be replacing a single disk system with two partitions one for root and one for swap.
After physically installing the disk boot OS and notice the name (CTRL+S top - CTRL+Q uit) or find it from dmesg after login.
On a higher level it can also be found with fdisk -l
Start with partitioning the disk.
One primary, leave enough for double your physical RAM if you have less than 16GB or else make it equal the size.
One extended, for swap.
Now mkfs.ext4 /dev/hdX1
And mkswap /dev/hdX2
Mount the /dev/hdX1 to lets say /mnt
Start copying files
cp -rav /srv/ /mnt/
cp -rav /media/ /mnt/
cp -rav /lib64/ /mnt/
cp -rav /lib/ /mnt/
cp -rav /home/ /mnt/
cp -rav /opt/ /mnt/
cp -rav /usr/ /mnt/
cp -rav /bin/ /mnt/
cp -rav /sbin/ /mnt/
cp -rav /boot/ /mnt/
cp -rav /root/ /mnt/
cp -rav /etc/ /mnt/
cp -av /cdrom/ /mnt/
Go to /mnt and link the kernel files
ln -s boot/vmlinuz-4.15.0-70-generic vmlinuz.old
ln -s boot/vmlinuz-4.15.0-72-generic vmlinuz
ln -s boot/initrd.img-4.15.0-70-generic initrd.img.old
ln -s boot/initrd.img-4.15.0-72-generic initrd.img
Do a blkid and note the UUID for you new disk and replace the one in /mnt/etc/fstab
Replace the swap drive now your add it anyway.
Now its time to leave the comfort of your multi user system and drop into single user mode with telinit 1
rSync the rest with -avhPHAXx
chroot to your new disk system and mount -B the rest of the file systems.
Only thing left is to update-grup and install-grup.
Reboot and change boot order in disk.
Not working? change the boot order back and try again, no harm done :)
Abonner på:
Kommentarer til indlægget (Atom)
Opslags Emner
AOCM
AOit Services
APC220
Arduino
bash
Billeder
BOINC
broken links
censurfri
chmod
chown
CMS
CPU
dd
disk begrænsning
dns
e2label
engarde
ext3
fdisk
frugal install
Galleri
GCstat
HTML
Hukommelse
Icinga
IM
IMAGE
INPUT
instant messaging
linkchecker
linux
Memory
mkfs
modprobe
mount
My-Droid
Nagios
netværk
NRPE
PAM
partitionering
poppassd
privatliv
Process
radio frekvenser
radio link
RAID
RAM
Raspberry Pi
rsync
script
SCSI
serial
service
SETI@Home
shell
sikkerhed
Snyd
Snyd med flash
software
stty
SWAP
TFT
Tiny Core Linux
TYPE
unix
USB
USB flash
USB harddiske
USB nøgler
USB sticks
usermod
Verbatim
virtual disk
virtualbox
webgal
webtools
windows
xinetd
xlinks
xming
xserver

Baggrunden for opslag og artikler her på AOit er mine mere end sidste ti års erfaringer i drift og brug af LAMP platformen til at løse et utal af opgaver. En platform der består af Linux, Apache, MySQL og PHP. Alle fire frit og åben software og til at presentere data som som information bruger jeg HTML til formatering og CSS til layout.

Ingen kommentarer:
Tilføj en kommentar