Make soft RAID on linux and create big file
For we want to test big file transation in NFS, Spring gave me two IDE harddisk and ask me to install them in my computer which os is centos4.3. There were some trouble during the recognizing harddisk, only two IDE harddisks could be found, the other one disappeared even I changed the jumps. I feel a litter disappointed but not gave up. I put the “disappear” harddisk in the primary IDE connectors, it was recognize rightly! What’s wrong?
I looked at the mainboard carefully, then found that this board has four IDE connectors:Primary IDE,Slave IDE, Primary RAID IDE and Slave RAID IDE,I just put the third harddisk in the Slave RAID IDE slot! After changed the cable to slave IDE slot, everything is ok. The system found three harddisk as I wanted.
How to make soft RAID on linux?
First I downloaded RAID tools(raidtools), and edited the /etc/raidtab file as the following:
[root@localhost ~]# vi /etc/raidtab
raiddev /dev/md0
raid-level 0
nr-raid-disks 2
chunk-size 32
persistent-superblock 1
device /dev/hdb
raid-disk 0
device /dev/hdc
raid-disk 1
and then issued the “mdraid /dev/md0”, note, “/dev/md0” had been created when installed the “raidtools” package.It failed with some error messages which said /dev/hdb had been part of RAID? Why? My second IDE harddisk was just taken in the computer! Later, More explained that perhaps the system created /dev/hdb automaticlly when I installed the Centos 4.3. I’m still confused with what he said.
Other way to make soft RAID was the “mdadm” program, downloaded from Internet,and installed it.Then I used the following steps to create soft RAID 0 successfully:
# cat /proc/partitions Checking HD partitions
# cat /proc/mdstat Checking RAID stat
# ls /dev/mapper
# dmsetup lower level logical volume management
# dmsetup table
# dmsetup remove pdc_jbaiadif remove /dev/hdb
# mdadm -C /dev/md0 –lever 0 -n /dev/hdb /dev/hdc (After issuing this step, there was still error saying /dev/hdb had been used as RAID, so I planed to stop RAID first)
# mdadm /dev/md0 –stop
Then,create RAID again:
# mdadm -C /dev/md0 –lever 0 -n /dev/hdb /dev/hdc
OK, the RAID 0 was created successfully.
How to create very large file by “dd” command?
Since I made RAID 0 to merge two harddisk’s capacies together(150G), I wanted to create a big file as large as 150G.
First, format the RAID partition and mount it to /mnt:
# mkfs /dev/md0
# mount /dev/md0 /mnt
Second, using “dd” command to create file:
# dd if=/dev/urandom of=targetfile_name
A large file would be created when full of the /mnt capacity.