mirror of
https://github.com/JonasunderscoreJones/docs.jonasjones.dev.git
synced 2025-10-23 11:09:18 +02:00
more docs updates
This commit is contained in:
parent
f99c86bdef
commit
68ca2bc88e
7 changed files with 247 additions and 0 deletions
10
docs/linux/server-admin/_category_.json
Normal file
10
docs/linux/server-admin/_category_.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"position": 8,
|
||||
"label": "Server Admin",
|
||||
"collapsible": true,
|
||||
"collapsed": true,
|
||||
"link": {
|
||||
"type": "generated-index",
|
||||
"description": "Guides Server Administration"
|
||||
}
|
||||
}
|
97
docs/linux/server-admin/drive-automount.md
Normal file
97
docs/linux/server-admin/drive-automount.md
Normal file
|
@ -0,0 +1,97 @@
|
|||
---
|
||||
sidebar_position: 2
|
||||
slug: /linux/server-admin/drive-automount
|
||||
---
|
||||
|
||||
# Adding an Automount Drive on Linux
|
||||
|
||||
This guide explains how to configure a drive to automount at boot using `/etc/fstab`.
|
||||
|
||||
---
|
||||
|
||||
## Steps
|
||||
|
||||
### 1. Identify the Drive
|
||||
|
||||
List drives and partitions:
|
||||
|
||||
```bash
|
||||
lsblk -f
|
||||
```
|
||||
|
||||
Find the target partition (e.g., `/dev/sdc1`) and note its UUID:
|
||||
|
||||
```bash
|
||||
blkid /dev/sdc1
|
||||
```
|
||||
|
||||
### 2. Create a Mount Point
|
||||
|
||||
Choose or create a directory where the drive will mount:
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /mnt/mydrive
|
||||
```
|
||||
|
||||
### 3. Backup `/etc/fstab`
|
||||
|
||||
Always back up before editing:
|
||||
|
||||
```bash
|
||||
sudo cp /etc/fstab /etc/fstab.bak
|
||||
```
|
||||
|
||||
### 4. Edit `/etc/fstab`
|
||||
|
||||
Open `/etc/fstab` with an editor:
|
||||
|
||||
```bash
|
||||
sudo nano /etc/fstab
|
||||
```
|
||||
|
||||
Add a line with the drive's UUID, mount point, filesystem type, and options. Example for ext4:
|
||||
|
||||
```
|
||||
UUID=your-uuid-here /mnt/mydrive ext4 defaults 0 2
|
||||
```
|
||||
|
||||
Replace `your-uuid-here` with the actual UUID.
|
||||
|
||||
### 5. Test the Configuration
|
||||
|
||||
Mount all entries without rebooting:
|
||||
|
||||
```bash
|
||||
sudo mount -a
|
||||
```
|
||||
|
||||
Check if the drive is mounted:
|
||||
|
||||
```bash
|
||||
df -h | grep /mnt/mydrive
|
||||
```
|
||||
|
||||
:::danger
|
||||
If the test fails and you still reboot, the system will drop to emergency mode and manual intervention is required.
|
||||
|
||||
**In that case SSH WON'T WORK**
|
||||
:::
|
||||
|
||||
### 6. Reboot and Verify
|
||||
|
||||
Reboot the system and confirm the drive automounts:
|
||||
|
||||
```bash
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
After reboot:
|
||||
|
||||
```bash
|
||||
mount | grep /mnt/mydrive
|
||||
```
|
||||
:::note
|
||||
- Use `defaults` for standard mount options.
|
||||
- For other filesystems (e.g., NTFS, FAT32), adjust filesystem type and options accordingly.
|
||||
- If mounting fails at boot, system may drop to emergency mode; always test with `mount -a` first.
|
||||
:::
|
106
docs/linux/server-admin/partition-and-filesystem.md
Normal file
106
docs/linux/server-admin/partition-and-filesystem.md
Normal file
|
@ -0,0 +1,106 @@
|
|||
---
|
||||
sidebar_position: 1
|
||||
slug: /linux/server-admin/partition-and-filesystem
|
||||
---
|
||||
|
||||
# Creating Partition Tables and Filesystems on Linux
|
||||
|
||||
This guide covers creating partition tables and filesystems using command-line tools.
|
||||
|
||||
---
|
||||
|
||||
## 1. Identify the Disk
|
||||
|
||||
List disks and partitions:
|
||||
|
||||
```bash
|
||||
lsblk
|
||||
```
|
||||
|
||||
Assume the target disk is `/dev/sdc`.
|
||||
|
||||
---
|
||||
|
||||
## 2. Create a Partition Table with `fdisk`
|
||||
|
||||
Start fdisk:
|
||||
|
||||
```bash
|
||||
sudo fdisk /dev/sdc
|
||||
```
|
||||
|
||||
### Inside `fdisk`:
|
||||
|
||||
- Create a new GPT partition table (recommended for disks >2TB):
|
||||
|
||||
```
|
||||
g
|
||||
```
|
||||
- Create a new partition:
|
||||
```
|
||||
n
|
||||
```
|
||||
- Accept defaults for partition number, first sector, and last sector (full disk).
|
||||
|
||||
- Write changes and exit:
|
||||
```
|
||||
w
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. Format the Partition
|
||||
|
||||
Assuming partition `/dev/sdc1`:
|
||||
|
||||
- Create an ext4 filesystem:
|
||||
|
||||
```bash
|
||||
sudo mkfs.ext4 /dev/sdc1
|
||||
```
|
||||
|
||||
- For other filesystems:
|
||||
|
||||
- NTFS: `sudo mkfs.ntfs /dev/sdc1`
|
||||
- FAT32: `sudo mkfs.vfat /dev/sdc1`
|
||||
|
||||
---
|
||||
|
||||
## 4. Verify the Filesystem
|
||||
|
||||
```bash
|
||||
sudo blkid /dev/sdc1
|
||||
```
|
||||
|
||||
Check UUID and filesystem type.
|
||||
|
||||
---
|
||||
|
||||
## 5. Mount the Partition
|
||||
|
||||
Create mount point and mount:
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /mnt/mydrive
|
||||
sudo mount /dev/sdc1 /mnt/mydrive
|
||||
```
|
||||
|
||||
Verify:
|
||||
|
||||
```bash
|
||||
df -h | grep /mnt/mydrive
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. Automount (Optional)
|
||||
|
||||
Follow the **Adding an Automount Drive** guide to configure `/etc/fstab`.
|
||||
|
||||
|
||||
:::note
|
||||
- Creating new partition tables and filesystems will erase data on the disk.
|
||||
- Backup important data before proceeding.
|
||||
- Use GPT for disks larger than 2TB; MBR is limited to ~2TB.
|
||||
- Use `parted` or `gparted` for GUI or more advanced partitioning.
|
||||
:::
|
Loading…
Add table
Add a link
Reference in a new issue