Taking better advantage of SSD+HDD config in installation

Rafaelys

Member
Credits
433
Hello,

I am recovering my notebook, an old inspiron born in 2014 with a recently deceased HDD, with a new HDD and an SSD, adapting the new HDD via caddy in the optical driver.

Thanks to support on other topics here I was able to have a backup in time. So my main question is how to install the same OS on this new configuration - if anything would change since SSD are faster, etc.

When researching about this I saw this 6 years old thread suggesting leaving the SSD with almost anything related to the OS while putting HDD on storage of heavier files.

They suggest the following configuration, which I found interesting:

On the SSD:

/ - 20GB;
/ home - 100GB;
swap - 8GB.

On the HDD:

Everything dedicated to / media / storage.
In this case, he suggests creating a symlink (link to redirect) in the /home folder to be able to access the /media/storage folder.

As I understand it, after installing OS on SSD, I would move the /media/storage folder to the HDD, and then open the terminal to create the symlink:

ln -s ~/"actual folder path" ~/"desirable symlink location"/

In this case,

ln -s ~/media/storage ~/home/Desktop

On this recent, interesting thread though, there's an argument about not letting swap partition on SSDs when said partition is supposed to be more used, which is the case of any "system where RAM is sparse". The claim is that would reduce SSD lifespan. I think that's not the case as my notebook have 6GB RAM.

So I would like to know if the 6 years tip above is still current and valid, or if there are more updated suggestions for better performance/safety.
 


wizardfromoz

Administrator
Staff member
Gold Supporter
Credits
18,350
@Rafaelys , G'day.

I will get back to this Thread over my weekend. :)

Wizard
 

wizardfromoz

Administrator
Staff member
Gold Supporter
Credits
18,350
G'day, you may be overthinking the RAM a little, I'll explain more as we go on.

1. Remind us what Linux Distro you are using, and version and Desktop Environment.

Is it Elementary (from one of your links) or other?

2. Are you hoping to move or copy your existing setup from one computer to the other, and do you want to have the settings duplicated?

Tell us more.

Cheers

Wizard
Avagudweegend
 

wizardfromoz

Administrator
Staff member
Gold Supporter
Credits
18,350
Also, can you share with us the output from Terminal of the following commands (my comments begin with a hash #)

Code:
dmesg | grep -i swap

#and

cat /etc/fstab
Code:
?

Cheers

Wiz
 

Rafaelys

Member
Credits
433
G'day, you may be overthinking the RAM a little, I'll explain more as we go on.

1. Remind us what Linux Distro you are using, and version and Desktop Environment.

Is it Elementary (from one of your links) or other?

2. Are you hoping to move or copy your existing setup from one computer to the other, and do you want to have the settings duplicated?

Tell us more.

Cheers

Wizard
Avagudweegend
1. Elementary 5.1.7 Hera, with Pantheon as Desktop Environment.

2. I hope to do a clean install of the OS and just copy all files, documents etc after that from my backup. The old HDD won't boot in order for me to duplicate last configuration I guess, but it is still possible to recognize its contents using a SATA/USB adapter.
 

Rafaelys

Member
Credits
433
Also, can you share with us the output from Terminal of the following commands (my comments begin with a hash #)
Yes. Just to let you know, I already installed the OS on the SDD on default mode only to keep working during the week. So the results below are the configuration of the OS installed on the SSD, without any use of the HDD so far. I understand that I may have to reinstall according to the instructions and tips, so I haven't brought the backup here yet.
Code:
dmesg | grep -i swap
[ 0.103316] Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization
[ 1.308221] zswap: loaded using pool lzo/zbud
[ 4.358913] Adding 2097148k swap on /swapfile. Priority:-2 extents:6 across:2260988k SSFS

Code:
cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# / was on /dev/sda1 during installation

<file system>​
<mount point>​
<type><options> <dump> <pass>
UUID=545a2475-14d7-4351-bd76-a056b68c4e7d
/​
ext4
errors=remont-ro​
01
/swapfile​
none​
swapsw00


EDIT: Thanks! :):p
 
Last edited:

wizardfromoz

Administrator
Staff member
Gold Supporter
Credits
18,350
Always welcome :)

Those outputs are as I expected them to be, thanks for providing.

