replace spinning HD with SSD
Forum rules
LMDE 2 has reached end of support as of 1-1-2019
LMDE 2 has reached end of support as of 1-1-2019
replace spinning HD with SSD
Hi all,
I plan to replace the spinning HD of the system in my signature with a SSD drive of the same capacity. My /home partition in encrypted using the ecryptfs utilities. My plan is:
1) boot the machine from a stick
2) clone the spinning HD to SSD via dd or gddrescue
3) put the SSD in and I'm good
3a) Maybe I have to recreate the MBR on the newly installed SSD
Am I missing something? As far as I could find out, there are no problems with encrypted filesystems on SSDs, are there?
Thanks and cheers,
Riko
I plan to replace the spinning HD of the system in my signature with a SSD drive of the same capacity. My /home partition in encrypted using the ecryptfs utilities. My plan is:
1) boot the machine from a stick
2) clone the spinning HD to SSD via dd or gddrescue
3) put the SSD in and I'm good
3a) Maybe I have to recreate the MBR on the newly installed SSD
Am I missing something? As far as I could find out, there are no problems with encrypted filesystems on SSDs, are there?
Thanks and cheers,
Riko
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: replace spinning HD with SSD
AFAIK, and I don't have a SSD, so take my advice with a large grain of salt, the main problems with a SSD replacing a spinning HD are any swap partition and the file journaling system. You may want to do some reading of blogs talking about SSD replacement of hard drives.
Re: replace spinning HD with SSD
Interesting!
I would have never thought that that would be a problem. There is a fairly comprehensive (as far as I can tell) article in the Arch Wiki:
https://wiki.archlinux.org/index.php/So ... erformance
which claims, with the proper options ext4 (as all my partitions are) can be used in most cases without much additional wear. Since I don't do much compiling, I guess I'm safe. As far as swap is concerned, reducing swappiness might just be the solution, or replacing the swap partition with a swap file as suggested here. I don't experience swapping anyway with 8GB of RAM.
http://ubuntuforums.org/showthread.php?t=1937251
Since hibernate is not working with encrypted fs on swap, I don't miss out on hibernation anyway
Maybe, instead of just dd'ing the SSD, I partition it manually, copy the data over and re-write the MBR. However, just removing swap and updating the mount options in /etc/fstab before booting from the new device should do the trick as well!?
Thanks for pointing me in that direction. Any more thoughts are highly appreciated.
Cheers, Riko
I would have never thought that that would be a problem. There is a fairly comprehensive (as far as I can tell) article in the Arch Wiki:
https://wiki.archlinux.org/index.php/So ... erformance
which claims, with the proper options ext4 (as all my partitions are) can be used in most cases without much additional wear. Since I don't do much compiling, I guess I'm safe. As far as swap is concerned, reducing swappiness might just be the solution, or replacing the swap partition with a swap file as suggested here. I don't experience swapping anyway with 8GB of RAM.
http://ubuntuforums.org/showthread.php?t=1937251
Since hibernate is not working with encrypted fs on swap, I don't miss out on hibernation anyway
Maybe, instead of just dd'ing the SSD, I partition it manually, copy the data over and re-write the MBR. However, just removing swap and updating the mount options in /etc/fstab before booting from the new device should do the trick as well!?
Thanks for pointing me in that direction. Any more thoughts are highly appreciated.
Cheers, Riko
- catweazel
- Level 19
- Posts: 9763
- Joined: Fri Oct 12, 2012 9:44 pm
- Location: Australian Antarctic Territory
Re: replace spinning HD with SSD
Yes, that's correct. However there are a lot of things you can do that will extend the life of your SSD. For starters, formatting it from the command line with various options to enhance the filesystem for SSD, setting options in fstab, mounting certain drive locations into RAM, not running Google's Chrome browser, and more.Riko wrote:Maybe, instead of just dd'ing the SSD, I partition it manually, copy the data over and re-write the MBR. However, just removing swap and updating the mount options in /etc/fstab before booting from the new device should do the trick as well!?
I will put together a tutorial for migrating from HDD to SSD and post it in the tutorials section. It might be ready tomorrow. Keep your eyes open for it.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
-
- Level 4
- Posts: 357
- Joined: Fri Sep 17, 2010 9:55 pm
Re: replace spinning HD with SSD
Hi Riko,
I have a desktop model and installed an SSD along with my HDD's a few months ago. I don't encrypt so I can't help there. However, here are a few thoughts:
You might want to have a look at Clonezilla. If your SSD is the same capacity as your HDD then you could use Clonezilla to do the cloning.
Have a look in /boot/grub/grub.cfg. You will see that grub uses UUID's to locate where to boot from so merely changing entries in /etc/fstab probably won't be enough.
GParted has an option, which I have never used, to change a UUID if needed. So if you have a different UUID after the cloning it should be possible to change it. Just as long as you write the old one down first.
Parted Magic contains both Clonezilla and GParted so that may be an option for you.
Clonezilla: http://www.clonezilla.org/
Parted Magic: http://partedmagic.com/doku.php
Hope this helps.
I have a desktop model and installed an SSD along with my HDD's a few months ago. I don't encrypt so I can't help there. However, here are a few thoughts:
You might want to have a look at Clonezilla. If your SSD is the same capacity as your HDD then you could use Clonezilla to do the cloning.
Have a look in /boot/grub/grub.cfg. You will see that grub uses UUID's to locate where to boot from so merely changing entries in /etc/fstab probably won't be enough.
GParted has an option, which I have never used, to change a UUID if needed. So if you have a different UUID after the cloning it should be possible to change it. Just as long as you write the old one down first.
Parted Magic contains both Clonezilla and GParted so that may be an option for you.
Clonezilla: http://www.clonezilla.org/
Parted Magic: http://partedmagic.com/doku.php
Hope this helps.
- catweazel
- Level 19
- Posts: 9763
- Joined: Fri Oct 12, 2012 9:44 pm
- Location: Australian Antarctic Territory
Re: replace spinning HD with SSD
That is not good advice for a SSD. Your suggestion means A) the filesystem on the SSD will be tuned for a HDD and not a SSD. That in turn means B) the journal is written to the disk before the data, the result being absolutely unnecessary disk writes to a limited write-life device. C) He can't take advantage of directory indexing, and not only that, D) the partition boundaries most certainly will not be aligned to a cylinder, which will cause the SSD to choke on extended writes.GeneBenson wrote:You might want to have a look at Clonezilla. If your SSD is the same capacity as your HDD then you could use Clonezilla to do the cloning.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
Re: replace spinning HD with SSD
Hey guys,
thanks for your replies. After what I read already also in the links I posted last night, I will not actually clone my spinning HD onto the SSD. This
http://apcmag.com/how-to-maximise-ssd-p ... -linux.htm
gives some useful hands-on tips as well. So my updated replace-spinning-HD-with-SSD strategy now looks as follows:
1) partition the SSD manually (block aligned partitions as advised)
2) copy partitions over by just doing "cp -a source dest" from a live distro with the old spinning and the SSD mounted
3) update the partition UUIDs in fstab on the SSD /-partitions and setting the proper TRIM flags on the ext4-fs
4) finally I need to boot LMDE from the new SSD via a USB stick and re-install grub/MBR.
Essentially the same steps I already did before when replacing small spinning HD with a bigger one on the device.
Thanks again for your comments, more are welcome and much appreciated. I'll definately report back on the results. However, this will take a few since it's my business laptop and the SSD will be purchased by my employer.
Cheers, Riko
thanks for your replies. After what I read already also in the links I posted last night, I will not actually clone my spinning HD onto the SSD. This
http://apcmag.com/how-to-maximise-ssd-p ... -linux.htm
gives some useful hands-on tips as well. So my updated replace-spinning-HD-with-SSD strategy now looks as follows:
1) partition the SSD manually (block aligned partitions as advised)
2) copy partitions over by just doing "cp -a source dest" from a live distro with the old spinning and the SSD mounted
3) update the partition UUIDs in fstab on the SSD /-partitions and setting the proper TRIM flags on the ext4-fs
4) finally I need to boot LMDE from the new SSD via a USB stick and re-install grub/MBR.
Essentially the same steps I already did before when replacing small spinning HD with a bigger one on the device.
Thanks again for your comments, more are welcome and much appreciated. I'll definately report back on the results. However, this will take a few since it's my business laptop and the SSD will be purchased by my employer.
Cheers, Riko
- catweazel
- Level 19
- Posts: 9763
- Joined: Fri Oct 12, 2012 9:44 pm
- Location: Australian Antarctic Territory
Re: replace spinning HD with SSD
Do this at step 2 rather than use cp:Riko wrote:1) partition the SSD manually (block aligned partitions as advised)
2) copy partitions over by just doing "cp -a source dest" from a live distro with the old spinning and the SSD mounted
3) update the partition UUIDs in fstab on the SSD /-partitions and setting the proper TRIM flags on the ext4-fs
4) finally I need to boot LMDE from the new SSD via a USB stick and re-install grub/MBR.
Code: Select all
sudo rsync -vax /src /dest/
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
Re: replace spinning HD with SSD
Follow-up: my SSD finally arrived and these are the steps I did to migrate from the spinning HD to the SSD.
Before I actually got the SSD I set up a few things advised to reduce writes to the disk and therefore increase lifetime. All if these actions are also useful for a spinning HD toimprove performance. The measures taken are:
1) move some of the tmp dirs from disk to ram. Since I have plenty of ram, no problem with this, also helps to speed up your system. Edit your /etc/fstab file and add
2) I didn't want to get rid of swap altogether, since this machine is also a host to some VMs and you never know. However you can force to swap only if ram is physically low. I think, this is just a precaution, because Linux seems to be pretty good in avoiding swapping already. Anyway, I added to /etc/rc.local:
3) move the profile folders of your browsers also to ram disk, but sync with your home dir, to keep history, extensions and the like. There is actually a little tool, that does the trick called profile-sync-daemon (psd). See for example here: [url]http://forum.linuxmint.com/viewtopic.php?f=47&t=126397[/url] how to install. I used the quantal ppa (yeah, yeah, I know this is LMDE but works just fine). Once you installed it, you need to configure a few minimal things for the daemon to actually do the job (e.g. select users and browses). Mine looks like this now:
(I removed most of the comments to keep this sort.)
As I said, these 3 steps I did already before I got my SSD to experiment and make sure things work as expected. A word of caution. I lost my Chrome extensions in the process of moving things to ram-disk. I had a back-up of my profle dir, but didn't manage to restore them. Didn't try very hard either, because they were quick to just re-install.
4) Put the new SSD into a external usb case and plug it into your computer
5) boot the machine with a Live Distro of your choice, I used Mint
6) partition your SSD using for example gparted. I used the same partition layout as the spinning HD only adjusted the sizes a bit. You may what to rethink your partitioning since you start from scratch anyway When creating your partitions, make sure to align them to full block or MiB, respectively. gparted gives you an align option to do so.
I had ext4 fs on the spinning HD and use ext4 on the SSD. I did set the "boot" flag on my system partition. Not sure, if that is actually necessary
7) after your partitions are created, mount the one by one all spinning HD partitions and the respective SSD partitions, e.g.
and then copy src to dest
Do this for all your partitions!
8 ) get the UUID for your new device from
9) mount your system partition of the SSD (!!) where Mint is installed again, in my case this was sdd1:
open /media/dest/etc/fstab and replace the UUIDs of your old device with the ones for your new SSD.
10) since the SSD system partition is still mounted, you can take care of setting the proper mount options to reduce wear of the SSD, e.g. add "noatime,discard" to the mount options. Mine looks like that
also, you want o adjust the scheduler to organize the I/O queue by adding to /media/dest/etc/rc.local
assuming sda will be your SSD device after (!!) you put it into your machine.
11) Now, it's time to get out the screw driver and remove the spinning HD and put the SSD in.
12) boot again your favorite Live distro because we still need to re-install grub2 in the MBR
13) to re-install grub,
a) mount your system partition (in my case sda1, this is now your (internal) SSD)
b) mount some of the system fs you need:
c) chroot into your installation and re-install grub2
d)
Now it's time to shutdown your Live distro, pray to the big penguin above, hold your breath and boot from your newly installed SSD.
The improvements I saw in start-up times where for spinning HD vs SSD:
31 secs vs 11 sec for boot
30 secs vs 7 secs for Cinnamon start-up.
Cannot say much about battery life time yet.
Hope that helps and please send comments if you think something should be changed.
Cheers and good luck,
Riko
References:
Of course, haven't figure that out myself, but use community information!
[1] Arch Wiki with info regarding SSD and reference to the profile-sync-daemon: https://wiki.archlinux.org/index.php/Solid_State_Drives
[2] PSD repositories which work for LMDE as well: [url]http://forums.debian.net/viewtopic.php?f=6&t=96425[/url]
[3] same info, but shorter: [url]http://apcmag.com/how-to-maximise-ssd-performance-with-linux.htm[/url]
[4] re-install grub: [url]http://askubuntu.com/questions/88384/how-can-i-repair-grub-how-to-get-ubuntu-back-after-installing-windows[/url]
Before I actually got the SSD I set up a few things advised to reduce writes to the disk and therefore increase lifetime. All if these actions are also useful for a spinning HD toimprove performance. The measures taken are:
1) move some of the tmp dirs from disk to ram. Since I have plenty of ram, no problem with this, also helps to speed up your system. Edit your /etc/fstab file and add
Code: Select all
# tmpfs for (some) temp and logs
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0
2) I didn't want to get rid of swap altogether, since this machine is also a host to some VMs and you never know. However you can force to swap only if ram is physically low. I think, this is just a precaution, because Linux seems to be pretty good in avoiding swapping already. Anyway, I added to /etc/rc.local:
Code: Select all
# pretty much disable swap except when there is no RAM left
echo 0 > /proc/sys/vm/swappiness
Code: Select all
> cat /etc/psd.conf
# List users separated by spaces whose browser(s) profile(s) will get symlinked
# and sync'ed to tmpfs
USERS="wichmann"
# List browsers separated by spaces to include in the sync. Useful if you do not
# wish to have all possible browser profiles sync'ed
# Otherwise all available/supported browsers will be managed
BROWSERS="google-chrome midori firefox"
# Define where browser profiles will reside in tmpfs
VOLATILE="/run/shm"
# Define where the pid file for psd will reside
DAEMON_FILE="/var/run/psd"
(I removed most of the comments to keep this sort.)
As I said, these 3 steps I did already before I got my SSD to experiment and make sure things work as expected. A word of caution. I lost my Chrome extensions in the process of moving things to ram-disk. I had a back-up of my profle dir, but didn't manage to restore them. Didn't try very hard either, because they were quick to just re-install.
4) Put the new SSD into a external usb case and plug it into your computer
5) boot the machine with a Live Distro of your choice, I used Mint
6) partition your SSD using for example gparted. I used the same partition layout as the spinning HD only adjusted the sizes a bit. You may what to rethink your partitioning since you start from scratch anyway When creating your partitions, make sure to align them to full block or MiB, respectively. gparted gives you an align option to do so.
I had ext4 fs on the spinning HD and use ext4 on the SSD. I did set the "boot" flag on my system partition. Not sure, if that is actually necessary
7) after your partitions are created, mount the one by one all spinning HD partitions and the respective SSD partitions, e.g.
Code: Select all
sudo mkdir /media/src
sudo mkdir /media/dest
sudo mount /dev/sda1 /media/src # this is partition 1 of the (original) spinning HD
sudo mount /dev/sdd1 /media/dest # this of the (new) SSD, adjust if necessary
Code: Select all
sudo rsync -ax /media/src/ /media/dest/
sudo umount /media/src
sudo umount /media/dest
Do this for all your partitions!
8 ) get the UUID for your new device from
Code: Select all
sudo /sbin/blkid
Code: Select all
sudo mount /dev/sdd1 /media/dest
10) since the SSD system partition is still mounted, you can take care of setting the proper mount options to reduce wear of the SSD, e.g. add "noatime,discard" to the mount options. Mine looks like that
Code: Select all
> cat /media/dest/etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/sda1
UUID=55a8f139-f99b-4d48-a4f1-fd8526c77919 / ext4 noatime,discard,errors=remount-ro 0 1
# /dev/sda6
UUID=35aaea0d-f1cc-4cfe-b436-19470e6d0fac /home ext4 noatime,discard,rw,errors=remount-ro 0 0
# swap partiton: sda5
/dev/mapper/cryptswap1 none swap sw 0 0
# tmpfs for (some) temp and logs
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0
## data partition
UUID=7da6f032-6f48-44b8-8fd1-729e53379aed /mnt/data ext4 noatime,discard,rw,errors=remount-ro 0 2
Code: Select all
echo deadline >/sys/block/sda/queue/scheduler
11) Now, it's time to get out the screw driver and remove the spinning HD and put the SSD in.
12) boot again your favorite Live distro because we still need to re-install grub2 in the MBR
13) to re-install grub,
a) mount your system partition (in my case sda1, this is now your (internal) SSD)
Code: Select all
sudo mount /dev/sda1 /mnt
Code: Select all
for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done
Code: Select all
sudo chroot /mnt
grub-install /dev/sda
update-grub
Code: Select all
exit
The improvements I saw in start-up times where for spinning HD vs SSD:
31 secs vs 11 sec for boot
30 secs vs 7 secs for Cinnamon start-up.
Cannot say much about battery life time yet.
Hope that helps and please send comments if you think something should be changed.
Cheers and good luck,
Riko
References:
Of course, haven't figure that out myself, but use community information!
[1] Arch Wiki with info regarding SSD and reference to the profile-sync-daemon: https://wiki.archlinux.org/index.php/Solid_State_Drives
[2] PSD repositories which work for LMDE as well: [url]http://forums.debian.net/viewtopic.php?f=6&t=96425[/url]
[3] same info, but shorter: [url]http://apcmag.com/how-to-maximise-ssd-performance-with-linux.htm[/url]
[4] re-install grub: [url]http://askubuntu.com/questions/88384/how-can-i-repair-grub-how-to-get-ubuntu-back-after-installing-windows[/url]
Re: replace spinning HD with SSD
Congrats on your new SSD. Have you considered enabling and testing TRIM? More info here: https://sites.google.com/site/lightrush ... andworking
Re: replace spinning HD with SSD
Out of curiosity, how do you trim an external SSD?
Typing in long UUID's is no fun if that is necessary.
And should you trim flash drives?
Typing in long UUID's is no fun if that is necessary.
And should you trim flash drives?