linux

linux

Senin, 13 Februari 2012

increase size mdadm

This just my note  how to increase array raid from 54G to 80G
it was work without lost data
just follow this steps
 
root@HO-1-231:~# fdisk -l | grep dev                                                                                        
Disk /dev/md0 doesn't contain a valid partition table                                                                       
Disk /dev/sdc doesn't contain a valid partition table                                                                       
Disk /dev/sdd doesn't contain a valid partition table                                                                       
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes                                                                               
/dev/sda1               1      243201  1953512001   fd  Linux raid autodetect                                               
Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes                                                                               
/dev/sdb1               1      243201  1953512001   fd  Linux raid autodetect                                               
Disk /dev/md0: 2000.4 GB, 2000396222464 bytes                                                                               
Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes                                                                               
Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes                                                                               
root@HO-1-231:~# fdisk /dev/sdc                                                                                             
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel                                          
Building a new DOS disklabel with disk identifier 0x5ce337a5.                                                               
Changes will remain in memory only, until you decide to write them.                                                         
After that, of course, the previous content won't be recoverable.                                                           

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted. 

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to  
         sectors (command 'u').                                         

Command (m for help): p

Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes   
Disk identifier: 0x5ce337a5                           

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action         
   e   extended        
   p   primary partition (1-4)
p                             
Partition number (1-4): 1     
First cylinder (1-243201, default 1): 
Using default value 1                 
Last cylinder, +cylinders or +size{K,M,G} (1-243201, default 243201): +50G

Command (m for help): p

Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes   
Disk identifier: 0x5ce337a5                           

   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1               1        6528    52436128+  83  Linux 
Partition 1 does not start on physical sector boundary.       

Command (m for help): t
Selected partition 1   
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): p

Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes   
Disk identifier: 0x5ce337a5                           

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        6528    52436128+  fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.                      

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.                             
root@HO-1-231:~# fdisk /dev/sdd            
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x3c581631.                     
Changes will remain in memory only, until you decide to write them.               
After that, of course, the previous content won't be recoverable.                 

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted. 

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to  
         sectors (command 'u').                                         

Command (m for help): p

Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes   
Disk identifier: 0x3c581631                           

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action         
   e   extended        
   p   primary partition (1-4)
p                             
Partition number (1-4): 1     
First cylinder (1-243201, default 1): 
Using default value 1                 
Last cylinder, +cylinders or +size{K,M,G} (1-243201, default 243201): +50G

Command (m for help): p

Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes   
Disk identifier: 0x3c581631                           

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1        6528    52436128+  83  Linux 
Partition 1 does not start on physical sector boundary.       

Command (m for help): t
Selected partition 1   
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): p

Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes   
Disk identifier: 0x3c581631                           

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1        6528    52436128+  fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.                      

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.                             
root@HO-1-231:~# fdisk -l | grep dev
Disk /dev/md0 doesn't contain a Valid partition table
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes        
/dev/sda1               1      243201  1953512001   fd  Linux raid autodetect
Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes                                
/dev/sdb1               1      243201  1953512001   fd  Linux raid autodetect
Disk /dev/md0: 2000.4 GB, 2000396222464 bytes                                
Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes                                
/dev/sdc1               1        6528    52436128+  fd  Linux raid autodetect
Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes                                
/dev/sdd1               1        6528    52436128+  fd  Linux raid autodetect
root@HO-1-231:~# mdadm --create /dev/md1 --verbose --level=raid1 --raid-devices=2 /dev/sdc1 /dec/sdd1
mdadm: Cannot open /dec/sdd1: No such file or directory                                              
mdadm: create aborted                                                                                
root@HO-1-231:~# mdadm --create /dev/md1 --verbose --level=raid1 --raid-devices=2 /dev/sdc1 /dev/sdd1
mdadm: size set to 52436032K                                                                         
mdadm: array /dev/md1 started.                                                                       
root@HO-1-231:~# cat /proc/mdstat                                                                    
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]                
md1 : active raid1 sdd1[1] sdc1[0]                                                                   
      52436032 blocks [2/2] [UU]                                                                     
      [>....................]  resync =  1.1% (599232/52436032) finish=7.2min speed=119846K/sec      
                                                                                                     
md0 : active raid1 sda1[1] sdb1[0]                                                                   
      1953511936 blocks [2/2] [UU]                                                                   
                                                                                                     
unused devices: <none>                                                                               
root@HO-1-231:~# cat /proc/mdstat                                                                    
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]                
md1 : active raid1 sdd1[1] sdc1[0]                                                                   
      52436032 blocks [2/2] [UU]                                                                     
      [>....................]  resync =  1.4% (755520/52436032) finish=9.1min speed=94440K/sec       
                                                                                                     
