背景:
之前使用的移動(dòng)硬盤是NTFS格式的,如果格式化成FAT32又不支持4GB以上的文件大小匪蟀。
so椎麦,就找了下mac文件系統(tǒng)相關(guān)的文章,發(fā)現(xiàn)mac原生是支持NTFS格式的材彪,只是由于和微軟死逼對NTFS文件系統(tǒng)的寫操作做了隱藏观挎,那就好辦了,直接用shell腳本掛載硬盤為讀寫即可段化,原生的系統(tǒng)畢竟比第三方軟件方便便捷嘁捷,關(guān)鍵是還穩(wěn)定免費(fèi)。
掛載思路:
1显熏、使用umount命令卸載/Volumes/ 目錄下掛載的NTFS硬盤雄嚣;
2、重新以可讀寫的方式掛載硬盤到/Volumes/目錄下;
3缓升、在桌面上創(chuàng)建NTFS硬盤的快捷訪問軟連接鼓鲁;
卸載思路:
1、卸載/Volumes/目錄下的NTFS硬盤港谊;
2骇吭、清除桌面上無效的NTFS硬盤軟連接;
------------------------------我是分割線-----------------------------------------
接下來就是上腳本了
掛在腳本:
#!/bin/sh
mount | grep ntfs | grep read-only | awk '{print $1,$3}' | while read a b
do
echo a=$a b=$b
# echo $a
sudo umount $b
sudo mkdir $b
sudo mount -t ntfs -o rw,auto,nobrowse $a $b
fileName3=`basename $b`
echo fileName3=$fileName3
sudo ln -s $b ~/Desktop/${fileName3}_ntfs
done
卸載腳本:
#!/bin/sh
ls -al ~/Desktop/ | grep '\-> /Volumes/' | awk '{print $9,$11}' | while read a b
do
echo a=$a b=$b
if [ -d "$b" ]; then
echo 'path:' $b 'exists'
echo 'will umount path:' $b
sudo umount $b
fi
done
echo 'umount this path ntfs ln done'
echo 'will clear ntfs ln in this path'
ls -al ~/Desktop/ | grep '\-> /Volumes/' | awk '{print $9,$11}' | while read a b
do
echo a=$a b=$b
if [ -d "$b" ]; then
echo 'path:' $b 'exists'
fi
if [ ! -d "$b" ]; then
echo 'path:' $b 'not exists'
echo 'will remove not exists path:' $b
rm ~/Desktop/${a}
fi
done
echo 'clear ntfs ln done'