トップ «前の日記(2022-07-04(Mon)) 最新 次の日記(2022-07-07(Thu))» 編集

屑俺日記

僕の備忘録(PC、UN*X、ネットワーク関連が中心)なんです。
自分の書いたところは適当(な時とか)に書き換えますので御了承を。


2022-07-06(Wed) 雨はやんでいたが

圧縮したNTFS

ntfs-3gで既に使えているらしいが、試したかどうか 覚えてない。

$ truncate -s 1G ntfs_1g.img
 
$ sudo fdisk ntfs_1g.img
 
Welcome to fdisk (util-linux 2.36.1).
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 0x29867150.
 
Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-2097151, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-2097151, default 2097151):
 
Created a new partition 1 of type 'Linux' and of size 1023 MiB.
 
Command (m for help): t
elected partition 1
Hex code or alias (type L to list all): 7
Changed type of partition 'Linux' to 'HPFS/NTFS/exFAT'.
 
Command (m for help): w
The partition table has been altered.
Syncing disks.

NTFSはこれだけではmkfsできなかった。

$ sudo mkfs -t ntfs -Q -C ntfs_1g.img                         
ntfs_1g.img is not a block device.                                              
Refusing to make a filesystem here!
$ sudo kpartx -av ntfs_1g.img
add map loop0p1 (254:0): 0 2095104 linear 7:0 2048
 
$ ls -l /dev/mapper/
合計 0
crw------- 1 root root 10, 236  7月  6 09:31 control
lrwxrwxrwx 1 root root       7  7月  6 09:31 loop0p1 -> ../dm-0
$ sudo mkfs -t ntfs -C -Q /dev/mapper/loop0p1
Cluster size has been automatically set to 4096 bytes.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
 
$ sudo mount /dev/mapper/loop0p1 /media/win/

あっさりマウントできたので、圧縮がどの程度効いているか 試す。

$ num=1; while:; do dd if=/dev/zero of=${num}.img bs=1M count=1024; done

圧縮が効かなければ(少しはみ出すので)一つも入らないはず。

3時間以上回したが、大した結果にならないので諦めた。

/media/win$ ls | wc -l
37278
 
/media/win$ df -h | sed -n '1p;/win/p'
ファイルシス        サイズ  使用  残り 使用% マウント位置
/dev/mapper/loop0p1  1023M   50M  974M    5% /media/win

ちぐはぐにしてみた

copy random_data

仮想環境のWin11に、追加ディスクをミラーリングでやってみた。
片方をUSB3接続のSSD(のディスクイメージ)、もう片方をClass4のUSBメモリ。

    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/media/temp/inside.img'/>
      <target dev='sdb' bus='sata'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native' discard='unmap'/>
      <source dev='/dev/sdb'/>
      <target dev='sdc' bus='sata'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>

Cドライブからミラーリングに向けて、1GBのランダムデータファイル をコピーしてみた。
その模様を ホスト環境からiostatで追ってみた。

「ちぐはぐ」でない環境からまず試すべきだったのだろうけど。
次は同じUSBメモリ2本、とかで試すか。


リンクはご自由にどうぞ。でもURLや内容が変った場合はあしからず。

index.htmlは ここから。