Difference between revisions of "Creating and Managing Filesystems"
(Created page with "=== Partitioning === Each main storage device can be broken into a total of 4 primary partitions. If you had a device named '''sda''' you could partition it 4 times by means o...") |
(No difference)
|
Latest revision as of 22:21, 24 June 2020
Partitioning
Each main storage device can be broken into a total of 4 primary partitions. If you had a device named sda you could partition it 4 times by means of primary partitioning. If you needed more then 4 partitions you could sacrifice 1 of your 4 primary partitions as an extended partition and create more partitions there called logical partitions.
The fdisk command can be used to create partitions on a storage device. By running fdisk you can utilize an interact prompt to create a new partition on the drive. Once the new partition is created you will use the mkfs command to create a filesystem on this partition, and then the mount command to mount the device.
Example:
sudo fdisk /dev/sda
- n (new partiton)
- p (primary partition)
- 1 (partition number)
- set first sector (default)
- set last sector (default, or use +/-size{K,M,G,T,P})
- w (to write changes)
- w (to quit)
Filesystem
Once you have created your partitions you can now create a filesystem on that partition. Use the mkfs system to create a filesystem. Some of the types of filesystems you can write include ext2, ext3, ext4, fat, etc.
Example:
sudo mkfs -t ext4 /dev/sda1
Mounting and Unmounting
Now that you have successfully created a partition and have written a filesystem to it you can now mount the filesystem with the mount command.
Example:
sudo mount /dev/sda1 /mnt/newA1