Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Mounting and Using External Storage Devices on Linux Servers

Tech 4

Mounting External Storage

1. Load the Required Kernel Module

Log in to you're Linux server with root privileges or use sudo. Load the USB storage kernel module to enable the system to recognize external devices.

modprobe usb-storage

2. Identify the Connected Device

Use the fdisk command to list all storage devices and partitions detected by the system.

fdisk -l

Examine the output to locate you're external drive. It will typically appear as /dev/sdb or similar. Important: You mount a specific partition (e.g., /dev/sdb1) rather than the entire disk device (/dev/sdb).

3. Create a Mount Point and Mount the Device

Create a directory to serve as the mount point within the /mnt directory.

mkdir /mnt/external_drive

Mount the desired partition to this newly created directory.

mount /dev/sdb1 /mnt/external_drive

4. Access the Device's Contents

Once mounted, you can navigate to /mnt/external_drive to read from or write to the external storage using standard file operations.

5. Safely Unmount the Device

Before physically disconnecting the drive, you must unmount it to ensure all data is written and to prevent filesystem corruption.

umount /mnt/external_drive

Alternatively, you can specify the device path:

umount /dev/sdb1

Wait for the command to complete before removing the device.

Key Considerations

  1. Filesystem Compatibility for Data Transfer: For basic file transfers, common filesystems like NTFS or exFAT are generally acceptable. Ubuntu and other Debian-based distributions typically handle these natively. For Red Hat-based systems like CentOS, you may need to install additional packages (e.g., ntfs-3g for NTFS). When mountign, you can explicitly specify the filesystem type:

    mount -t ntfs-3g /dev/sdb1 /mnt/external_drive
    
  2. Filesystem Choice for System Backups: For critical operations like system backups, using a native Linux filesystem such as ext4 is recommended. It offers journaling for data integrity, supports large files and volumes, and provides optimal performance and recovery on Linux systems.

    You can format a partition to ext4 using the mkfs.ext4 command. Crucial: Ensure the target partition is not mounted before formatting.

    # First, unmount the partition if it is mounted
    umount /dev/sdb1
    
    # Then, format it to ext4
    mkfs.ext4 /dev/sdb1
    

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.