md0 : active raid1 sda1[1] sdb1[0]                                                                   
      1953511936 blocks [2/2] [UU]                                                                   
                                                                                                     
unused devices: <none>                                                                               
root@HO-1-231:~# cat /proc/mdstat                                                                    
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]                
md1 : active raid1 sdd1[1] sdc1[0]                                                                   
      52436032 blocks [2/2] [UU]                                                                     
      [>....................]  resync =  2.6% (1403328/52436032) finish=8.4min speed=100237K/sec     
                                                                                                     
md0 : active raid1 sda1[1] sdb1[0]                                                                   
      1953511936 blocks [2/2] [UU]                                                                   
                                                                                                     
unused devices: <none>                                                                               
root@HO-1-231:~# cat /proc/mdstat                                                                    
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]                
md1 : active raid1 sdd1[1] sdc1[0]                                                                   
      52436032 blocks [2/2] [UU]                                                                     
      [>....................]  resync =  3.2% (1691072/52436032) finish=9.5min speed=89003K/sec      
                                                                                                     
md0 : active raid1 sda1[1] sdb1[0]                                                                   
      1953511936 blocks [2/2] [UU]                                                                   
                                                                                                     
unused devices: <none>                                                                               
root@HO-1-231:~# cat /proc/mdstat                                                                    
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]                
md1 : active raid1 sdd1[1] sdc1[0]                                                                   
      52436032 blocks [2/2] [UU]                                                                     
      [>....................]  resync =  4.7% (2512256/52436032) finish=10.2min speed=81040K/sec     
                                                                                                     
md0 : active raid1 sda1[1] sdb1[0]                                                                   
      1953511936 blocks [2/2] [UU]                                                                   
                                                                                                     
unused devices: <none>                                                                               
root@HO-1-231:~# cat /proc/mdstat                                                                    
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]                
md1 : active raid1 sdd1[1] sdc1[0]                                                                   
      52436032 blocks [2/2] [UU]                                                                     
      [=========>...........]  resync = 46.1% (24198208/52436032) finish=8.0min speed=58504K/sec     
                                                                                                     
md0 : active raid1 sda1[1] sdb1[0]                                                                   
      1953511936 blocks [2/2] [UU]                                                                   
                                                                                                     
unused devices: <none>                                                                               
root@HO-1-231:~# cat /proc/mdstat                                                                    
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]                
md1 : active raid1 sdd1[1] sdc1[0]                                                                   
      52436032 blocks [2/2] [UU]                                                                     
      [===================>.]  resync = 96.2% (50460544/52436032) finish=0.4min speed=66731K/sec     
                                                                                                     
md0 : active raid1 sda1[1] Sdb1[0]                                                                   
      1953511936 blocks [2/2] [UU]                                                                   
                                                                                                     
unused devices: <none>                                                                               
root@HO-1-231:~# cat /proc/mdstat                                                                    
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]                
md1 : active raid1 sdd1[1] sdc1[0]                                                                   
      52436032 blocks [2/2] [UU]                                                                     
                                                                                                     
md0 : active raid1 sda1[1] sdb1[0]                                                                   
      1953511936 blocks [2/2] [UU]                                                                   
                                                                                                     
unused devices: <none>                                                                               
root@HO-1-231:~# ls /mnt                                                                             
README  cdrecorder/  cdrom/  dvd/  floppy/  hd/  memory/  tmp/  zip/                                 
root@HO-1-231:~# mkdir /mnt/md1                                                                      
root@HO-1-231:~# mount /dev/md1 /mnt/md1                                                             
mount: you must specify the filesystem type                                                          
root@HO-1-231:~# mkfs.xfs -f /dev/md1                                                                
warning: device is not properly aligned /dev/md1                                                     
meta-data=/dev/md1               isize=256    agcount=16, agsize=819313 blks                         
         =                       sectsz=512   attr=2                                                 
data     =                       bsize=4096   blocks=13109008, imaxpct=25                            
         =                       sunit=0      swidth=0 blks                                          
naming   =version 2              bsize=4096   ascii-ci=0                                             
log      =internal log           bsize=4096   blocks=6400, version=2                                 
         =                       sectsz=512   sunit=0 blks, lazy-count=1                             
realtime =none                   extsz=4096   blocks=0, rtextents=0                                  
root@HO-1-231:~# mount /dev/md1 /mnt/md1                                                                
root@HO-1-231:~# mc                                                                                     

