이전 내용을 고려해 보세요.논의하다이 새로운 질문의 배경으로.
내 스크립트를 수정하고 다음을 사용하여 USB 드라이브의 ext4 파티션에 동일한 파일 시스템 옵션을 적용했습니다.2fs 조정, fstab에 지정된 마운트 옵션.
이러한 옵션은 이전에 설명한 것과 동일합니다. 변경 사항을 적용하고 다시 시작했지만산이 명령은 내가 기대했던 것을 보고하지 않았습니다. 즉, 내부 하드 드라이브 파티션이 보고한 것과 유사한 마운트 옵션이 표시된다는 것입니다. 보고 내용은 다음과 같습니다.
/dev/sdc3 on /site/DB005_F1 type ext4 (rw,relatime)
/dev/sdc4 on /site/DB005_F2 type ext4 (rw,relatime)
/dev/sdc5 on /site/DB005_F3 type ext4 (rw,relatime)
/dev/sdc6 on /site/DB005_F4 type ext4 (rw,relatime)
/dev/sdc7 on /site/DB005_F5 type ext4 (rw,relatime)
/dev/sdc8 on /site/DB005_F6 type ext4 (rw,relatime)
/dev/sdc9 on /site/DB005_F7 type ext4 (rw,relatime)
/dev/sdc10 on /site/DB005_F8 type ext4 (rw,relatime)
/dev/sdc11 on /site/DB006_F1 type ext4 (rw,relatime)
/dev/sdc12 on /site/DB006_F2 type ext4 (rw,relatime)
/dev/sdc13 on /site/DB006_F3 type ext4 (rw,relatime)
/dev/sdc14 on /site/DB006_F4 type ext4 (rw,relatime)
/dev/sdc15 on /site/DB006_F5 type ext4 (rw,relatime)
/dev/sdc16 on /site/DB006_F6 type ext4 (rw,relatime)
/dev/sdc17 on /site/DB006_F7 type ext4 (rw,relatime)
/dev/sdc18 on /site/DB006_F8 type ext4 (rw,relatime)
이것들은 모두 동일하게 보고되지만 "rw,relatime"만 보고됩니다. 반면 저는 더 많은 것을 기대했습니다.
완벽한2fs 덤프첫 번째 USB 파티션은 다음과 같이 보고됩니다(다른 모든 파티션과 동일).
root@OasisMega1:/DB001_F2/Oasis/bin# more tuneFS.previous.DB005_F1.20220907-210437.dumpe2fs
dumpe2fs 1.45.5 (07-Jan-2020)
Filesystem volume name: DB005_F1
Last mounted on: <not available>
Filesystem UUID: 11c8fbcc-c1e1-424d-9ffe-ad0ccf480128
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_fi
le dir_nlink extra_isize metadata_csum
Filesystem flags: signed_directory_hash
Default mount options: journal_data user_xattr acl block_validity nodelalloc
Filesystem state: clean
Errors behavior: Remount read-only
Filesystem OS type: Linux
Inode count: 6553600
Block count: 26214400
Reserved block count: 1310720
Free blocks: 25656747
Free inodes: 6553589
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 1017
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8192
Inode blocks per group: 512
Flex block group size: 16
Filesystem created: Sat Nov 7 09:57:44 2020
Last mount time: Wed Sep 7 18:18:32 2022
Last write time: Wed Sep 7 20:55:33 2022
Mount count: 211
Maximum mount count: 10
Last checked: Sun Nov 22 13:50:57 2020
Check interval: 1209600 (2 weeks)
Next check after: Sun Dec 6 13:50:57 2020
Lifetime writes: 1607 MB
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 256
Required extra isize: 32
Desired extra isize: 32
Journal inode: 8
Default directory hash: half_md4
Directory Hash Seed: 802d4ef6-daf4-4f68-b889-435a5ce467c3
Journal backup: inode blocks
Checksum type: crc32c
Checksum: 0x21a24a19
Journal features: journal_checksum_v3
Journal size: 512M
Journal length: 131072
Journal sequence: 0x000000bd
Journal start: 0
Journal checksum type: crc32c
Journal checksum: 0xf0a385eb
왜 이런 일이 일어나는지 아는 사람이 있나요?
내장 하드 드라이브와 USB 하드 드라이브가 동일한 옵션을 보고하도록 할 수 있는 방법이 있습니까?
내 /etc/default/에유충파일에서 나는 현재 다음과 같은 정의를 사용합니다.특이한 점:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash scsi_mod.use_blk_mq=1 usb-storage.quirks=1058:25ee:u ipv6.disable=1"
로깅 및 마운트 옵션이 예상대로 작동하도록 지정해야 하는 또 다른 특징이 있습니까? 아니면 또 다른 건가요?"모든 게 괜찮아"상황은 다른 게시물과 똑같나요?
수정된 스크립트:
#!/bin/sh
####################################################################################
###
### $Id: tuneFS.sh,v 1.3 2022/09/08 03:31:12 root Exp $
###
### Script to set consistent (local/site) preferences for filesystem treatment at boot-time or mounting
###
####################################################################################
TIMESTAMP=`date '+%Y%m%d-%H%M%S' `
BASE=`basename "$0" ".sh" `
###
### These variables will document hard-coded 'mount' preferences for filesystems
###
count=1
BOOT_MAX_INTERVAL="-c 20" ### max number of boots before fsck [20 boots]
TIME_MAX_INTERVAL="-i 2w" ### max calendar time between boots before fsck [2 weeks]
ERROR_ACTION="-e remount-ro" ### what to do if error encountered
#-m reserved-blocks-percentage
###
### This OPTIONS string should be updated manually to document
### the preferred and expected settings to be applied to ext4 filesystems
###
OPTIONS="-o journal_data,block_validity,nodelalloc"
ASSIGN=0
REPORT=0
VERB=0
SINGLE=0
USB=0
while [ $# -gt 0 ]
do
case ${1} in
--default ) REPORT=0 ; ASSIGN=0 ; shift ;;
--report ) REPORT=1 ; ASSIGN=0 ; shift ;;
--force ) REPORT=0 ; ASSIGN=1 ; shift ;;
--verbose ) VERB=1 ; shift ;;
--single ) SINGLE=1 ; shift ;;
--usb ) USB=1 ; shift ;;
* ) echo "\n\t Invalid parameter used on the command line. Valid options: [ --default | --report | --force | --single | --usb | --verbose ] \n Bye!\n" ; exit 1 ;;
esac
done
workHorse()
{
reference=`ls -t1 "${PREF}."*".dumpe2fs" 2>/dev/null | tail -1 `
if [ -n "${reference}" -a -s "${reference}" ]
then
if [ ! -f "${PREF}.dumpe2fs.REFERENCE" ]
then
mv -v ${reference} ${PREF}.dumpe2fs.REFERENCE
fi
fi
reference=`ls -t1 "${PREF}."*".verify" 2>/dev/null | tail -1 `
if [ -n "${reference}" -a -s "${reference}" ]
then
if [ ! -f "${PREF}.verify.REFERENCE" ]
then
mv -v ${reference} ${PREF}.verify.REFERENCE
fi
fi
BACKUP="${BASE}.previous.${PARTITION}.${TIMESTAMP}"
BACKUP="${BASE}.previous.${PARTITION}.${TIMESTAMP}"
rm -f ${PREF}.*.tune2fs
rm -f ${PREF}.*.dumpe2fs
### reporting by 'tune2fs -l' is a subset of that from 'dumpe2fs -h'
if [ ${REPORT} -eq 1 ]
then
### No need to generate report from tune2fs for this mode.
( dumpe2fs -h ${DEVICE} 2>&1 ) | awk '{
if( NR == 1 ){ print $0 } ;
if( index($0,"revision") != 0 ){ print $0 } ;
if( index($0,"mount options") != 0 ){ print $0 } ;
if( index($0,"features") != 0 ){ print $0 } ;
if( index($0,"Filesystem flags") != 0 ){ print $0 } ;
if( index($0,"directory hash") != 0 ){ print $0 } ;
}'>${BACKUP}.dumpe2fs
echo "\n dumpe2fs REPORT [$PARTITION]:"
cat ${BACKUP}.dumpe2fs
else
### Generate report from tune2fs for this mode but only as sanity check.
tune2fs -l ${DEVICE} 2>&1 >${BACKUP}.tune2fs
( dumpe2fs -h ${DEVICE} 2>&1 ) >${BACKUP}.dumpe2fs
if [ ${VERB} -eq 1 ] ; then
echo "\n tune2fs REPORT:"
cat ${BACKUP}.tune2fs
echo "\n dumpe2fs REPORT:"
cat ${BACKUP}.dumpe2fs
fi
if [ ${ASSIGN} -eq 1 ]
then
echo " COMMAND: tune2fs ${COUNTER_SET} ${BOOT_MAX_INTERVAL} ${TIME_MAX_INTERVAL} ${ERROR_ACTION} ${OPTIONS} ${DEVICE} ..."
tune2fs ${COUNTER_SET} ${BOOT_MAX_INTERVAL} ${TIME_MAX_INTERVAL} ${ERROR_ACTION} ${OPTIONS} ${DEVICE}
rm -f ${PREF}.*.verify
( dumpe2fs -h ${DEVICE} 2>&1 ) >${BACKUP}.verify
if [ ${VERB} -eq 1 ] ; then
echo "\n Changes:"
diff ${BACKUP}.dumpe2fs ${BACKUP}.verify
fi
else
if [ ${VERB} -eq 1 ] ; then
echo "\n Differences:"
diff ${BACKUP}.tune2fs ${BACKUP}.dumpe2fs
fi
rm -f ${BACKUP}.verify
fi
fi
}
workPartitions()
{
case ${PARTITION} in
1 ) case ${DISK_ID} in
1 ) DEVICE="/dev/sda3" ; OPTIONS="" ;;
5 ) DEVICE="/dev/sdc3" ;;
6 ) DEVICE="/dev/sdc11" ;;
esac ;;
2 ) case ${DISK_ID} in
1 ) DEVICE="/dev/sda7" ;;
5 ) DEVICE="/dev/sdc4" ;;
6 ) DEVICE="/dev/sdc12" ;;
esac ;;
3 ) case ${DISK_ID} in
1 ) DEVICE="/dev/sda8" ;;
5 ) DEVICE="/dev/sdc5" ;;
6 ) DEVICE="/dev/sdc13" ;;
esac ;;
4 ) case ${DISK_ID} in
1 ) DEVICE="/dev/sda9" ;;
5 ) DEVICE="/dev/sdc6" ;;
6 ) DEVICE="/dev/sdc14" ;;
esac ;;
5 ) case ${DISK_ID} in
1 ) DEVICE="/dev/sda12" ;;
5 ) DEVICE="/dev/sdc7" ;;
6 ) DEVICE="/dev/sdc15" ;;
esac ;;
6 ) case ${DISK_ID} in
1 ) DEVICE="/dev/sda13" ;;
5 ) DEVICE="/dev/sdc8" ;;
6 ) DEVICE="/dev/sdc16" ;;
esac ;;
7 ) case ${DISK_ID} in
1 ) DEVICE="/dev/sda14" ;;
5 ) DEVICE="/dev/sdc9" ;;
6 ) DEVICE="/dev/sdc17" ;;
esac ;;
8 ) case ${DISK_ID} in
1 ) DEVICE="/dev/sda4" ;;
5 ) DEVICE="/dev/sdc10" ;;
6 ) DEVICE="/dev/sdc18" ;;
esac ;;
esac
PARTITION="DB00${DISK_ID}_F${PARTITION}"
PREF="${BASE}.previous.${PARTITION}"
echo "\n\t\t PARTITION = ${PARTITION}"
echo "\t\t DEVICE = ${DEVICE}"
count=`expr ${count} + 1 `
COUNTER_SET="-C ${count}"
workHorse
}
workPartitionGroups()
{
if [ ${SINGLE} -eq 1 ]
then
for PARTITION in `echo ${ID_SET} `
do
echo "\n\t Actions only for DB00${DISK_ID}_F${PARTITION} ? [y|N] => \c" ; read sel
if [ -z "${sel}" ] ; then sel="N" ; fi
case ${sel} in
y* | Y* ) DOIT=1 ; break ;;
* ) DOIT=0 ;;
esac
done
if [ ${DOIT} -eq 1 ]
then
#echo "\t\t PARTITION ID == ${PARTITION} ..."
workPartitions
exit
fi
else
for PARTITION in `echo ${ID_SET} `
do
#echo "\t\t PARTITION ID == ${PARTITION} ..."
workPartitions
done
fi
}
if [ ${USB} -eq 1 ]
then
for DISK_ID in 5 6
do
echo "\n\n DISK ID == ${DISK_ID} ..."
ID_SET="1 2 3 4 5 6 7 8"
workPartitionGroups
done
else
DISK_ID="1"
echo "\n\n DISK ID == ${DISK_ID} ..."
ID_SET="2 3 4 5 6 7 8"
workPartitionGroups
fi
exit 0
exit 0
exit 0
답변1
/etc/fstab
일부 ext4 파일 시스템 옵션은 파일 시스템 구조를 변경해야 하기 때문에 지정된 경우 적용되지 않을 수 있습니다 . 이들 중 일부는 파일 시스템이 마운트 해제될 때 간단히 적용할 수 있지만 일부 옵션은 올바르게 적용하려면 tune2fs
나중에 전체 파일 시스템 검사를 실행해야 할 수도 있습니다 .tune2fs
내가 아는 한, 디스크가 USB를 통해 연결되었는지 여부에 따라 파일 시스템 옵션에 영향을 미치는 메커니즘은 없습니다.