How to Mount and Manage Disk Partitions in Linux
Linux provides powerful tools for managing disk partitions, allowing users to create, format, mount, and unmount partitions as needed. Understanding these basics is essential for efficient disk management. This guide will walk you through mounting and managing disk partitions in Linux.
1. Listing Available Disks and Partitions
Before mounting a partition, you need to identify it. Use the following commands:
- List all disks and partitions:
lsblk
- View detailed information about a disk:
sudo fdisk -l
- Check partition UUIDs:
blkid
2. Mounting a Partition
To mount a partition, follow these steps:
- Create a Mount Point:
sudo mkdir -p /mnt/mydrive
- Mount the Partition:
sudo mount /dev/sdXn /mnt/mydrive
Replace
/dev/sdXn
with the actual partition name (e.g.,/dev/sdb1
). - Verify the Mounting:
df -h
3. Automounting Partitions at Boot
To ensure a partition mounts automatically at boot, add it to /etc/fstab
.
- Get the UUID of the partition:
blkid
- Open
/etc/fstab
for editing:sudo nano /etc/fstab
- Add a new entry in this format:
UUID=your-uuid /mnt/mydrive ext4 defaults 0 2
Replace
your-uuid
with the actual UUID and adjust the filesystem type if necessary. - Apply the changes without rebooting:
sudo mount -a
4. Unmounting a Partition
To unmount a partition:
sudo umount /mnt/mydrive
If the partition is busy, you may force unmount:
sudo umount -l /mnt/mydrive
5. Formatting a Partition
To format a partition, choose a filesystem type:
- Format as ext4:
sudo mkfs.ext4 /dev/sdXn
- Format as NTFS (for Windows compatibility):
sudo mkfs.ntfs /dev/sdXn
How to Monitor System Performance Using htop and atop (F.A.Q)
What is the difference between htop and atop?
htop
focuses on real-time interactive monitoring, whereas atop
provides system-wide logging and resource tracking over time.
Can I use htop and atop on remote servers?
Yes, both tools can be used via SSH to monitor remote servers.
How do I filter processes in htop?
Press F3
to search for a process or F6
to sort by resource usage.
0 Comments