root@HO-1-231:/mnt/md1# exit
exit                        

root@HO-1-231:~# cd /mnt/md1
root@HO-1-231:/mnt/md1# ls  
siapsrv/                    
root@HO-1-231:/mnt/md1# ls          
siapsrv/                            
root@HO-1-231:/mnt/md1# cd siapsrv/ 
root@HO-1-231:/mnt/md1/siapsrv# ls  
grub2/  grub2.tar.gz  monmdadm/  postgresql-9.0.4.tar.gz  rc.pg_reload*  rc.pg_start*  rc.pg_stop*
root@HO-1-231:/mnt/md1/siapsrv# mv rc.pg_reload testt                                             
root@HO-1-231:/mnt/md1/siapsrv# ls                                                                
grub2/  grub2.tar.gz  monmdadm/  postgresql-9.0.4.tar.gz  rc.pg_start*  rc.pg_stop*  testt*       
root@HO-1-231:/mnt/md1/siapsrv# md5                                                               
md5pass  md5sum                                                                                   
root@HO-1-231:/mnt/md1/siapsrv# ls                                                                
grub2/  grub2.tar.gz  monmdadm/  postgresql-9.0.4.tar.gz  rc.pg_start*  rc.pg_stop*  testt*       
root@HO-1-231:/mnt/md1/siapsrv# md5sum testt > md5sum                                             
root@HO-1-231:/mnt/md1/siapsrv# ls                                                                
grub2/  grub2.tar.gz  md5sum  monmdadm/  postgresql-9.0.4.tar.gz  rc.pg_start*  rc.pg_stop*  testt*
root@HO-1-231:/mnt/md1/siapsrv# mc                                                                 

root@HO-1-231:/mnt/md1/siapsrv# exit
exit                                

root@HO-1-231:/mnt/md1/siapsrv# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] 
md1 : active raid1 sdd1[1] sdc1[0]                                                    
      52436032 blocks [2/2] [UU]                                                      
                                                                                      
md0 : active raid1 sda1[1] sdb1[0]                                                    
      1953511936 blocks [2/2] [UU]                                                    
                                                                                      
unused devices: <none>                                                                
root@HO-1-231:/mnt/md1/siapsrv# mdadm /dev/md1 --fail /dev/sdc1 --remove /dev/sdc1    
mdadm: set /dev/sdc1 faulty in /dev/md1                                               
mdadm: hot remove failed for /dev/sdc1: Device or resource busy                       
root@HO-1-231:/mnt/md1/siapsrv# cd /                                                  
root@HO-1-231:/# mdadm /dev/md1 --fail /dev/sdc1 --remove /dev/sdc1                   
mdadm: set /dev/sdc1 faulty in /dev/md1                                               
mdadm: hot removed /dev/sdc1                                                          
root@HO-1-231:/# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] 
md1 : active raid1 sdd1[1]                                                            
      52436032 blocks [2/1] [_U]                                                      
                                                                                      
md0 : active raid1 sda1[1] sdb1[0]                                                    
      1953511936 blocks [2/2] [UU]                                                    
                                                                                      
unused devices: <none>                                                                
root@HO-1-231:/# fdisk -l | grep dev                                                  
Disk /dev/md0 doesn't contain a valid partition table                                 
Disk /dev/md1 doesn't contain a valid partition table                                 
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes                                         
/dev/sda1               1      243201  1953512001   fd  Linux raid autodetect         
Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes                                         
/dev/sdb1               1      243201  1953512001   fd  Linux raid autodetect         
Disk /dev/md0: 2000.4 GB, 2000396222464 bytes                                         
Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes                                         
/dev/sdc1               1        6528    52436128+  fd  Linux raid autodetect         
Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes                                         
/dev/sdd1               1        6528    52436128+  fd  Linux raid autodetect         
Disk /dev/md1: 53.7 GB, 53694496768 bytes                                             
root@HO-1-231:/# fdisk /dev/sdc                                                       

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted. 

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to  
         sectors (command 'u').                                         

Command (m for help): p

Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes   
Disk identifier: 0x5ce337a5                           

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        6528    52436128+  fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.                      

Command (m for help): d
Selected partition 1   

Command (m for help): p

Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes   
Disk identifier: 0x5ce337a5                           

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action         
   e   extended        
   p   primary partition (1-4)
p                             
Partition number (1-4): 1
First cylinder (1-243201, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-243201, default 243201): +84G