When you did the install to the SSD, did you include a swap file or partition, and if so, how much?

Wiz
 

Rafaelys

Member
Credits
433
Always welcome :)

Those outputs are as I expected them to be, thanks for providing.

When you did the install to the SSD, did you include a swap file or partition, and if so, how much?

Wiz
For this temporary installation let's say, I did not make any editing on the partitions. I chose the automatic / standard installation and at least from what I saw now by Gparted, no swap partition was created.

SSD

HDD
 

wizardfromoz

Administrator
Staff member
Gold Supporter
Credits
18,350
Great, what I was hoping for. Thanks.

Now it's very late for you, so we can take this up again when you are available, and (in Australia we say) "bright-eyed and bushy-tailed", that is, when you are fresh.

I'll put together a couple of references for when next we "meet".

Cheers

Wiz
 

jglen490

Well-Known Member
Credits
4,106
Obey the @wizardfromoz :eek:

And perhaps consider mounting the HDD via fstab, so the files on there are always available. That's not "booting", just "mounting". You could then also put the /home on the HDD if you wanted. Your choice, just suggesting options :cool:
 

wizardfromoz

Administrator
Staff member
Gold Supporter
Credits
18,350
Let me show you the output I had for those 2 commands, on my Elementary OS Hera:

Code:
[email protected]:~$ dmesg | grep -i swap
[    0.030304] Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization
[    0.944694] zswap: loaded using pool lzo/zbud
[   14.602902] Adding 970056k swap on /swapfile.  Priority:-2 extents:4 across:994632k FS

# and

[email protected]:~$ cat /etc/fstab
# <file system> <mount point> <type> <options> <dump> <pass>

UUID=2fd8e645-554d-4cec-a9fc-855c8a116349    /    ext4    errors=remount-ro    0    1
UUID=024B-FCE8    /boot/efi    vfat    umask=0077    0    1
/swapfile    none    swap    sw    0    0
You can read about zswap and zram by Googling

linux zswap and zram

The Arch Wiki gives detail here

https://wiki.archlinux.org/index.php/zswap

and Stack Overflow have this-

https://stackoverflow.com/questions/18437205/difference-between-zram-and-zswap

Elementary, along with very many other Linux Distros, have been installing a swap file as opposed to a swap partition for at least 3 years (Ubuntu 18.04 is just one example).

Zswap and zram likewise have been used since 2013/2014.

In your case, Elementary has "looked at" your 6 GB RAM, and created a 2 GB swapfile to assist, as well as zswap to aid that.

In my case (with 16 GB RAM) it has created a little under 1 GB swapfile. As well as the zram.

So there is no real need for a dedicated Swap partition, it is likely just overkill.

I will detail more about this in an upcoming article, perhaps titled "Would you Swap Swap for Nothing?"

