The goal for a Dell Inspiron 7580 (smaller SSD and bigger HDD) is to install Ubuntu (LVM/LUKS) on the SSD and use the HDD (LUKS-encrypted) for the bigger files (e.g. Video, Pictures, Download, ...). I searched the internet and could not find a specific instruction.
Sorry for my bad english. First, about the local to store the bigger files, there are choices. One option is to install your /home as an partition in hdd. You can do this in advanced partitioning method. The advantage is it will works for all users, but the disadvantage is that will also move some application data (mostly configuration files) to hdd. So, the other option is to move just the folders like Documents, Videos, Image, etc... to hdd. I disagree from previous answear at this point: The right way to move these folders is editing the file ~/.config/user-dirs.dirs and change values from environment variables like XDG_DOCUMENTS_DIR, instead of making simbolic links, so the environment variables for these foldes will be valid folders path. The icons and shortcuts for these folders will work fine.
Second, you will want to mount hdd partition at boot, so you will can use that in a better way, because the hdd paths will be always valid. You can install the system in ssd normally, and then create luks partition in hdd with gnome-disks utility. Then you can choice to type a password in boot, or just use a keyfile, which i guess is the better option if you ssd is also encrypted.
Tutorial asking password https://averagelinuxuser.com/auto-mount-encrypted-partitions-at-boot/ Tutorial with keyfile https://www.golinuxcloud.com/mount-luks-encrypted-disk-partition-linux/
Just a tip: Mounting a partition in /media will make that media more visible, appearing in "other locations" in nautilus, but also will be unmountable in nautilus and will show always an icon in ubuntu dash just like a pendrive (you can change that in gnome-tweaks, but it will hide pendrive icons too). I prefer to mount in /mnt (like /mnt/hdd), or just a new dir in / like /data. You will can see free disk space in that media in nautilus just opening this directory, right click, properties, and you can add a bookmark to this folder.
I took me a lot of time and Ihad to find a lot of information to succeed on this specific task. That is why I would like to share it with others, maybe somebody else will find the answer or part of it helpful:
Regarding Ubuntu on Dell Inspiron 7580 I found first a discouraging page:
"Standard images of Ubuntu may not work at all on the system or may not work well, though Canonical and computer manufacturers will try to certify the system with future standard releases of Ubuntu."
This is weird as the special image would work and why would Dell not feed the changes back into the community and Canonical? Why can they not offer the special image to download? But there is hope as I am using now Ubuntu 19.04 without problems.
Some basic comments that I found helpful:
And no need for overprovisioning (leave some of the SSD empty). That's old news periodically regurgitated in some blogs for clickbait (SuperUser Answer).
Therefore no need to transfer the swap partition and var-folder from the SDD to the HDD
Installation and configuration of Ubuntu (19.04) on Dell Inspiron 7580
I used the following answer as stepping stone: Encrypt an Ubuntu 18.04 LTS Installation with TWO Drives: OS on the primary SSD, /home on your secondary HDD
But before you do install Ubuntu, make sure your SSD is recognised during the installation process. At the step of the “installation type”, you can choose “something else” and see whether two drives (SSD + HDD) are shown. For me it was BC501 NVMe ... 128GB and ST2000LM015-2E8174.
- If both drives are recognised, go back to the “installation type” and you are good to install LVM with encryption (LUKS). It should ask you on which drive you want to install Ubuntu and choose the SSD “NVMe ...”.
- If only the HDD is shown, follow the steps below to have the SSD recognised.
- Install Ubuntu onto your smaller (usually the SSD) and check (i) erase the disk, (ii) encrypt the installation, and (iii) LVM management. This will result in an encrypted SSD, but will not touch the second (usually HDD) drive.
When I wanted to restart the laptop, it seemed to try to start with the SSD but stopped with a squeaking sound, then it starts the HDD (called ubuntu in the UEFI) which then shows a black screen with GRUB command line. If this happens to you, please check the steps below to solve the problem, in my case it was a wrong boot option/sequence
- Open gParted (if not yet installed: sudo apt install gparted)
- navigate to your second HDD (carefully check the /dev/sd?X)
- delete any & all existing partitions
- create a new PRIMARY PARTITION using the ext4 file system. You could also label it, but that’s not necessary. Choose "Apply".
One gParted is finished, close gParted.
Now you're ready to install the LUKS container on the second drive and then format it. In the following commands, replace sd?X with the name of your SECONDARY drive (not your primary drive), for example sda1: sudo cryptsetup -y -v luksFormat /dev/sd?X
Then you’ll need to decrypt the new partition so that you can format it with ext4, the modern Linux file system preferred by Ubuntu.
sudo cryptsetup luksOpen /dev/sd?X sd?X_crypt
sudo mkfs.ext4 /dev/mapper/sd?X_crypt
If you want to use your second HDD as a regular, frequently accessed hard drive, there’s a way to automatically mount and decrypt your second drive on startup, when your computer prompts you for the primary hard drive decryption password. Aside: I use the same passphrase for BOTH my drives, as I envision more issues with two different passphrases.
First you’ll need to create a keyfile, which acts as a password for your secondary drive, and so that you don’t have to type in every time you start up (like your primary hard drive encryption password).
sudo dd if=/dev/urandom of=/root/.keyfile bs=1024 count=4
sudo chmod 0400 /root/.keyfile
sudo cryptsetup luksAddKey /dev/sd?X /root/.keyfile
Once the keyfile has been created, add the following lines to /etc/crypttab using nano
sudo nano /etc/crypttab
Add this line, save & close the file (/etc/crypttab).
sd?X_crypt UUID= /root/.keyfile luks,discard
For me: sda1_crypt UUID=7e0edaa0-69f9-425d-ba9d-3f5fdff14cd5 /root/.keyfile luks,discard
To get your parition’s UUID to enter into the /etc/crypttab file, use this command (you need to use sudo it so that all of your partitions show up):
The value you want is the UUID of /dev/sd?X, not dev/mapper/sd?X_crypt. Also make sure to copy the UUID, not the PARTUUID.
Close & save /etc/crypttab file.
Add this line to /etc/fstab to actually mount the partition on startup. (Be careful with this file as it can quite easily cause your system not to boot, see AskUbuntu answer)
/dev/mapper/sd?X_crypt / ext4 defaults 0 2
For me: /dev/mapper/sda1_crypt /media/Storage ext4 defaults,discard 0 2
Then restart (entering your primary drive decryption password) and it should decrypt BOTH your primary and secondary drives.
If you find yourself unable to create files in the new partition, it’s probably still owned by root and needs to be chowned to your user. Run this command:
sudo chown : / -R
Reboot and check to see if this (daisy-chain decrypt) is in fact is the case. If the secondary drive is automatically decrypted, when you choose “Other Locations” the second drive should show up in the list and have a lock icon on it, but the icon should be unlocked.
I followed some tips to make the Ubuntu installer recognize the SSD
Only when I changed the SATA mode from RST(RAID) to AHCI in the UEFI it worked (be careful if you want to have dual boot with Windows). Some other possibly helpful steps:
- Windows fast startup turned off: See AskUbuntu answer.
- Secure boot (UEFI) turned off [later turned on again]
- Start "Install Ubuntu" with nomedeset added
Details see AskUbuntu and ElementaryOS-StackExchange.
- "Install Ubuntu", press "e" and you will be able to edit grub's booting options and added: nvme_core.default_ps_max_latency_us=200
Details see Ubuntu Forum, AskUbuntuAnswer and AskUbuntuAnswer.
The second installation went well, I could choose on which harddisk I wanted to install Ubuntu 19.04 (LVM+LUKS).
Black screen, wrong boot option
When I wanted to restart the laptop, it seemed to try to start with the SSD but stopped with a squeaking sound, then it starts the HDD (called ubuntu in the UEFI) which then shows a black screen with GRUB command line. If this happens to you, please check the steps below to solve it. After the start of the USB installer I would see a quick error: Couldn't get size:0x800000000000000e.
The error is probably not related to the SSD (see Bugzilla and UbuntuForum):
Following HowToGeek, I ran the boot repair but it could not help.
But I also found another thread which seemed to me it could be helpful: I followed the answer, not thinking of an USB-drive but of my SSD. The only difference was that I had to choose FS1: (FSO: did not work, it booted the Grub probably from the HDD)
- When the Dell logo appears, hit F2 to enter the BIOS setup.
- Go on Boot Sequence, you need to ensure the BIOS is set to UEFI, disable Legacy option ROMS and check that secure boot is enabled on the Secure Boot Enable line.
- Now the most important operation... come back to Boot Sequence (General menu on the left)
• click on Add Boot Option. The Add Boot Option window will pop up. Type a name in the Boot Option Name text area ("Ubuntu", for example).
• Click the button to the left of the File Name text area. The EFI Boot Selection window will pop up.
• In the File System drop down menu choose FS1 (or FS0) and EFI. Then using the directories section, navigate until you can choose SHIMx64.EFI (for Ubuntu only - for other distros use grubx64.efi or grubx.efi if your PC is not amd64, anyway it will be named grubxxxxx.efi) in the Files section.
- A new boot option will now appear on the top and in the boot menu. Save and exit
- The computer should now restart without problems.
Symlink to folders (Music, Pictures, … on other folder)
ln (link) -s (symbolic link), see “man ln” in the terminal
ln -s /path/to/file /path/to/symboliclink
Delete current Videos folder (empty it first!): rm -rf ~/Videos
ln -s /media/Storage/Videos ~/Videos
ln -s /media/Storage/Pictures ~/Pictures
ln -s /media/Storage/Public ~/Public
ln -s /media/Storage/Music ~/Music
ln -s /media/Storage/Downloads ~/Downloads
ln -s /media/Storage/Online-Storage ~/Online-Storage
ln -s /media/Storage/Apps-n-Backup ~/Apps-n-Backup
ln -s /media/Storage/E-Books+Articles ~/E-Books+Articles
Helpful: Is there a difference between a symbolic link via terminal or right-click make link?
Not really helpful in this setting better with symlinks
gnome - Change default user folders path?
Trim and noatime for LVM volumes
How to check if TRIM is working for an encrypted volume? - Ask Ubuntu
A lot of users see old info on SSDs. They now are just as reliable (unreliable?) as HDDs. So writes are not really an issue. But I do change SSD partitions to use noatime parameter. (For more details see Ubuntu Forum, blog.confirm.ch, Tldp.org, Stackpointer, Super User)
Add discard parameter to the cryptdevice options in /etc/crypttab to make LUKS accept the discard behavior of the LVM partition. (See World's most secret blogspot)
/etc/fstab: /dev/mapper/ubuntu--vg-root / ext4 errors=remount-ro,discard,noatime 0 1
The whole fstab looks like this:
# <file system> <mount point> <type> <options> <dump> <pass> /dev/mapper/ubuntu--vg-root / ext4 errors=remount-ro,discard,noatime 0 1 # /boot was on /dev/nvme0n1p2 during installation UUID=eb0d2e85-12cf-446e-9594-92ca1005b5cd /boot ext4 defaults 0 2 # /boot/efi was on /dev/nvme0n1p1 during installation UUID=5295-E16A /boot/efi vfat umask=0077 0 1 /dev/mapper/ubuntu--vg-swap_1 none swap sw,discard 0 0 #mount HDD /dev/mapper/sda1_crypt /media/Storage ext4 defaults,discard 0 2
To check whether TRIM is active (after restart):
The SDD itself is trimmed automatically, handled by systemd, you can check this with: sudo systemctl status fstrim.timer (see AskUbuntu comment and Wiki ArchLinux)
LVM: sudo dmsetup table /dev/mapper/sda1_crypt --showkeys You are all set, if the last command shows a result: 1 allow_discards at the end.
Notice: enabling TRIM on an encrypted partition reduces the security of the encryption because it reveals which parts of the partition contain data and which don't. This can aid in some types of analysis. To put this in perspective this does not immediately make your data visible but it would be a similar security trade-off to using a sparse file as the encrypted block, or of setting up an encrypted partition but not initialising the free space with random data, as is usually recommended. See AskUbuntu comment.
For reference some other mentioned problems and tips for Dell Inspiron 7580:
crash - iwlwifi causing system hangs on Ubuntu 19.10 - Ask Ubuntu
Inaccessible Boot Device after dual boot Ubuntu 18.04 and Windows 10: - Installation - Ask Ubuntu