Command (m for help): p

Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x5ce337a5

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       10968    88092396+  83  Linux
Partition 1 does not start on physical sector boundary.

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): p

Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x5ce337a5

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       10968    88092396+  fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
root@HO-1-231:/# fdisk -l | grep dev
Disk /dev/md0 doesn't contain a valid partition table
Disk /dev/md1 doesn't contain a valid partition table
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
/dev/sda1               1      243201  1953512001   fd  Linux raid autodetect
Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
/dev/sdb1               1      243201  1953512001   fd  Linux raid autodetect
Disk /dev/md0: 2000.4 GB, 2000396222464 bytes
Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes
/dev/sdc1               1       10968    88092396+  fd  Linux raid autodetect
Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes
/dev/sdd1               1        6528    52436128+  fd  Linux raid autodetect
Disk /dev/md1: 53.7 GB, 53694496768 bytes
root@HO-1-231:/#
root@HO-1-231:/# df -h                                                       
Filesystem            Size  Used Avail Use% Mounted on                       
/dev/root             1.9T  165G  1.7T   9% /                                
tmpfs                 7.9G     0  7.9G   0% /dev/shm                         
/dev/md1               50G   25M   50G   1% /mnt/md1                         
root@HO-1-231:/# mdadm /dev/md1 -a /dev/sdc1                                 
mdadm: added /dev/sdc1                                                       
root@HO-1-231:/# cat /proc/mdstat                                            
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] 
md1 : active raid1 sdc1[2] sdd1[1]                                                    
      52436032 blocks [2/1] [_U]                                                      
      [>....................]  recovery =  0.8% (460928/52436032) finish=13.1min speed=65846K/sec
root@HO-1-231:/# cat /proc/mdstat                                                                  
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]              
md1 : active raid1 sdc1[2] sdd1[1]                                                                 
      52436032 blocks [2/1] [_U]                                                                   
      [============>........]  recovery = 61.8% (32446976/52436032) finish=5.1min speed=65110K/sec 
                                                                                                   
md0 : active raid1 sda1[1] sdb1[0]                                                                 
      1953511936 blocks [2/2] [UU]                                                                 
                                                                                                   
unused devices: <none>                                                                             
root@HO-1-231:/# cat /proc/mdstat                                                                  
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]              
md1 : active raid1 sdc1[0] sdd1[1]                                                                 
      52436032 blocks [2/2] [UU]                                                                   
                                                                                                   
md0 : active raid1 sda1[1] sdb1[0]                                                                 
      1953511936 blocks [2/2] [UU]                                                                 
                                                                                                   
unused devices: <none>                                                                             
root@HO-1-231:/# mdadm /dev/md1 --fail /dev/sdd1 --remove /dev/sdd1
mdadm: set /dev/sdd1 faulty in /dev/md1                            
mdadm: hot removed /dev/sdd1                                       
root@HO-1-231:/# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] 
md1 : active raid1 sdc1[0]                                                            
      52436032 blocks [2/1] [U_]                                                      
                                                                                      
md0 : active raid1 sda1[1] sdb1[0]                                                    
      1953511936 blocks [2/2] [UU]                                                    
                                                                                      
unused devices: <none>                                                                
root@HO-1-231:/# fdisk /dev/sdd                                                       

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted. 

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to  
         sectors (command 'u').                                         

Command (m for help): p

Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes   
Disk identifier: 0x3c581631                           

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1        6528    52436128+  fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.                      

Command (m for help): d
Selected partition 1   

Command (m for help): p

Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes   
Disk identifier: 0x3c581631                           

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action         
   e   extended        
   p   primary partition (1-4)
p                             
Partition number (1-4): 1     
First cylinder (1-243201, default 1): 
Using default value 1                 
Last cylinder, +cylinders or +size{K,M,G} (1-243201, default 243201): +84G

Command (m for help): p

Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes   
Disk identifier: 0x3c581631                           

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1       10968    88092396+  83  Linux 
Partition 1 does not start on physical sector boundary.       

Command (m for help): t
Selected partition 1   
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): p

Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes   
Disk identifier: 0x3c581631                           

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1       10968    88092396+  fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.                      

Command (m for help): t
Selected partition 1   
Hex code (type L to list codes): fd

Command (m for help): p

Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes   
Disk identifier: 0x3c581631                           

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1       10968    88092396+  fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.                      

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.                             
root@HO-1-231:/# mdadm /dev/md1 -a /dev/sdd1
mdadm: added /dev/sdd1 
root@HO-1-231:/# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] 
md1 : active raid1 sdd1[2] sdc1[0]                                                    
      52436032 blocks [2/1] [U_]                                                      
      [===============>.....]  recovery = 76.3% (40046528/52436032) finish=3.1min speed=66193K/sec
                                                                                                  
