Linux

更改 HFS+ 文件系統上的文件權限

  • September 5, 2018

我執行命令fdisk -l找出我的外部驅動器的格式,我發現它使用 GPT 分區並且文件系統是 HFS+。

當我嘗試在外部驅動器上創建一個新文件夾時,我收到以下消息:

chmod: changing permissions of 'file_name/': Read-only file system

如果我執行mount這是輸出:

/dev/sda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=dev)
/dev/sdc2 on /media/dev/andre backup type hfsplus (ro,nosuid,nodev,uhelper=udisks2)
/dev/sde2 on /media/dev/andre_clients type hfsplus (ro,nosuid,nodev,uhelper=udisks2)

所以現在我執行umount /dev/sde2並拔下設備,然後重新連接設備並執行命令dmesg | tail並獲取此資訊:

[429154.613747] sd 14:0:0:0: [sde] Assuming drive cache: write through
[429154.615995] sd 14:0:0:0: [sde] Test WP failed, assume Write Enabled
[429154.616993] sd 14:0:0:0: [sde] Asking for cache data failed
[429154.616997] sd 14:0:0:0: [sde] Assuming drive cache: write through
[429154.669277]  sde: sde1 sde2
[429154.671369] sd 14:0:0:0: [sde] Test WP failed, assume Write Enabled
[429154.672742] sd 14:0:0:0: [sde] Asking for cache data failed
[429154.672747] sd 14:0:0:0: [sde] Assuming drive cache: write through
[429154.672751] sd 14:0:0:0: [sde] Attached SCSI disk
[429157.047244] hfsplus: write access to a journaled filesystem is not supported, use the force option at your own risk, mounting read-only.

sudo mount -o remount,rw /dev/sde2 /media/dev/andre_clients現在在不失去任何資訊的情況下執行是否安全?

筆記:

似乎您需要將 hfsplus 安裝為寫入/讀取,這有點問題,因為它是日誌功能。

但是,您可以將其安裝為寫/讀,如此此處所示。


根據最後一行括號中的標誌,問題是/dev/sde2只讀安裝:ro

/media/dev/andre_clients 上的 /dev/sde2 類型 hfsplus ( ro ,nosuid,nodev,uhelper=udisks2)

因此,您無法更改此磁碟上的任何內容。

重新掛載為 read+write rw

sudo mount -o remount,rw /partition/identifier /mount/point

在你的情況下:

sudo mount -o remount,rw /dev/sde2 /media/dev/andre_clients

但是,在您這樣做之前,請確保使用 掛載正確的分區標識符dmesg | tail,例如:

[25341.272519] scsi 2:0:0:0: Direct-Access     [...]
[25341.273201] sd 2:0:0:0: Attached scsi generic sg1 type 0
[25341.284054] sd 2:0:0:0: [sde] Attached SCSI removable disk
             [...]
[25343.681773]  sde: sde2

最近的sdX: sdXX一行提示您使用哪個分區標識符(那個sdXX)來辨識您的設備連接。

您還可以通過以下方式檢查您的設備連接到哪個開發設備

ll /dev/disk/by-id/

將為您提供設備及其分區的所有符號連結:

lrwxrwxrwx 1 root root   9 Jul 22 16:02 usb-manufacturername_*serialnumber* -> ../../sdb
lrwxrwxrwx 1 root root  10 Jul 22 16:02 usb-manufacturername_*serialnumber*-part1 -> ../../sdb1

引用自:https://unix.stackexchange.com/questions/145922