@@ -520,16 +520,12 @@ First some terminology. A `drive`is a physical storage device, just as a hard di
You can view the devices and their partions with the command `lsblk`
### Formating disks
If you want to do it the easy way, just open `gnome-disks`.
To format disks we are going to use the program `parted`. It can be used with its own shell or by running commands. So you can just run parted, and you will enter the parted interface. But here we are going to run the commands instead.
```
# Make sure you know which device you are working with, they can change name between boots
lsblk
@@ -544,18 +540,14 @@ First we have to choose a partition standard. The modern and mostly used is gpt,
This command creates a new partition \(mkpart\), which is of type primary, that takes up the space between 0-100%. Which means we will only have one partition.
Now you can see your new partition with `lsblk`.
**Format the partition with a specific filesystem**
@@ -565,8 +557,14 @@ Now that we have a partition we need to add a filesystem to it.There are many di
```
# For linux
sudo mkfs.ext4 /dev/sda1
# Supposedly work on linux, mac and windows. But fails for me on my tests on Mac
sudo mkfs.vfat /dev/sda1
# To use UDF (universal disk format) that should also work on all OS
# You first need to install apt-get install udftools. Then you do:
mkudffs /dev/sda1
```
**Remove partition**
@@ -576,8 +574,6 @@ sudo mkfs.vfat /dev/sda1
sudo parted /dev/sda rm 1
```
**Mount it**
Now you can just mount the parition somewhere on your filesystem
@@ -589,11 +585,8 @@ sudo mount /dev/sda1 /mnt/here
# Unmount it
sudo umount /mnt/here
```
List all devices
```
@@ -601,6 +594,32 @@ lsblk
fdisk -l
```
### Encrypt a partition
```
sudo cryptsetup luksFormat /dev/sda1
```
**Mount an encrypted parition**
```
cryptsetup open /dev/sda1 backup
```
Then you mount it:
```
mount /dev/mapper/backup /media/username/back
```
### Change encryption passphrase
First find out which device is the encrypted device:
@@ -737,6 +756,36 @@ Then you mount it:
mount /dev/mapper/backup /media/username/back
```
### Create your of filesystem
In some cases it might be useful to create your own disk. Maybe for attaching to a virtual machine, or maybe to facilitate a backup. It is just a easy nice little container to have. It just requires two easy steps.