1383 文字
7 分
Ubuntu 19にてLVMでディスクを追加
新規にディスクをぶっ刺した上で、OS上で認識されているディスクのラベルを探します
root@dell ~/a/storcli_all_os# fdisk -lDisk /dev/loop0: 54.9 MiB, 57532416 bytes, 112368 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop1: 89.1 MiB, 93417472 bytes, 182456 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop2: 89.1 MiB, 93429760 bytes, 182480 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 836.6 GiB, 898319253504 bytes, 1754529792 sectorsDisk model: RAID 5/6 SAS 6GUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisklabel type: gptDisk identifier: A0B1AE4D-C4FF-4FDB-90F1-53AD283B479A
Device Start End Sectors Size Type/dev/sda1 2048 1050623 1048576 512M EFI System/dev/sda2 1050624 2549759 1499136 732M Linux filesystem/dev/sda3 2549760 1754527743 1751977984 835.4G Linux LVM
Disk /dev/sdb: 1.8 TiB, 1999844147200 bytes, 3905945600 sectorsDisk model: RAID 5/6 SAS 6GUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/dell--vg-root: 834.5 GiB, 895974637568 bytes, 1749950464 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/dell--vg-swap_1: 976 MiB, 1023410176 bytes, 1998848 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytes新しく追加したディスクは、容量から察するに/dev/sdbということがわかります。Disk model: RAID 5/6 SAS 6Gと書いてある理由は謎です。Raid1のはずですが。しかも、OSには隠蔽されているはずなのに。一元的にRaidコントローラが表示してしまっているだけなのかもしれません。
partedでパーティションを切っておきます。
パーティション単位ではなく、ディスク自体をPhysical Volumeとして追加できるのですが、ぶっ壊れたときに復元しやすくなるはずなので、パーティションを作ります。
root@dell ~/a/storcli_all_os# parted /dev/sdbGNU Parted 3.2Using /dev/sdbWelcome to GNU Parted! Type 'help' to view a list of commands.(parted) mkpart primary 0Error: /dev/sdb: unrecognised disk label(parted) help align-check TYPE N check partition N for TYPE(min|opt) alignment help [COMMAND] print general help, or help on COMMAND mklabel,mktable LABEL-TYPE create a new disklabel (partition table) mkpart PART-TYPE [FS-TYPE] START END make a partition name NUMBER NAME name partition NUMBER as NAME print [devices|free|list,all|NUMBER] display the partition table, available devices, free space, all found partitions, or a particular partition quit exit program rescue START END rescue a lost partition near START and END resizepart NUMBER END resize partition NUMBER rm NUMBER delete partition NUMBER select DEVICE choose the device to edit disk_set FLAG STATE change the FLAG on selected device disk_toggle [FLAG] toggle the state of FLAG on selected device set NUMBER FLAG STATE change the FLAG on partition NUMBER toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER unit UNIT set the default unit to UNIT version display the version number and copyright information of GNU Parted(parted)Ubuntu 19で作られるVGはGPT対応で作られているようなので、新しいディスクもGPT対応にしておきます。
(parted) mklabel gptでは、パーティションを作成します。パーセントで表記したほうが確実です。
(parted) mkpartPartition name? []?File system type? [ext2]?Start? 0%End? 100%(parted) pModel: LSI RAID 5/6 SAS 6G (scsi)Disk /dev/sdb: 1999844MBSector size (logical/physical): 512B/4096BPartition Table: gptDisk Flags:
Number Start End Size File system Name Flags 1 1.05MB 1999843MB 1999842MB ext2
(parted)物理ディスクは準備できたので、次はLVMの設定。まず、Phisical Volumeを作ります。
root@dell ~/a/storcli_all_os# pvcreate /dev/sdb1WARNING: ext4 signature detected on /dev/sdb1 at offset 1080. Wipe it? [y/n]: y Wiping ext4 signature on /dev/sdb1. Physical volume "/dev/sdb1" successfully created.root@dell ~/a/storcli_all_os# pvs PV VG Fmt Attr PSize PFree /dev/sda3 dell-vg lvm2 a-- <835.41g 12.00m /dev/sdb1 lvm2 --- <1.82t <1.82t次に、Logical Volumeを作ります。
root@dell ~/a/storcli_all_os# vgcreate data-vg /dev/sdb1 Volume group "data-vg" successfully createdroot@dell ~/a/storcli_all_os# vgdisplay --- Volume group --- VG Name dell-vg System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size <835.41 GiB PE Size 4.00 MiB Total PE 213864 Alloc PE / Size 213861 / 835.39 GiB Free PE / Size 3 / 12.00 MiB VG UUID jqTTRM-hZOZ-uT9x-9ke5-bAuw-78dI-RI3xZf
--- Volume group --- VG Name data-vg System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size <1.82 TiB PE Size 4.00 MiB Total PE 476799 Alloc PE / Size 0 / 0 Free PE / Size 476799 / <1.82 TiB VG UUID NUtldx-SilL-6GHG-9eAZ-5rdN-oPxr-6XlhmKLogical Volumeを作ります。
# lvcreate -n data -l 100%FREE data-vg次に、フォーマット。他のパーティションがext4なので、それに続きます。
root@dell ~/a/storcli_all_os# mkfs.ext4 /dev/data-vg/datamke2fs 1.44.6 (5-Mar-2019)Creating filesystem with 488242176 4k blocks and 122060800 inodesFilesystem UUID: eb6cb760-73e3-4fd0-8453-66383c3ac4b9Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000, 214990848
Allocating group tables: doneWriting inode tables: doneCreating journal (262144 blocks): doneWriting superblocks and filesystem accounting information: done
root@dell ~/a/storcli_all_os# mkdir /mnt/dataroot@dell ~/a/storcli_all_os# mount /dev/data-vg/data /mnt/dataroot@dell ~/a/storcli_all_os# df -h|grep data/dev/mapper/data--vg-data 1.8T 77M 1.7T 1% /mnt/data一応ベンチマーク。SATAのraid10がdata。SASのRaid5 2台に比べると4倍くらい遅い。SATA遅すぎ。デスクトップワークステーションを買うならSASがよさげ。
root@dell ~# hdparm -t /dev/mapper/data--vg-data
/dev/mapper/data--vg-data:SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0d 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Timing buffered disk reads: 684 MB in 3.00 seconds = 227.99 MB/sec
root@dell ~# hdparm -t /dev/mapper/dell--vg-root
/dev/mapper/dell--vg-root:SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0d 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Timing buffered disk reads: 1636 MB in 3.00 seconds = 545.06 MB/sec独り言
物理ハードディスクから、OSでディスクを扱うまでに抽象化がたくさん入っていて設定が面倒!昔は物理ディスクをそのままマウントしていたのに。そのぶん、自由度は高いですがね。まとめると以下。
- 物理ディスク
- Raidコントローラによる物理ディスクの仮想化
- OSによるPhysical Volumeによる仮想化
- OSによるLogical Volumeによる仮想化
- OSによってLogical Volumeのマウント
Ubuntu 19にてLVMでディスクを追加
https://blog.teraren.com/posts/lvmでディスクを追加/