# SSD

## Temporarily Mount Partition

### mount
with `sudo mount /dev/sda1 /mnt/ssd-test`

### umount
with `sudo umount /dev/sda1`

## Permanently Mount Partition

### create Backup
```bash
sudo cp /etc/fstab /etc/fstab.backup
```

### edit `/etc/fstab`
with `sudo nano /etc/fstab` and insert UUID from `blkid /dev/sda1` and insert new line
```bash
UUID=123456-abcd-......  /srv/ssd  ext4  defaults,nofail,x-systemd.device-timeout=10s  0  2
```
- /srv/ssd is the permanent mount point
- ext4 is partition type
- defaults means standard partition
- nofail means the system boots even if the mount is not active
- device-timeout - doesn't wait too long during boot
- 0 is default for old dump backup settings
- 2 will be checked after all 1 - 0 means no check through `fsck`

### mount
with `sudo systemctl daemon-reload` and then `sudo mount -a`

### check results
```bash
lsblk
findmnt /srv/ssd
df -hT /srv/ssd
findmnt --fstab
```

## Create New Partition

### What is currently on the ssd
```bash
lsblk -p -o NAME,SIZE,MODEL,FSTYPE,PARTTYPENAME,LABEL,UUID,MOUNTPOINTS /dev/sda
```
expected result:
```bash
/dev/sda
├─/dev/sda1   128M         Microsoft reserved partition
└─/dev/sda2 476.8G ntfs  Microsoft basic data
```
:::warning
no mountpoint should be visible!
:::

### Create one big partition
```bash
  sudo parted --script --align optimal /dev/sda \
  mklabel gpt \
  mkpart primary ext4 1MiB 100%
```
check result with
```bash
lsblk -f /dev/sda   # and
blkid /dev/sda1
```
expected result like:
```bash
user@raspberrypi2b:~ $ lsblk -f /dev/sda
NAME   FSTYPE FSVER LABEL    UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda
└─sda1 ext4   1.0   ssd-data 4339f544-10cc-4d8b-a6a0-54425e97b932

user@raspberrypi2b:~ $ blkid /dev/sda1
/dev/sda1: LABEL="ssd-data" UUID="4339f544-10cc-4d8b-a6a0-54425e97b932" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="primary" PARTUUID="71766893-52af-4e1d-83bd-0b7b0dc171be"
user@raspberrypi2b:~ $
```
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9