UPWORK/ODESK guru: Tips and Tricks for clients

skype: upwork.link , email: info@upwork.link

Archive for the ‘Arrays and Disks’ Category

MDADM: Resize underlying partitions in mdadm RAID1

without comments

  1. Boot into a rescue CD, like SystemRescueCd, /dev/mdX is not mounted. Use fsck, just to make sure everything is ok with filesystem before any actions.
  2. Make scrabbing of target partition and repairing if will be need.
    A RAID array can suffer from sleeping bad blocks. i.e. blocks that you cannot read, but normally you never do (because they haven’t been allocated to a file yet). When a drive fails, and you are recovering the data onto a spare, hitting that sleeper can kill your array. For this reason it is good to regularly (daily, or weekly, maybe monthly) read through the entire array making sure everything is OK. In 2.6.16 (with complete functionality in 2.6.17) you will be able to trigger a background read-test of the whole array:

    1
    echo check > /sys/block/mdX/md/sync_action

    If you were to create an array with –assume-clean, then whenever you run this it will report lots of errors, though you can fix them with

    1
    echo repair > /sys/block/mdX/md/sync_action

    If you are going to be doing that (and I would recommend it) then you may as well allow the initial sync, especially as you can quite happily ignore the fact that it is happening.

  3. Resize filesystem on the mdadm RAID:

    1
    resize2fs /dev/md0 [size]

    where size is a little larger than the currently used space on the drive in filesystem

  4. After resize2fs, you need to shrink your mdadm array. For example, shrink /dev/md2 to 30GB. The –size value must be in KiBytes (30 x 1024 x 1024 = 31457280); make sure it can be divided by 64:

    1
    2
    mdadm --grow /dev/md2 --size=31457280
    (size FS <-> MD size <-> New partition size)
  5. Remove one of the drives from the RAID:
    1
    mdadm /dev/md0 --fail /dev/XXX1
  6. Resize the removed drive with parted. Add the new partition to the drive with parted
  7. Restore the drive to the RAID:
    mdadm -a /dev/mdX /dev/XXX1
  8. Repeat steps for the other device
  9. Resize the RAID to use the full partition:
    1
    mdadm --grow /dev/mdX -z max
  10. Next we grow the file system to the largest possible value (if you don’t specify a size, resize2fs will use the largest possible value) and check:
    1
    2
    resize2fs /dev/mdX
    e2fsck -f /dev/mdX

Written by spectre

September 23rd, 2018 at 4:06 pm

Posted in Arrays and Disks

MDADM: Full usefull ‘Cheat Sheet’

without comments

Mdadm is the modern tool most Linux distributions use these days to manage software RAID arrays; in the past raidtools was the tool we have used for this. This cheat sheet will show the most common usages of mdadm to manage software raid arrays; it assumes you have a good understanding of software RAID and Linux in general, and it will just explain the commands line usage of mdadm. The examples bellow use RAID1, but they can be adapted for any RAID level the Linux kernel driver supports.

Read the rest of this entry »

Written by spectre

February 7th, 2017 at 4:40 pm

Posted in Arrays and Disks

Protected: Forcing a hard disk to reallocate bad sectors

without comments

This content is password protected. To view it please enter your password below:

Written by spectre

November 26th, 2013 at 2:31 pm

Posted in Arrays and Disks

Intel Raid Controller RS2BL040 Slow Performance – BBU problems.

without comments

Just for the record:

When BBU is not exists, the default cache policy is no cache. So, forcing it to use even BBU not present helped in that case the fsync value goes up to above 3000. There are still lower fsync values and jumping speed values, but now these are much better than before.
Summary: BBU is recommended using a system like this.

Read the rest of this entry »

Written by spectre

November 22nd, 2013 at 2:32 pm

Align partitions for best performance using parted

without comments

There are two common problems when creating partitions in Linux on big storage arrays. The first is easy, and the warning message from fdisk is a bit of a giveaway:

WARNING: The size of this disk is 8.0 TB (7970004230144 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID 
partition table format (GPT).

Read the rest of this entry »

Written by spectre

November 4th, 2013 at 2:31 pm

Forcing a hard disk to reallocate bad sectors

without comments

Sometimes a hard disk is hinting on an upcoming failure. Some disks start to make unexpected sounds, others are silent and only cause some noise in your syslog. In most cases the disk will automatically reallocate one or two damaged sectors and you should start planning on buying a new disk while your data is safe. However, sometimes the disk won’t automatically reallocate these sectors and you’ll have to do that manually yourself. Luckily, this doesn’t include any rocket science.

Read the rest of this entry »

Written by spectre

October 31st, 2013 at 8:08 am

Posted in Arrays and Disks

Copy Master Boot Record (MBR)

without comments

How do I copy MBR from one hard disk to another hard disk?

To copy MBR simply use the dd command. dd command works under all Linux distros and other UNIX like operating systems too. A master boot record (MBR) is the 512-byte boot sector that is the first sector of a partitioned data storage device of a hard disk.

Read the rest of this entry »

Written by spectre

October 26th, 2013 at 9:31 pm

Posted in Arrays and Disks

Linux how to determine the file system type of unmounted (raw) partition

without comments

Of course!
You can try a ‘file -s’ on the device node.

root@rescue /mnt # file -s /dev/md1
/dev/md1: Linux rev 1.0 ext4 filesystem data, UUID=e77cc8ce-ade6-4e09-ac7f-d139c80a2e4a (needs journal recovery) (extents) (large files) (huge files)
root@rescue /mnt # 

Written by spectre

June 16th, 2013 at 7:21 pm

How to set the speed of MD RAID reconstruction

without comments

To see your Linux kernel speed limits:

root@rescue ~ # cat /proc/sys/dev/raid/speed_limit_max 
200000
root@rescue ~ # cat /proc/sys/dev/raid/speed_limit_min 
1000
root@rescue ~ # 

Read the rest of this entry »

Written by spectre

June 15th, 2013 at 10:06 pm

Posted in Arrays and Disks

How to run MD array with help assembly command (pos. degraded) from Linux shell

without comments

Assuming you have added the DEVICE and ARRAY entries to the /etc/mdadm.conf.
Starting the array can be accomplished with a single command:

root@localhost / # mdadm --assemble --scan
 mdadm: /dev/md0 has been started with 6 drives.
root@localhost / #

Read the rest of this entry »

Written by spectre

June 15th, 2013 at 8:09 pm

Posted in Arrays and Disks