md0 : active raid1 sda1[1] sdb1[0]                                                                
      1953511936 blocks [2/2] [UU]                                                                
                                                                                                  
unused devices: <none>                                                                            
root@HO-1-231:/# cat /proc/mdstat                                                                 
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]             
md1 : active raid1 sdd1[2] sdc1[0]                                                                
      52436032 blocks [2/1] [U_]                                                                  
      [===================>.]  recovery = 97.1% (50961088/52436032) finish=0.3min speed=68716K/sec
                                                                                                  
md0 : active raid1 sda1[1] sdb1[0]                                                                
      1953511936 blocks [2/2] [UU]                                                                
                                                                                                  
unused devices: <none>                                                                            
root@HO-1-231:/# cat /proc/mdstat                                                                 
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]             
md1 : active raid1 sdd1[1] sdc1[0]                                                                
      52436032 blocks [2/2] [UU]                                                                  
                                                                                                  
md0 : active raid1 sda1[1] sdb1[0]                                                                
      1953511936 blocks [2/2] [UU]                                                                
                                                                                                  
unused devices: <none>                                                                            
root@HO-1-231:/# mdadm --detail /dev/md0 | grep -e 'Array Size' -e 'Device Size'                  
     Array Size : 1953511936 (1863.01 GiB 2000.40 GB)                                             
root@HO-1-231:/# mdadm --detail /dev/md1 | grep -e 'Array Size' -e 'Device Size'                  
     Array Size : 52436032 (50.01 GiB 53.69 GB)                                                   
root@HO-1-231:/# mdadm --detail /dev/md1                                                          
/dev/md1:                                                                                         
        Version : 0.90                                                                            
  Creation Time : Thu Feb  2 20:07:41 2012                                                        
     Raid Level : raid1                                                                           
     Array Size : 52436032 (50.01 GiB 53.69 GB)                                                   
  Used Dev Size : 52436032 (50.01 GiB 53.69 GB)                                                   
   Raid Devices : 2                                                                               
  Total Devices : 2                                                                               
Preferred Minor : 1                                                                               
    Persistence : Superblock is persistent                                                        

    Update Time : Thu Feb  2 21:09:54 2012
          State : clean                   
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           UUID : d2a575b9:b98dd42f:473eda47:d8152018
         Events : 0.122

    Number   Major   Minor   RaidDevice State
       0       8       33        0      active sync   /dev/sdc1
       1       8       49        1      active sync   /dev/sdd1
root@HO-1-231:/# mdadm --detail /dev/md1 | grep -e 'Array Size' -e 'Used Dev Size'
     Array Size : 52436032 (50.01 GiB 53.69 GB)
  Used Dev Size : 52436032 (50.01 GiB 53.69 GB)
root@HO-1-231:/# mdadm --grow /dev/md1 -z max
root@HO-1-231:/# mdadm --detail /dev/md1 | grep -e 'Array Size' -e 'Used Dev Size'
     Array Size : 88092288 (84.01 GiB 90.21 GB)
  Used Dev Size : 88092288 (84.01 GiB 90.21 GB)
root@HO-1-231:/# mount
/dev/root on / type xfs (rw,relatime,attr2,noquota)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
tmpfs on /dev/shm type tmpfs (rw)
/dev/md1 on /mnt/md1 type xfs (rw)
root@HO-1-231:/# resize2fs /dev/md1
resize2fs 1.41.11 (14-Mar-2010)
resize2fs: Bad magic number in super-block while trying to open /dev/md1
Couldn't find valid filesystem superblock.
root@HO-1-231:/# mc

root@HO-1-231:/mnt/md1/siapsrv# exit
exit

root@HO-1-231:/# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/root             1.9T  165G  1.7T   9% /
tmpfs                 7.9G     0  7.9G   0% /dev/shm
/dev/md1               50G   25M   50G   1% /mnt/md1
root@HO-1-231:/# xfs_growfs /mnt/md1
meta-data=/dev/md1               isize=256    agcount=16, agsize=819313 blks
         =                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=13109008, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal               bsize=4096   blocks=6400, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 13109008 to 22023072
root@HO-1-231:/# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/root             1.9T  165G  1. T   9% /
tmpfs                 7.9G     0  7.9G   0% /dev/shm
/dev/md1               84G   26M   84G   1% /mnt/md1
root@HO-1-231:/#md5sum -c md5sum

ok

Tidak ada komentar:

Posting Komentar