この文書の現在のバージョンと選択したバージョンの差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
linux:filesystem [2020/01/19 03:05] matoken |
linux:filesystem [2020/02/21 00:04] (現在) matoken [FAT32のディレクトリ内ファイル数制限を確認する] |
||
---|---|---|---|
ライン 4: | ライン 4: | ||
## tips | ## tips | ||
+ | |||
+ | ### FAT32のディレクトリ内ファイル数制限によりrsyncコマンドがストールする | ||
+ | |||
+ | NTFSからFAT32にrsyncでデータをコピーしていると途中で停止していた. | ||
+ | エラーは出ておらずlogを見ると処理が止まってから7時間以上経過していた | ||
+ | CTRL+Cで止めると `No space left on device` というエラー. | ||
+ | |||
+ | このとき対象のコピー先ディレクトリにtouchすると `No space left on device` になった. | ||
+ | |||
+ | ``` | ||
+ | $ touch hogehoge | ||
+ | touch: cannot touch 'hogehoge': No space left on device | ||
+ | ``` | ||
+ | |||
+ | ファイル数は 32632 | ||
+ | ``` | ||
+ | $ ls -A1 .|wc -l | ||
+ | 32632 | ||
+ | ``` | ||
+ | |||
+ | 恐らく同一ディレクトリ内へのファイル数制限 | ||
+ | この後同じ状態になったときは `10926, 13107, 13105` ファイル名長により変わるよう. | ||
+ | |||
+ | rsyncが何も言わずに止まってしまうのは困る. `--timeout=30` を指定してみたところ該当ディレクトリでエラーになるようになった.`No space left on device (28)` | ||
+ | |||
+ | ``` | ||
+ | --timeout=SECONDS set I/O timeout in seconds | ||
+ | ``` | ||
+ | |||
+ | このエラーが出たディレクトリを `--exclude` に指定して除外し,個別対応とした.( `$ cd exclude_path && zip -9 /backupdir/archive.zip ./*` ) | ||
+ | |||
+ | てことでこんな感じに | ||
+ | |||
+ | ``` | ||
+ | $ rsync -avvc --modify-window=1 --timeout=30 --log-file=rsync.log --exclude '除外1' --exclude '除外2' コピー元 コピー先 | ||
+ | ``` | ||
+ | |||
+ | `--modify-window=1` はFAT32のタイムスタンプ制限(2秒単位)のため. | ||
+ | |||
+ | |||
+ | * [linux \- How can I use rsync with a FAT file system? \- Server Fault](https://serverfault.com/questions/54949/how-can-i-use-rsync-with-a-fat-file-system/144475) | ||
+ | |||
+ | |||
+ | ### FAT32のディレクトリ内ファイル数制限を確認する | ||
+ | |||
+ | 最大`65535` 個でファイル名長が長くなると少なくなるのを確認した. | ||
+ | |||
+ | |||
+ | |||
+ | まずは適当なFAT32領域を用意する | ||
+ | |||
+ | ``` | ||
+ | $ dd if=/dev/zero of=./FAT32_1GB.img bs=1M count=1000 | ||
+ | 1000+0 records in | ||
+ | 1000+0 records out | ||
+ | 1048576000 bytes (1.0 GB, 1000 MiB) copied, 0.556993 s, 1.9 GB/s | ||
+ | $ fdisk ./FAT32_1GB.img | ||
+ | |||
+ | Welcome to fdisk (util-linux 2.34). | ||
+ | Changes will remain in memory only, until you decide to write them. | ||
+ | Be careful before using the write command. | ||
+ | |||
+ | Device does not contain a recognized partition table. | ||
+ | Created a new DOS disklabel with disk identifier 0xa1d801ca. | ||
+ | |||
+ | Command (m for help): n | ||
+ | Partition type | ||
+ | p primary (0 primary, 0 extended, 4 free) | ||
+ | e extended (container for logical partitions) | ||
+ | Select (default p): | ||
+ | |||
+ | Using default response p. | ||
+ | Partition number (1-4, default 1): | ||
+ | First sector (2048-2047999, default 2048): | ||
+ | Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-2047999, default 2047999): | ||
+ | |||
+ | Created a new partition 1 of type 'Linux' and of size 999 MiB. | ||
+ | |||
+ | Command (m for help): t | ||
+ | |||
+ | Selected partition 1 | ||
+ | Hex code (type L to list all codes): L | ||
+ | |||
+ | 0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris | ||
+ | 1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT- | ||
+ | 2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT- | ||
+ | 3 XENIX usr 3c PartitionMagic 84 OS/2 hidden or c6 DRDOS/sec (FAT- | ||
+ | 4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx | ||
+ | 5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data | ||
+ | 6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / . | ||
+ | 7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility | ||
+ | 8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt | ||
+ | 9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access | ||
+ | a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O | ||
+ | b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor | ||
+ | c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi ea Rufus alignment | ||
+ | e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD eb BeOS fs | ||
+ | f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ee GPT | ||
+ | 10 OPUS 55 EZ-Drive a7 NeXTSTEP ef EFI (FAT-12/16/ | ||
+ | 11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f0 Linux/PA-RISC b | ||
+ | 12 Compaq diagnost 5c Priam Edisk a9 NetBSD f1 SpeedStor | ||
+ | 14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f4 SpeedStor | ||
+ | 16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ f2 DOS secondary | ||
+ | 17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fb VMware VMFS | ||
+ | 18 AST SmartSleep 65 Novell Netware b8 BSDI swap fc VMware VMKCORE | ||
+ | 1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fd Linux raid auto | ||
+ | 1c Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L fe LANstep | ||
+ | 1e Hidden W95 FAT1 80 Old Minix be Solaris boot ff BBT | ||
+ | Hex code (type L to list all codes): b | ||
+ | Changed type of partition 'Linux' to 'W95 FAT32'. | ||
+ | |||
+ | Command (m for help): p | ||
+ | Disk ./FAT32_1GB.img: 1000 MiB, 1048576000 bytes, 2048000 sectors | ||
+ | Units: sectors of 1 * 512 = 512 bytes | ||
+ | Sector size (logical/physical): 512 bytes / 512 bytes | ||
+ | I/O size (minimum/optimal): 512 bytes / 512 bytes | ||
+ | Disklabel type: dos | ||
+ | Disk identifier: 0xa1d801ca | ||
+ | |||
+ | Device Boot Start End Sectors Size Id Type | ||
+ | ./FAT32_1GB.img1 2048 2047999 2045952 999M b W95 FAT32 | ||
+ | |||
+ | Command (m for help): w | ||
+ | The partition table has been altered. | ||
+ | Syncing disks. | ||
+ | |||
+ | $ mkfs.vfat ./FAT32_1GB.img | ||
+ | mkfs.fat 4.1 (2017-01-24) | ||
+ | $ mkdir fat32 | ||
+ | $ sudo mount -o loop,uid=`id -u` ./FAT32_1GB.img ./fat32 | ||
+ | $ mount |grep fat32 | ||
+ | /home/matoken/tmp/FAT32_1GB.img on /home/matoken/tmp/fat32 type vfat (rw,relatime,uid=1000,fmask=0022,dmask=0022,codepage=437,iochars | ||
+ | et=ascii,shortname=mixed,utf8,errors=remount-ro) | ||
+ | $ cd fat32 | ||
+ | ``` | ||
+ | |||
+ | サブディレクトリを掘ってファイルを沢山作ってみる | ||
+ | 1~5文字のファイル名長だと `./..` を合わせて `65535` 迄作れる | ||
+ | |||
+ | ``` | ||
+ | $ mkdir dir1 | ||
+ | $ cd dir1 | ||
+ | $ n=1;while :;do if ! touch ${n};then echo ${n} ;break;fi ;n=$(( n + 1 ));done | ||
+ | touch: cannot touch '65534': No space left on device | ||
+ | 65534 | ||
+ | $ ls -1A|wc -l | ||
+ | 65533 | ||
+ | $ ls -1a|wc -l | ||
+ | 65535 | ||
+ | ``` | ||
+ | |||
+ | 別のディレクトリで長いファイル名長で試す. | ||
+ | 255文字のファイル名長だと `./..` を合わせて3123個までだった | ||
+ | |||
+ | ``` | ||
+ | $ n=1;while :;do if ! touch `printf %0255d ${n}`;then echo ${n} ;break;fi ;n=$(( n + 1 ));done | ||
+ | touch: cannot touch '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003121': No space left on device | ||
+ | 3121 | ||
+ | $ ls -lA|wc -l | ||
+ | 3121 | ||
+ | $ ls -la|wc -l | ||
+ | 3123 | ||
+ | ``` | ||
### 日本語ファイル名が長すぎて処理に失敗する | ### 日本語ファイル名が長すぎて処理に失敗する |