如何解除FreeAgent GoFlex Drive外接硬盘只读权限(树莓派3)
Alright, let's work through this problem—since formatting isn't an option (smart move keeping your existing data!), we'll focus on fixing the mount permissions and file system driver issues that are blocking write access. Here's a step-by-step breakdown:
Step 1: Identify Your Drive's Details
First, we need to confirm exactly which device your GoFlex Drive is using and what file system it's formatted with. Run these commands in the terminal:
- List all storage devices to find your drive:
lsblk
Look for a device matching your drive's size (e.g.,/dev/sda1for the first partition on the external drive). - Check the file system type:
blkid /dev/sda1(replace/dev/sda1with your actual device path)
You'll likely see eitherTYPE="ntfs"orTYPE="vfat"(FAT32) since GoFlex drives often use these.
Step 2: Install the Correct Driver (For NTFS)
Raspberry Pi OS doesn't include NTFS write support by default. If your drive is NTFS, install the ntfs-3g driver first:
sudo apt update && sudo apt install ntfs-3g
This lets Linux properly read and write to NTFS partitions.
Step 3: Remount the Drive with Write Permissions
First, unmount the drive if it's currently mounted (replace /mnt/goflex with your actual mount point—you can find this via df -h):
sudo umount /mnt/goflex
For NTFS Drives
Remount with permissions granted to the pi user:
sudo mount -t ntfs-3g /dev/sda1 /mnt/goflex -o rw,uid=pi,gid=pi
rw: Enables read-write accessuid=pi/gid=pi: Sets thepiuser as the owner of the mounted drive, so you can write to it without root.
For FAT32 (vfat) Drives
Remount with read-write permissions and proper umask settings:
sudo mount -t vfat /dev/sda1 /mnt/goflex -o rw,uid=pi,gid=pi,umask=002
umask=002: Gives read/write access to your user and group, read access to others (a safer default than000which opens it to everyone).
Step 4: Set Up Auto-Mount on Boot (Optional but Recommended)
To avoid remounting every time you restart your Pi, add the drive to /etc/fstab. First, get your drive's UUID (more reliable than /dev/sda1, which can change):
blkid /dev/sda1
Copy the UUID string (looks like XXXX-XXXX for FAT32 or XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX for NTFS).
Open the fstab file for editing:
sudo nano /etc/fstab
Add one of these lines at the bottom (replace the UUID, mount point, and options with your details):
- For NTFS:
UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX /mnt/goflex ntfs-3g rw,uid=pi,gid=pi,defaults 0 0 - For FAT32:
UUID=XXXX-XXXX /mnt/goflex vfat rw,uid=pi,gid=pi,umask=002,defaults 0 0
Save and exit nano (Ctrl+O, Enter, Ctrl+X), then test the setup with:
sudo mount -a
If no errors pop up, the drive will auto-mount with write permissions on boot.
Key Note About Permissions
If you tried using chmod or chown on the drive and got errors, that's normal—NTFS and FAT32 don't support Linux's native permission system. All access controls are handled through the mount options we set above, so you don't need to run those commands on the drive itself.
内容的提问来源于stack exchange,提问作者matsuo_basho

