change formatting

input examples are now given as

```bash
input $ARG1
```

While outputs use md's '> ' sign as a quote.
This commit is contained in:
2023-06-17 21:28:20 +02:00
parent 1ba3010b81
commit ba8026e0c3
102 changed files with 2388 additions and 3211 deletions

View File

@@ -4,7 +4,9 @@ tags: [ "Documentation", "System" ]
---
# FDisk Basics
> sudo fdisk /dev/sda
```bash
sudo fdisk /dev/sda
```
- m for help.
@@ -29,15 +31,21 @@ fdisk will not help with a GPT formatted drive. For this, use gdisk, which is m
Now that we have a partition, we can make it into a fileSystem. Most will use:
> sudo mkfs -t ext4 /dev/sdc1
```bash
sudo mkfs -t ext4 /dev/sdc1
```
or if you're making a swap partition, you can use:
> sudo mkswap /dev/sdb2
```bash
sudo mkswap /dev/sdb2
```
or for the reiser fileSystem, we can use:
> sudo mkreiserfs /dev/sdc2
```bash
sudo mkreiserfs /dev/sdc2
```
# File System Types
@@ -53,61 +61,87 @@ or for the reiser fileSystem, we can use:
# Parted
> sudo parted /dev/sdb
```bash
sudo parted /dev/sdb
```
# Monitoring
Look at physical and virtual partitions:
> df -h
```bash
df -h
```
or divide things by inode - the thing which records where files are?
> df -i
```bash
df -i
```
Examine a fileSystem with:
> sudo dumpe2fs /dev/sda1 | less
```bash
sudo dumpe2fs /dev/sda1 | less
```
# Prevention
There are multiple programs which work mostly the same way.
> sudo tune2fs -c 30 /dev/sda1
```bash
sudo tune2fs -c 30 /dev/sda1
```
This will check sda1 every 30 boots. It can also be checked every month.
> sudo tune2fs -i 1m /dev/sda1
```bash
sudo tune2fs -i 1m /dev/sda1
```
This thing can also make a new label for the System:
> sudo tune2fs -L new_name /dev/sdb3
```bash
sudo tune2fs -L new_name /dev/sdb3
```
# Repair
Start by unmounting the fileSystem.
> sudo umount /dev/sdc1
```bash
sudo umount /dev/sdc1
```
Then it's time to check.
> sudo fsck /dev/sdc1
```bash
sudo fsck /dev/sdc1
```
And possibly repair damage:
> e2fsck -p /dev/sdc1
```bash
e2fsck -p /dev/sdc1
```
or the same with:
> sudo debugfs /dev/sdc1
```bash
sudo debugfs /dev/sdc1
```
# Mounting
You can mount with a specified filetype with:
> sudo mount -t ext3 /dev/sdc2 /mnt/stick
```bash
sudo mount -t ext3 /dev/sdc2 /mnt/stick
```
or if you don't know the type, just try the lot:
> sudo mount -a /dev/sdc1 /mnt/stick
```bash
sudo mount -a /dev/sdc1 /mnt/stick
```
# File Systems
xfs and zfs can only be expanded.
@@ -118,21 +152,31 @@ NB: When I followed these instructions, the process destroyed my data. Seemed fi
Check the fileSystem's health:
> sudo e2fsck -f /dev/sdb1
```bash
sudo e2fsck -f /dev/sdb1
```
Resize the file System to something smaller than what you want, so here I want 500G and so I resize to 450 G.
> resize2fs /dev/sdb1 450G
```bash
resize2fs /dev/sdb1 450G
```
Then delete the partition with either gdisk or fdisk, depending upon the layout.
> sudo fdisk /dev/sdb
```bash
sudo fdisk /dev/sdb
```
> d
```bash
d
```
Then make a new fileSystem of the desired type with:
> n
```bash
n
```
And finally resize to the full size you want:
@@ -149,14 +193,20 @@ Let's start with names. PV = 'Physical Volume', VG = 'Volume Group', and LV = '
Now we can create a volume group out of sdb2 and sdc3:
> sudo vgcreate my-new-vg /dev/sdb2 /dev/sdc3
```bash
sudo vgcreate my-new-vg /dev/sdb2 /dev/sdc3
```
Then make a new logical volume out of the volume group:
> sudo lvcreate -n my-new-lv my-new-vg
```bash
sudo lvcreate -n my-new-lv my-new-vg
```
Then have a look at all logical volumes:
> sudo lvscan
```bash
sudo lvscan
```