On 04/23/2020 05:43 PM, andrew beck wrote:
hey jon

my old hard drive is 1000 gb the new SSD is 120 gb

So I definitely need to shrink the iso.  But the actual data on the old
hard drive is probably only about 3 gb


OK, step one is use fdisk to see the partition arrangement on the old drive.
Generally, the command would be :

sudo fdisk /dev/sda
(answer the password question)
p

and it will list out the partitions. Some older Linux systems had a small boot partition first, then an extended partition, and then the main Linux partition and a swap partition.
Write down or print the report.

Now, with the new drive set up on the same system, or on a usb hard drive dock, find out what the drive name is and then copy the bootloader to the new drive.
Assuming the new drive is /dev/sdb:
sudo d|d if=/dev/sda of=/dev/sdb bs=512 count=1|

This will copy the partition table from the old drive, which is too big, so now use fdisk to remove
and correct the partition sizes.
In fdisk, the m command lists the commands. d to delete old partitions first.

Then n for new, it will ask questions. When you create the main partition (might be sda1 if no boot partition or sda5 if a boot partition) calculate how much space to give it, leaving room
for the swap partition.

Use type=83 for Linux partitions, 82 for swap.

w writes out the partition table, but the machine may need to be rebooted before it
knows the partition table has been changed.

Run fdisk again to make sure the partition table is as it is supposed to be. If good, continue,
otherwise try again.

Now, create the file systems. So, assuming just one Linux partition at sdb1,

sudo mkfs /dev/sdb1
It will take a few minutes, reporting progress as it goes.
now, mount the new file system:

sudo mkdir /mnt/disk (creates a place to mount the new file system to in the main file system)
sudo mount /dev/sdb1 /mnt/disk
cp -ra /  /mnt/disk

(r means recurse into subdirectories, a means preserve timestamps)

This will take a while, as it copies all files from old to new drive.

When done:

sudo umount /mnt/disk

This may take a while to buffer out the updates.
Now, you have to make the new drive bootable. This is where we get into guru territory. We copied the master boot record, but it doesn't know where the bootloader and kernel are in
the new files system.  So, we have to redo that.

Remove old drive, insert new drive as first drive, connect DVD drive and boot from live DVD.

select rescue mode, then do :
grub-install /dev/sda
update-grub

reboot!

I hope this works, I have done this a few times and always got it to work with a little effort.

Jon






_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to