Yesterday was my first foray into storage management, and I approached the various tools and processes with seeking to better understand the why’s and how it fits in with my current understanding of working with Linux. This morning, I decided to unmount my USB memory stick and try a new process and tool set- whereas yesterday, I used the tried-and-true MBR partition table and fdisk to create ext4 filesystem, mounting the drive onto a newly-created directory, today I decided to add a GPT partition, use gdisk to create the table and the partitions (I created four), and then mount it again.
$ sudo fdisk -l // show mounted drives
$ sudo fdisk /dev/sda // open up fdisk utility pointing to USB memory stick
// used prompt to create new GPT partition table
$ sudo gdisk /dev/sda // open up gdisk utility
// used prompt 'n' to add four partitions, then 'w' to save configuration changes
So, at this point we created a GPT partition table, which allows some flexiblity over MBR, and created four partitions, each of 15000000 bytes (it’s a 32gb drive). Now to build a filesystem, I did that using the following command:
$ sudo mount -t ext4 /dev/sda1 /mnt/usbdrive
I had already created that directory yesterday, so it was ready to received drives ready to be attached to the system. Also, since I had created four partitions, I used the command and modified the sda1 to sda2, then sda3, and finally sda4. Finally, I needed to reload:
$sudo systemctl daemon-reload
oh, and this was important!
$ chmod 755 testDoc.txt
And with that, I was able to save and retrieve data from the mounted filesystems.