2019年11月25日月曜日

解析用Linux機のRAM, ROM 増設

普段使用しているLinux機に少しだけRAMとROMを増設した。ROMはかねてからSSD上でランを行いたいと考えていたこともあり、SSD2Tbを増設、解析中のデータを置くための場所にした。解析終了した結果などは、前に増設した6TbのHDDの方に移すことにしようと思う。RAMの方は、16Gbを16枚刺して256Gbとした。時たまだけれどメモリ不足が理由でランが不正終了してしまうことがあったので、その対策として増設した。多分、手元に置いておくコンピュータとしては十分な性能になったと思うし、大抵のことはここでできるのではないかと思う。

(1) 増設作業


今回増設ぶんのWD BLUE SATA SSD 2Tb 。


電源変換ケーブルは、前回HDD増設時に購入したものと同じものを用意した。



増設するSSDは2.5インチサイズなので、HDDの増設場所に設置できるように、マウンタも用意した。中には固定用のネジも付属していた。


マウンタにネジで止めて、HDD用の3.5インチベイに固定した。


 下が、3.5インチベイに載せたところ。裏側にネジ止めできるところがなく、ピンを合わせているだけになっている。

 これを増設用の最後のスペースにセットした。SATAケーブルと電源ケーブルを差し込み、こちらの設置は完了した。



 メモリも少しだが増設した。今回増設に使ったのは、下の16Gbのメモリ。


 取り付けのために外したCPUファンなどを取り付けていき、タイラップでケーブルを整理して、増設は終了した。


(2) SSDパーティション、ext4フォーマット、マウント

 gdiskを使って、パーティションを切る作業を行う。 デバイスがsddとして認識されていることを確認後、sudoでgdiskを使う。

> sudo gdisk /dev/sdd

 GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.

Command (? for help): p
Disk /dev/sdd: 3907029168 sectors, 1.8 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 17DED95E-5EFC-47ED-A30A-BE7B0C4FA7B3
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 3907029134
Partitions will be aligned on 2048-sector boundaries
Total free space is 3907029101 sectors (1.8 TiB)

Number  Start (sector)    End (sector)  Size       Code  Name

Command (? for help): n
Partition number (1-128, default 1): 1
First sector (34-3907029134, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-3907029134, default = 3907029134) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'

Command (? for help): p
Disk /dev/sdd: 3907029168 sectors, 1.8 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 17DED95E-5EFC-47ED-A30A-BE7B0C4FA7B3
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 3907029134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048      3907029134   1.8 TiB     8300  Linux filesystem

Command (? for help):  w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sdd.
The operation has completed successfully.



パーティションが作成できたら、ext4のファイルシステムでフォーマットする。

> sudo mkfs.ext4 /dev/sdd1

[sudo] password for t:
mke2fs 1.41.12 (17-May-2010)
Discarding device blocks: done                           
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
122101760 inodes, 488378385 blocks
24418919 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
14905 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848

Writing inode tables: done                           
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.


その後、マウントが自動的に行われるように、/etc/fstabファイルを編集する。はじめに、増設したssdのUUIDを調べる。uuidがわかったら、以前に増設されている時のフォーマットを真似て、UUIDを書き足す。

> ls -l /dev/disk/by-uuid/

マウントするディレクトリを作る。
> sudo mkdir /home2

uuidがわかったら、エディタで/etc/fstabを開き、末尾に以下を追加。

UUID=9ac........(調べたUUID) /home2(マウント場所)                  ext4(フォーマット)    defaults        1 2

 ここまで終わったら再起動する。再起動後はマウントされた状態になっている。

(3) メモリ増設確認


増設されたメモリがきちんと認識されているか以下のコマンドで確認する。

> sudo dmidecode --type memory


(4) テストラン


以前、メモリ不足が原因と考えられるエラーで最後までランできなかったpilonのコマンドを打って、今回正常にランできるかを確認してみる。

> ls -lh

合計 23G
-rw-rw-r--. 1 t t  23G 11月 25 16:30 2019 aln_jump_pe.sorted.bam
-rw-rw-r--. 1 t t 680K 11月 25 16:28 2019 aln_jump_pe.sorted.bam.bai
-rw-rw-r--. 1 t t 188M 11月 25 16:28 2019 m16032.contigs.fasta

-rw-rw-r--. 1 t t 7.1M 11月 25 16:28 2019 pilon-1.23.jar
drwxrwxr-x. 2 t t 4.0K 11月 25 16:28 2019 results_dir
-rwxr-xr-x. 1 t t 3.0K 11月 25 17:09 2019 run190330_2_pilon_test1_rerun191125.sh


# 実行スクリプト
java -Xmx192G -jar ./pilon-1.23.jar --genome m16032.contigs.fasta \

        --bam ./aln_jump_pe.sorted.bam \
        --output test_pilon --outdir results_dir --changes --vcf --tracks \
        --verbose


 timeにより時間を計りながらランを行なった。ランは増設したSSD上にデータを置いて行ったが、非常に静かで驚いている。メモリ使用量を確認してみたところ、ランからしばらく経った時点で100Gbを超えていた。その後も順調に増大していっている感じだ。

> top

top - 18:29:54 up  3:31,  2 users,  load average: 1.36, 1.30, 1.21
Tasks: 736 total,   2 running, 734 sleeping,   0 stopped,   0 zombie
Cpu(s):  3.2%us,  0.3%sy,  0.0%ni, 96.5%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  264420640k total, 122277664k used, 142142976k free,   217416k buffers
Swap: 16449532k total,        0k used, 16449532k free, 48035036k cached


以前はこの段階でランが強制的に終了してしまっていたが、今回は問題なく進行しているよう。

(2019.11.26 AM 追記)
次の日きたら解析は無事に終了していた。さすがにこれだけ増設したらメモリ不足による終了はしなくなったみたいだ。