LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-19-2010, 06:32 PM   #1
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,196

Rep: Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044
Raid trying to sync with external USB drive -- or not?


Yesterday I had this scary experience. Let me tell what happened.

My server has 2 hard disks, sda and sdb. Both contain 5 partitions. Each partition is part of a RAID1 array. The boot partition contains all normal Linux partitions except /home. So /, /var, /usr /tmp are all on /dev/md0, which is built of /dev/sda1 and dev/sdb1.

To this server I have attached an external USB disk which I use for daily backups. (The weekly backups are performed on tape.) This external USB disk is recognized as /dev/sdc, and the partition /dev/sdc1 is mounted in /mnt/ext_daily. The mounting is manual.

No problem at all.

Yesterday we had to shutdown the server twice for maintenance of the server room UPS. We shut down all the systems, and plugged the server mains line into the grids and started up all servers. No problems. I did not do any checks because the server in question booted without problems and evertyhing was accessible.

Four hours later we followed the same procedure of shutting down and restarting to power the server room again from the UPS.

Server booted fine and this time I wanted to mount the external USB disk again. To my surprise the /dev/md0 was comprised of /dev/sdb1 and /dev/sdc1 (instead of /dev/sda1 and /dev/sdb1) and the external USB disk had become /dev/sda. Indeed, I had forgotten to unplug the USB disk during booting, not realizing that the device assignment could be different.

However, the array was functioning OK, and apparently it was assembled correctly using the UUID's and not the device names. I was in doubt whether I should reboot again now most users would have connected to the Samba shares again to correct this situation. I decided not to. And I mounted /dev/sda1 (the external USB disk) on /mnt/ext_daily.

After a few minutes, user complaints started to come in. No access to the Samba shares.

I noticed two things:
a. The root partition was 100% used 9.2 GB out of 9.2 GB.
b. The process /dev/md0 was using about 6% processor capacity, giving load figures of 2.0 - 2.8 in top. The hard disk light was continuously on.

(a) was perfectly possible. Logrotate was set up incorrectly on this machine and both system.log and daemon.log had grown to 3.1 GB each. The rest of the installation could account for another 3 GB, so 9.2 GB was viable.

(b) This I didn't understand, and I was scared that mdadm was trying to sync my external USB drive (now /dev/sda1). /proc/mdstat did not show anything of this syncing though.

First thing I did was to unmount /dev/sda1, which did not stop the CPU usage for /dev/mdadm.

When I tried to restart services this failed, but it was clear that this was a result of the 100% usage of root partition.

When I deleted daemon.log and system.log, du showed a disk usage of about 3 GB, as to be expected. However, df still showed a usage of 9.2 GB and 100%. This really convinced me that something terrible had happened to the file system, like mdadm overwriting the etx3 file system on /dev/md0 with data on /dev/sdb1 or so. fsck -n showed a clean drive (but still with 100% disk usage!). But then again, fsck.ext3 warns for unreliable results on mounted partitions.

I shut down the machine again and booted from a live USB disk. The USB stick was RAID capable. I re-assembled the /dev/md0 RAID partition, and to my surprise disk use was now 2.8GB, just what it should have been. fsck returned no errors again. The external USB disk looked sound as well.

So this time I disconnected the USB disk and rebooted. The RAID came up using sda and sdb, the external USB disk was sdc again, all problems solved.

So I did learn to either unplug the USB disk before booting, or configure udev correctly.

I am not sure if mdadm had tried to sync with the external USB disk. Frankly I don't think so. mdadm assembles based on UUID's, not on device names.

But what could have caused the 100% and 9.2 GB of disk usage while I had only 3 GB worth of files? WHy was this space not reclaimed? On this file system, I was using 13% of all available inodes.

jlinkels
 
Old 10-26-2010, 07:00 AM   #2
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Thanks for the warning, great story, i.e. well written.
 
Old 10-26-2010, 08:51 AM   #3
ganesh24pal@gmail.com
Member
 
Registered: Jun 2010
Location: Mumbai, India
Distribution: CentOS , Fedora, Open Suse
Posts: 193
Blog Entries: 5

Rep: Reputation: 3
Thanks for the warning, great story, i.e. well written.
Amazing your exprience....
 
0 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sync a USB flash drive with HD folders, possible? Valandil Linux - General 9 03-14-2010 11:16 PM
ext3 RAID 1 on a USB External Two Disk Hard Drive - Possible? Runge_Kutta Linux - Hardware 3 08-17-2007 06:28 PM
Mount an USB-Drive sync ToK Ubuntu 4 03-08-2006 03:14 AM
Recommendations: external drive enclosure + RAID Dark_Helmet Linux - Hardware 6 04-12-2005 05:11 PM
Usb drive file sync pembo13 Linux - General 2 11-11-2004 09:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration