Saturday, November 8, 2025

Configure New SAS Drive

Configure New SAS Drive

https://www.linux.com/learn/intro-to-linux/2017/3/how-format-storage-devices-linux
https://www.certdepot.net/rhel7-create-delete-partitions/


https://askubuntu.com/questions/154180/how-to-mount-a-new-drive-on-startup

First of all your /dev/sdb isn't partitioned. I am assuming this is the disk you want to mount.

WARNING: THIS WILL DESTROY ANY DATA ON YOUR TARGET DISK


Run sudo fdisk /dev/sdb
  1. Press O and press Enter (creates a new table)
  2. Press N and press Enter (creates a new partition)
  3. Press P and press Enter (makes a primary partition)
  4. Then press 1 and press Enter (creates it as the 1st partition)
  5. Finally, press W (this will write any changes to disk)

Okay now you have a partition, now you need a filesystem.
  1. Run sudo mkfs.ext4 /dev/sdb1
  2. Now you can add it to fstab
    You need to add it to /etc/fstab use your favourite text editor
    Be careful with this file as it can quite easily cause your system not to boot.
    Add a line for the drive, the format would look like this.
    This assumes the partition is formatted as ext4 as per mkfs above
    #device        mountpoint             fstype    options  dump   fsck
    
    /dev/sdb1    /home/yourname/mydata    ext4    defaults    0    1
    

Then on the next reboot it will auto mount.

Simple steps to make kernel module

## Steps to create kernel module

1. Prepare source file in *.c, eg. simplemodule.c
2. Prepare Makefile for compile the source file, type "echo obj-m := simplemodule.o > Makefile"
3. Compile execution, "make -C /lib/modules/`uname -r`/build M=$PWD modules
4. Load module, "insmod ./simplemodule.ko"
5. Remove module, "rmmod simplemodule"
6. Check on the kernel module loaded and remove messages, "dmesg | tail"