notes/hard_disks.md

46 lines
1.7 KiB
Markdown
Raw Permalink Normal View History

2021-12-31 15:27:07 -05:00
2023-01-12 20:12:24 -05:00
## RAID edits
2021-12-31 15:27:07 -05:00
* Enter the system setup menu at boot time, then you also have to press additional keys to get to the RAID screen
* create a new virtual disk and assign the new disks, then initialize the VD
2023-01-12 20:12:24 -05:00
## Mounting the new VD
2021-12-31 15:27:07 -05:00
* find the disk with `fdisk -l | grep '^Disk'`
* create a partition table
* `fdisk /dev/sdb`
* `p` to list partition table if any
* `n` to create a new partition
* `w` to write the new partition
* format the new partition with `mkfs.ext4 /dev/sdb1`
* create an access folder, maybe at //mnt/backup
* run the mount `mount /dev/sdb1 /mnt/backup`
* edit fstab by adding
2022-09-22 11:46:29 -04:00
* using device name
```
2021-12-31 15:45:28 -05:00
//dev/sdb1 /mnt/backup ext4 defaults 1 2
2022-09-22 11:46:29 -04:00
```
* using UUID (do `sudo blkid` to get the UUID)
```
UUID="86e81045-a0dc-4881-8ddb-5ef25834ea5a" /datadrive xfs defaults,nofail 1 2
```
2021-12-31 15:45:28 -05:00
* somehow in the process an new systemctl service module is loaded based on fstab at runs at boot
2023-01-16 10:41:14 -05:00
## lvm (logical volume manager)
`vgs` to list volume groups
`vgdisplay` to show all info for a volume group
`lvs` to show logical volumes
Given a logical volume `group` you can extend the size of a `logical volume` inside that group.
```
sudo lvextend -L+100G /dev/ubuntu-vg/ubuntu-lv
```
now if you do `lsblk` the size of the disk has grown but filesystem still needs to be extended as per `df`
use `resize2fs` to expand the file system to take up all the disk space
```
ptrowbridge@usmidsap01:/var/log/postgresql$ sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
resize2fs 1.46.5 (30-Dec-2021)
Filesystem at /dev/ubuntu-vg/ubuntu-lv is mounted on /; on-line resizing required
old_desc_blocks = 13, new_desc_blocks = 25
The filesystem on /dev/ubuntu-vg/ubuntu-lv is now 52428800 (4k) blocks long.
```