John @jglen490 could tell us a bit about referencing in fstab, and the differences beween a /home folder, and a Home partition, if he likes (we could make him work for his supper.

Speaking of supper, I am off for mine.

c u later, all.

Wiz
 

Rafaelys

Member
Credits
433
So there is no real need for a dedicated Swap partition, it is likely just overkill.

I will detail more about this in an upcoming article, perhaps titled "Would you Swap Swap for Nothing?"

John @jglen490 could tell us a bit about referencing in fstab, and the differences beween a /home folder, and a Home partition, if he likes (we could make him work for his supper.
Excellent. I read about it; so it's even better than i thought. Looking forward for your article!

Obey the @wizardfromoz :eek:

And perhaps consider mounting the HDD via fstab, so the files on there are always available. That's not "booting", just "mounting". You could then also put the /home on the HDD if you wanted. Your choice, just suggesting options :cool:
I think that while researching before opening this topic I came across things about fstab but I decided not to go further in the guidelines I found - I'm almost sure it was these from 8 years ago.

As I understand it, as it says in that thread too, so the thing is all about making the HDD available from startup.

Whether it will be as a partition to be mounted or as a folder to be accessed, I will follow @wizardfromoz 's suggestion to follow your suggestions.

Results for
Code:
sudo fdisk -l
are:


Disk / dev / loop0: 55.5 MiB, 58159104 bytes, 113592 sectors
Units: 1 * 512 sector = 512 bytes
Sector size (logical / physical): 512 bytes / 512 bytes
I / O size (minimum / optimal): 512 bytes / 512 bytes

Disk / dev / loop2: 98.4 MiB, 103129088 bytes, 201424 sectors
Units: 1 * 512 sector = 512 bytes
Sector size (logical / physical): 512 bytes / 512 bytes
I / O size (minimum / optimal): 512 bytes / 512 bytes

Disk / dev / loop3: 85 MiB, 89145344 bytes, 174112 sectors
Units: 1 * 512 sector = 512 bytes
Sector size (logical / physical): 512 bytes / 512 bytes
I / O size (minimum / optimal): 512 bytes / 512 bytes

Disk / dev / loop4: 49.7 MiB, 52097024 bytes, 101752 sectors
Units: 1 * 512 sector = 512 bytes
Sector size (logical / physical): 512 bytes / 512 bytes
I / O size (minimum / optimal): 512 bytes / 512 bytes

Disk / dev / loop5: 31.1 MiB, 32595968 bytes, 63664 sectors
Units: 1 * 512 sector = 512 bytes
Sector size (logical / physical): 512 bytes / 512 bytes
I / O size (minimum / optimal): 512 bytes / 512 bytes

Disk / dev / loop6: 55.4 MiB, 58040320 bytes, 113360 sectors
Units: 1 * 512 sector = 512 bytes
Sector size (logical / physical): 512 bytes / 512 bytes
I / O size (minimum / optimal): 512 bytes / 512 bytes

Disk / dev / loop7: 64.8 MiB, 67915776 bytes, 132648 sectors
Units: 1 * 512 sector = 512 bytes
Sector size (logical / physical): 512 bytes / 512 bytes
I / O size (minimum / optimal): 512 bytes / 512 bytes

Disk / dev / sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: 1 * 512 sector = 512 bytes
Sector size (logical / physical): 512 bytes / 512 bytes
I / O size (minimum / optimal): 512 bytes / 512 bytes
Disc label type: dos
Disk identifier: 0x7aa408b8

Device Start Start End Sectors Size Id Type
/ dev / sda1 * 2048 468860927 468858880 223.6G 83 Linux

Disk / dev / sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: 1 * 512 sector = 512 bytes
Sector size (logical / physical): 512 bytes / 4096 bytes
I / O size (minimum / optimal): 4096 bytes / 4096 bytes
Disc label type: dos
Disk identifier: 0x9e63986e

Device Start Start End Sectors Size Id Type
/ dev / sdb2 2048 1953525167 1953523120 931.5G 83 Linux

Disk / dev / loop8: 162.9 MiB, 170778624 bytes, 333552 sectors
Units: 1 * 512 sector = 512 bytes
Sector size (logical / physical): 512 bytes / 512 bytes
I / O size (minimum / optimal): 512 bytes / 512 bytes

Disk / dev / loop9: 173 MiB, 181366784 bytes, 354232 sectors
Units: 1 * 512 sector = 512 bytes
Sector size (logical / physical): 512 bytes / 512 bytes
I / O size (minimum / optimal): 512 bytes / 512 bytes


I think it /dev/sdb is being recognized as "linux" or something after I tested "fstab" to a certain extent following the guidelines in this same topic. I stopped following on steps 6 and 7 where they give suggestion in order to get a "filesystem", as I didn't understand what it is.
 
Last edited:

jglen490

Well-Known Member
Credits
4,106
Yes, fdisk shows that /dev/sdb exists, which is your 1TB drive. That doesn't mean the filesystem on the physical drive itself has been mounted - just means it's detectable. The /etc/fstab file can be modified to actually mount the filesystem on your 1TB physical drive to some logical location in your Linux directory structure.

I have, in the past, usually mounted my second physical drive (HDD or SSD, at various times) as /home, since the drive has my docs, pictures, movies, etc. files that I use and update all the time. I have done that on my desktop PC (with multiple drives), but have not on my current laptop (it has only one drive).

You can make that your choice, if you want to.
 

Rafaelys

Member
Credits
433
Yes, fdisk shows that /dev/sdb exists, which is your 1TB drive. That doesn't mean the filesystem on the physical drive itself has been mounted - just means it's detectable. The /etc/fstab file can be modified to actually mount the filesystem on your 1TB physical drive to some logical location in your Linux directory structure.

I have, in the past, usually mounted my second physical drive (HDD or SSD, at various times) as /home, since the drive has my docs, pictures, movies, etc. files that I use and update all the time. I have done that on my desktop PC (with multiple drives), but have not on my current laptop (it has only one drive).

You can make that your choice, if you want to.
Correct me if I'm wrong... I can then follow the steps of that thread, mounting HDD to make it accessible from startup.

After mounting it, I get access to it through the console (with "chmod 777" command I think), so I can move the folder /home from SSD to HDD. So, the OS will automatically recognize the folder in its new location, right?
 

wizardfromoz

Administrator
Staff member
Gold Supporter
Credits
18,350
G'day @Rafaelys - I was trawling the net and I found this from How To Geek. HTG is a good source for many Linux tips.

This has a number of steps in it, but it looks good to me, and it is relatively recent. See what you think.

https://www.howtogeek.com/442101/how-to-move-your-linux-home-directory-to-another-hard-drive/

There is a part about 3/4 of the way down where they say

Now we can edit the fstab file.

sudo gedit /etc/fstab
For you that would be different. gedit is the GUI text editor for Ubuntu GNOME. Elementary has one called

code

and its package has the unusually long name of

io.elementary.code

so you would use

Code:
sudo io.elementary.code /etc/fstab
instead, or you could use a console-based editor known as Nano if you are familiar with it.

Before undertaking any method, I would be inclined to install Timeshift and take a full snapshot, so that you can roll back your system if anything goes wrong.

You can read about Timeshift here

https://itsfoss.com/backup-restore-linux-timeshift/

or here

https://www.linuxliteos.com/manual/tutorials.html#timeshift

or read my Thread here and ask questions there

https://www.linux.org/threads/timeshift-similar-solutions-safeguard-recover-your-linux.15241/

Tony George is the author and maintainer of Timeshift and in the link I provided about at GitHub, he has instructions on how to install it where it starts

Installation
Ubuntu-based Distributions

Ubuntu, Linux Mint, Elementary OS, etc.
Cheers

Wizard
 
Last edited:

jglen490

Well-Known Member
Credits
4,106
And I would think hard about chmod 777 before applying it ;)
 

Rafaelys

Member
Credits
433
Everything went well with Timeshift. I only had to enable PPA support before, with

Code:
sudo apt install software-properties-common
So that the repository could be recognized, or something. Then:

Code:
sudo apt-add-repository -y ppa:teejee2008/ppa

apt-get update

apt-get install timeshift
Then, backup made initially on the SSD, to be transferred to the HDD in the future, as it is not yet installed.

When creating a file system on the partition, I had this error message:

Code:
$ sudo mkfs -t ext4 /dev/sdb1
mke2fs 1.44.1 (24-Mar-2018)
/dev/sdb1 is apparently in use by the system; will not make a file system here!
EDIT: just put console info on google translate, not sure it is the right text on english

I looked for this type of error and apparently found only people with different problems. So I decided not to try anything.
 

jglen490

Well-Known Member
Credits
4,106
That usually means that /dev/sdb1 is mounted. You can unmount it, and then retry the command.
 

Rafaelys

Member
Credits
433
I managed to advance to the part where they say I should edit fstab:

There is a part about 3/4 of the way down where they say

Code:
sudo gedit /etc/fstab
For you that would be different. gedit is the GUI text editor for Ubuntu GNOME. Elementary has one called

code

and its package has the unusually long name of

io.elementary.code

so you would use

Code:
sudo io.elementary.code /etc/fstab
Here it brings an error, about which I could not find instructions, despite the error code:

Code:
~$ sudo io.elementary.code /etc/fstab
No protocol specified
Unable to init server: Unable to connect: Connection refused

(io.elementary.code: 20430): Gtk-WARNING **: 00: 06: 04.179: cannot open display:: 0
 

wizardfromoz

Administrator
Staff member
Gold Supporter
Credits
18,350
I'm working on a Linux Mint at the moment, when I can I'll boot into Elementary and take a look and get back.

Wiz
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!


Top