-
Notifications
You must be signed in to change notification settings - Fork 0
/
sdcard.txt
44 lines (34 loc) · 1.58 KB
/
sdcard.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
https://developer.ridgerun.com/wiki/index.php/High_performance_SD_card_tuning_using_the_EXT4_file_system
https://www.blogperle.de/raspberry-pi-emergency-mode-and-root-account-locked-mounting-usb-disk-with-fstab/
#Create new FS
#mkfs.ext4 /dev/sda1
#Enable writeback mode.
#Written to the disk before the journal. This mode will typically provide the best ext4 performance
sudo tune2fs -o journal_data_writeback /dev/sda2
#Delete has_journal option
sudo tune2fs -O ^has_journal /dev/sda2
sudo tune2fs -r0 /dev/sda2
sudo fsck -fy /dev/sda2
sudo mkdir /media/flash; sudo chown pi.pi /media/flash; sudo chmod 755 /media/flash
cat << EOF | sudo tee -a /etc/fstab
/dev/sda2 /media/flash ext4 defaults,nofail,x-systemd.device-timeout=5,noatime,nodiratime,data=writeback 0 0
EOF
----------------------------------------------------------------
sudo tune2fs -l /dev/mmcblk0p2 | grep Last\ c
sudo touch /forcefsck
sudo reboot
----------------------------------------------------------------
NTFS
sudo mkdir /media/video; sudo chown pi:pi /media/video; sudo chmod 775 /media/video
sudo apt install -y ntfs-3g
DISK="sdb"
DISK="sda"
PARTNUM=$(sudo parted -m /dev/${DISK} print | grep ntfs | head -n1 | cut -f1 -d:) ; echo ${PARTNUM}
if [ -z "$PARTNUM" ]
then
echo "\$PARTNUM is empty"
else
echo "\$PARTNUM is NOT empty"
NTFSLABEL=$(sudo ntfslabel --no-action /dev/${DISK}${PARTNUM})
echo "LABEL=$NTFSLABEL /media/video ntfs-3g defaults,nofail,x-systemd.device-timeout=5,rw,relatime,user_id=0,group_id=0,allow_other 0 0" | sudo tee -a /etc/fstab
fi