About device files and formatting of raid under linux

Overview

I installed zstack on dell t20 today. Yes, the bottom layer of zstack image is actually centos. There are four hard disks in the server. One 300g hard disk is used as a system disk, and three 1T hard disks are intended to be used for data storage. For the storage of dell r410, because dell t20 only has soft raid, I made raid0 for these three hard disks. After completing the raid and installing the system, I found out that I did not format the raid, and I googled it. Found a way to view the raid, the following is the operation

operate

First of all, my dev directory looks like this

[root@MiWiFi-R1CM-srv ~]# ls /dev
autofs         cpu              fd         kvm           mei                 oldmem  rfkill  sdc3      snd     tty11  tty19  tty26  tty33  tty40  tty48  tty55  tty62  ttyS3    usbmon4  vcsa3        zstack
block          cpu_dma_latency  full       log           mem                 port    rtc     sdd       stderr  tty12  tty2   tty27  tty34  tty41  tty49  tty56  tty63  uhid     vcs      vfio
bsg            crash            fuse       loop-control  mqueue              ppp     rtc0    sg0       stdin   tty13  tty20  tty28  tty35  tty42  tty5   tty57  tty7   uinput   vcs1     vga_arbiter
btrfs-control  disk             hpet       mapper        net                 ptmx    sda     sg1       stdout  tty14  tty21  tty29  tty36  tty43  tty50  tty58  tty8   urandom  vcs2     vhost-net
bus            dm-0             hugepages  mcelog        network_latency     ptp0    sdb     sg2       tty     tty15  tty22  tty3   tty37  tty44  tty51  tty59  tty9   usbmon0  vcs3     watchdog
char           dm-1             initctl    md            network_throughput  pts     sdc     sg3       tty0    tty16  tty23  tty30  tty38  tty45  tty52  tty6   ttyS0  usbmon1  vcsa     watchdog0
console        dri              input      md126         null                random  sdc1    shm       tty1    tty17  tty24  tty31  tty39  tty46  tty53  tty60  ttyS1  usbmon2  vcsa1    watchdog1
core           fb0              kmsg       md127         nvram               raw     sdc2    snapshot  tty10   tty18  tty25  tty32  tty4   tty47  tty54  tty61  ttyS2  usbmon3  vcsa2    zero

The key point is the following sda, sdb, sdc, sdc1, sdc2, sdc3, and sdd. Obviously, sdc is a system disk, and sda, sdb, and sdd are not partitioned, so the three of them are raid groups, and then we look at the raid informationcat /proc/mdstat

[root@MiWiFi-R1CM-srv disk]#  cat /proc/mdstat
Personalities : [raid0] 
md126 : active raid0 sda[2] sdb[1] sdd[0]
      2930245632 blocks super external:/md127/0 32k chunks
      
md127 : inactive sda[2](S) sdb[1](S) sdd[0](S)
      9459 blocks super external:imsm
       
unused devices: <none>

It can be seen that the device files are md126 and md127, so we only need to format md126, but because it is larger than 2T, we need to format it as a gpt partition table, so we cannot use fdisk to format, use gdisk , the specific process is as follows

[root@MiWiFi-R1CM-srv disk]# gdisk /dev/md126
GPT fdisk (gdisk) version 0.8.6

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

Found valid GPT with protective MBR; using GPT.

Command (? for help): ?
b	back up GPT data to a file
c	change a partition's name
d	delete a partition
i	show detailed information on a partition
l	list known partition types
n	add a new partition
o	create a new empty GUID partition table (GPT)
p	print the partition table
q	quit without saving changes
r	recovery and transformation options (experts only)
s	sort partitions
t	change a partition's type code
v	verify disk
w	write table to disk and exit
x	extra functionality (experts only)
?	print this menu

Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y

Command (? for help): n
Partition number (1-128, default 1): 1
First sector (34-5860491230, default = 2048) or {+-}size{KMGTP}: 
Last sector (2048-5860491230, default = 5860491230) or {+-}size{KMGTP}: 
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): L
0700 Microsoft basic data  0c01 Microsoft reserved    2700 Windows RE          
4200 Windows LDM data      4201 Windows LDM metadata  7501 IBM GPFS            
7f00 ChromeOS kernel       7f01 ChromeOS root         7f02 ChromeOS reserved   
8200 Linux swap            8300 Linux filesystem      8301 Linux reserved      
8e00 Linux LVM             a500 FreeBSD disklabel     a501 FreeBSD boot        
a502 FreeBSD swap          a503 FreeBSD UFS           a504 FreeBSD ZFS         
a505 FreeBSD Vinum/RAID    a580 Midnight BSD data     a581 Midnight BSD boot   
a582 Midnight BSD swap     a583 Midnight BSD UFS      a584 Midnight BSD ZFS    
a585 Midnight BSD Vinum    a800 Apple UFS             a901 NetBSD swap         
a902 NetBSD FFS            a903 NetBSD LFS            a904 NetBSD concatenated 
a905 NetBSD encrypted      a906 NetBSD RAID           ab00 Apple boot          
af00 Apple HFS/HFS+        af01 Apple RAID            af02 Apple RAID offline  
af03 Apple label           af04 AppleTV recovery      af05 Apple Core Storage  
be00 Solaris boot          bf00 Solaris root          bf01 Solaris /usr & Mac Z
bf02 Solaris swap          bf03 Solaris backup        bf04 Solaris /var        
bf05 Solaris /home         bf06 Solaris alternate se  bf07 Solaris Reserved 1  
bf08 Solaris Reserved 2    bf09 Solaris Reserved 3    bf0a Solaris Reserved 4  
bf0b Solaris Reserved 5    c001 HP-UX data            c002 HP-UX service       
ed00 Sony system partitio  ef00 EFI System            ef01 MBR partition scheme
ef02 BIOS boot partition   fb00 VMWare VMFS           fb01 VMWare reserved     
fc00 VMWare kcore crash p  fd00 Linux RAID            
Hex code or GUID (L to show codes, Enter = 8300): 8300
Changed type of partition to '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/md126.
The operation has completed successfully.

What we have to do after that is to format the partition, mkfs.ext4 /dev/md126p1format it into an ext4 partition and mount it because it is shared storage, so I will create a new folder in the root directory mkdir /dataand mount sudo mount /dev/md126p1 /data/it to check the mount status.

[root@MiWiFi-R1CM-srv data]# df -h
文件系统                 容量  已用  可用 已用% 挂载点
/dev/mapper/zstack-root  290G  5.9G  284G    3% /
devtmpfs                 7.8G     0  7.8G    0% /dev
tmpfs                    7.8G  4.0K  7.8G    1% /dev/shm
tmpfs                    7.8G  8.7M  7.8G    1% /run
tmpfs                    7.8G     0  7.8G    0% /sys/fs/cgroup
/dev/sdc2                477M   99M  349M   23% /boot
/dev/sdc1                200M  9.5M  191M    5% /boot/efi
tmpfs                    1.6G     0  1.6G    0% /run/user/0
tmpfs                    1.6G     0  1.6G    0% /run/user/1000
/dev/md126p1             2.7T   89M  2.6T    1% /data

That's right, there are 2.7 T's

Welcome to follow Bboysoul's blog www.bboysoul.com Have Fun

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325696631&siteId=291194637