Technical issues/questions of an intermediate or advanced nature.
-
Ed_P
- Contributor

- Posts: 8956
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Post#1
by Ed_P » 26 Dec 2020, 12:55
I received a new ssd drive for Christmas.

I want to replace the hdd in my notebook with it and move everything on the hdd to the new ssd drive. The hdd has 8 partitions. Can a simple dd command copy everything??
Sudo dd if=/mnt/sda of=/mnt/sdb
Or do I have to do partition by partition? Or use gparted?

Ed_P
-
Blaze
- DEV Team

- Posts: 3998
- Joined: 28 Dec 2010, 11:31
- Distribution: ⟰ Porteus current ☯ all DEs ☯
- Location: ☭ Russian Federation, Lipetsk region, Dankov
-
Contact:
Post#2
by Blaze » 26 Dec 2020, 15:28
Better to make these partition manual and copy all data via SATA-USB adapter

Linux 6.6.11-porteus #1 SMP PREEMPT_DYNAMIC Sun Jan 14 12:07:37 MSK 2024 x86_64 Intel(R) Xeon(R) CPU E3-1270 v6 @ 3.80GHz GenuineIntel GNU/Linux
MS-7A12 » [AMD/ATI] Navi 23 [Radeon RX 6600] [1002:73ff] (rev c7) » Vengeance LPX 16GB DDR4 K2 3200MHz C16
Blaze
-
Ed_P
- Contributor

- Posts: 8956
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Post#3
by Ed_P » 26 Dec 2020, 19:24
I have an Orico 2.5 inch hard drive enclosure and USB cable to use to copy data from the one drive to the other.
Ed_P
-
Ed_P
- Contributor

- Posts: 8956
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Post#4
by Ed_P » 30 Dec 2020, 19:55
DD's bs= option. Hard drives use 512 and the common recommendations for DD are 64 MB and 128 MB. For a drive with large files the large blocksize is useful because it reduces the number or reads and/or writes. But for small files it is a waste of bytes on the drive. A 1 KB script in a 128 MB block wastes 127 MB. 2KB, 10 KB, 1 MB even 10 MB files all take 128 MB.
So, what do you guys recommend for a drive's blksize? And do all the partitions on a drive have to have the same blksize? Can the EFI partition have a 1 MB blksize and the the OS partition 64 MB?
Ed_P
-
donald
- Full of knowledge

- Posts: 2106
- Joined: 17 Jun 2013, 13:17
- Distribution: Porteus 3.2.2 XFCE 32bit
- Location: Germany
Post#5
by donald » 31 Dec 2020, 05:25
Hmm..it seems to me that you are confusing the dds bs= option with disk sectors.
The block size (bs) parameter specifies the amount of memory used to read a block
from one hard disk before attempting to write that block to the other.
dd copies everything, including free space.
The disadvantages become extremely apparent when you have large disks
that aren't completely filled.
You're probably better off using something like Clonezilla.

donald
-
Ed_P
- Contributor

- Posts: 8956
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Post#6
by Ed_P » 31 Dec 2020, 15:47

Thank you
donald.

I was indeed confusing the dd bs= option with disk sectors.
But before I went to bed I ran my dd script and when I got up this morning it was done.

Sometime later today I will replace the hdd with the sdd and we will see how successful I was.
My dd script for anyone interested.
Code: Select all
#!/bin/bash
#https://forum.porteus.org/viewtopic.php?t=8473
# Color definitions # ups.sh
txtbld=$(tput bold) # Bold
txtred=${txtbld}$(tput setaf 1) # Bold Red
txtgreen=${txtbld}$(tput setaf 2) # Bold Green
txtcyan=${txtbld}$(tput setaf 6) # Bold Cyan
rst=$(tput sgr0) # Reset
function redpswd() {
echo -E "$1" $txtred
}
function cyan() {
echo -E "$1" $txtcyan
}
if [ `whoami` != "root" ]; then
cyan "Enter root's password"
su -c "sh $0 $1"
exit
fi
echo $rst
echo
fdisk -l /dev/sda
echo
fdisk -l /dev/sdb
echo
#echo Copy sda to sdb?
read -p "Copy sda to sdb? " ans
if [ "$ans" != "y" ] && [ "$ans" != "Y" ]; then
exit
fi
echo
date
echo
dd if=/dev/sda of=/dev/sdb bs=4K conv=noerror,sync status=progress #conv=noerror status=progress
echo
date
read
Added in 6 hours 10 minutes 16 seconds:
And it works!

I'm using it now.

Looking forward to it's impact on playing FoE.

Ed_P