
不久前,我在 Debian X64 伺服器上配置了 RAID0,到目前為止,它工作正常,沒有任何問題。有一天,我剛剛檢查了一下df -h
,它顯示 62% 的磁碟空間已被使用。
RAID配置有兩個2TB驅動器,目前僅使用20GB,但當我看到輸出時,它說大小為34G。我的設定有問題嗎?
df -H 的輸出:
df -H
Filesystem Size Used Avail Use% Mounted on
rootfs 456G 7,3G 425G 2% /
udev 11M 0 11M 0% /dev
tmpfs 3,4G 300k 3,4G 1% /run
/dev/disk/by-uuid/ae73679c-c3cd-4a60-bcbb-5b6ddce867f7 456G 7,3G 425G 2% /
tmpfs 5,3M 0 5,3M 0% /run/lock
tmpfs 11G 4,1k 11G 1% /run/shm
/dev/sdc2 529M 41M 461M 9% /boot
// This last one
/dev/md1 34G 20G 13G 62% /media/attachment
mdadm --detail /dev/md1 的輸出:
/dev/md1:
Version : 1.2
Creation Time : Wed Apr 29 11:12:21 2015
Raid Level : raid0
Array Size : 33553408 (32.00 GiB 34.36 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Update Time : Wed Apr 29 11:12:21 2015
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Chunk Size : 512K
Name : legion03:1 (local to host legion03)
UUID : 68e853a6:7af46176:d9c147c7:6ff87bb0
Events : 0
Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 8 17 1 active sync /dev/sdb1
輸出
fdisk -l | grep Disk
fdisk -l | grep Disk
Disk /dev/md1 doesn't contain a valid partition table
Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
Disk identifier: 0x00089ca4
Disk /dev/sdc: 480.1 GB, 480103981056 bytes
Disk identifier: 0x00047ef7
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
Disk identifier: 0x000275d2
Disk /dev/md1: 34.4 GB, 34358689792 bytes
Disk identifier: 0x00000000
我的 RAID0 設定有問題嗎?你能幫忙的話,我會很高興。謝謝。
更新
fdisk -l 的輸出:
fdisk -l
Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
81 heads, 63 sectors/track, 765633 cylinders, total 3907029168 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
Disk identifier: 0x00089ca4
Device Boot Start End Blocks Id System
/dev/sdb1 2048 3907029167 1953513560 fd Linux raid autodetect
Disk /dev/sdc: 480.1 GB, 480103981056 bytes
255 heads, 63 sectors/track, 58369 cylinders, total 937703088 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
Disk identifier: 0x00047ef7
Device Boot Start End Blocks Id System
/dev/sdc1 2048 33556480 16777216+ 82 Linux swap / Solaris
/dev/sdc2 33558528 34607104 524288+ 83 Linux
/dev/sdc3 34609152 937701040 451545944+ 83 Linux
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
81 heads, 63 sectors/track, 765633 cylinders, total 3907029168 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
Disk identifier: 0x000275d2
Device Boot Start End Blocks Id System
/dev/sda1 2048 3907029167 1953513560 fd Linux raid autodetect
Disk /dev/md1: 34.4 GB, 34358689792 bytes
2 heads, 4 sectors/track, 8388352 cylinders, total 67106816 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 524288 bytes / 1048576 bytes
Disk identifier: 0x00000000
Disk /dev/md1 doesn't contain a valid partition table
答案1
您的/dev/md1
分割區似乎是兩個分割區的組合,每個分割區的大小為 16 GiB(或可能大小不同,總計為 32 GiB)。後來添加的輸出fdisk -l
與此相矛盾。如果沒有完整的歷史記錄,我們只能推測是什麼導致了目前的情況/dev/md1
,但一種可能性是分區表在創建RAID 設備後發生了更改(我還沒有測試該事件序列是否會導致這種情況) 。
若要僅報告這兩個磁碟上的分割表,請使用下列命令:
fdisk -l /dev/sd[ab]
如果您想保留該分割區中的 20G 數據,則需要在重新建立之前將其複製到其他地方/dev/md1
。
/dev/sda
和上的目前分割區表/dev/sdb
適用於這些磁碟上的 RAID 分割區。我刪除了先前關於如何(以及是否)對這些磁碟進行分割的評論。
要拆除並重新創建,/dev/md1
您可以使用以下命令序列:
mdadm --stop /dev/md1
mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sd[ab]1
/dev/md1
我相信第一個命令是非破壞性的,但在運行第二個命令之前(實際上,在運行第一個命令之前),您需要備份現有資料。我相信mdadm --assemble
您可以逆轉第一個命令的效果,但是一旦備份了數據,就沒有必要了。
我還沒有測試過這個命令序列(無論如何最近都沒有),但它與我的記憶和我對文件的閱讀是一致的。請務必正確輸入設備名稱。了解mdadm --create
建立 RAID 映像時是否使用兩個元件磁碟的完整分割區大小將會很有趣。您的評論表明您想要一個 RAID 鏡像;--level
如果您想要其他值,則參數值會有所不同。
您可能還想檢查/etc/mdadm.conf
或的內容/etc/mdadm/mdadm.conf
以確保它們沒有指定不需要的預設值。