Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
What does ``sync'' really do?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
alexraasch
Tux's lil' helper
Tux's lil' helper


Joined: 14 Nov 2003
Posts: 94
Location: Rostock, Germany

PostPosted: Wed Jun 01, 2005 6:25 pm    Post subject: What does ``sync'' really do? Reply with quote

Hi,

I am running a RAID-1 system that supports hot swap. The RAID controller has a write cache, so do the hard disks. Now, if I unplug a drive data in the caches may be lost.

There is ``sync'' which invokes the kernel function ``sync''. If have read the man and info pages, but they don't really tell me what sync does. Does it force all the hardware caches to be flushed as well or just the linux write cache?

I don't really want to disable the write caches of the hard drives because the system gets awfully slow.
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Wed Jun 01, 2005 7:16 pm    Post subject: Re: What does ``sync'' really do? Reply with quote

alexraasch wrote:
Hi,

I am running a RAID-1 system that supports hot swap.

It might help to introduce the actual make & model of the RAID controller into the discussion as early as possible.

alexraasch wrote:
The RAID controller has a write cache, so do the hard disks.

Both read and write, actually - it's also the same buffer usually.

alexraasch wrote:
Now, if I unplug a drive data in the caches may be lost.

Absolutely not.
Any cache data that has not yet been written to that disk may of course be lost, but in that case it's still in both the RAID controllers' cache and in the on-disk cache of the other drive.
That's what RAID-1 means, after all: two identical disks.

alexraasch wrote:
There is ``sync'' which invokes the kernel function ``sync''. If have read the man and info pages, but they don't really tell me what sync does.

Yes they do.
They write the filesystem buffer(s) to the disk controller(s).

alexraasch wrote:
Does it force all the hardware caches to be flushed as well or just the linux write cache?

It flushes the filesystem buffers to the disk controller.
In your case this is the RAID controller.
No hardware caches are involved.

The RAID controller then writes it to its cache, and it either waits there until the drive(s) are ready to receive data, or if they are ready it writes to the drives and the cache simultaneously.
This behaviour is usually selectable in your RAID controller's BIOS.

Then the RAID controller writes it over the SCSI cable to the on-disk controller, which does that very same thing again - now using the on disk caches.

alexraasch wrote:
I don't really want to disable the write caches of the hard drives because the system gets awfully slow.

Why do you think you will lose any data ?
The only conceivable situation where a HW RAID-1 set will lose cache data is when both the controller and the system power fail, or the controller fails and both drives die at the same time.
You have fun calculating the chances of that.
_________________
>>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen
Back to top
View user's profile Send private message
alexraasch
Tux's lil' helper
Tux's lil' helper


Joined: 14 Nov 2003
Posts: 94
Location: Rostock, Germany

PostPosted: Mon Jun 20, 2005 4:59 pm    Post subject: Reply with quote

Well, first thanks for the profound answer.

Quote:

It might help to introduce the actual make & model of the RAID controller into the discussion as early as possible.


Adaptec 2410SA Enclosure Kit.

Quote:

Absolutely not.
Any cache data that has not yet been written to that disk may of course be lost, but in that case it's still in both the RAID controllers' cache and in the on-disk cache of the other drive.

That's what RAID-1 means, after all: two identical disks.
The only conceivable situation where a HW RAID-1 set will lose cache data is when both the controller and the system power fail, or the controller fails and both drives die at the same time.


Okay, I' convinced. But if it's really safe to unplug one of the disks, then how do you explain:

1. While the system was running I unplugged one disks and the system froze.
2. While booting I unplugged one disks and plugged another back in. Now the controller was unable to reconstruct the RAID array -- it remained ``impacted.''
[/quote]
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Tue Jun 21, 2005 1:45 pm    Post subject: Reply with quote

alexraasch wrote:
Well, first thanks for the profound answer.
Quote:
It might help to introduce the actual make & model of the RAID controller into the discussion as early as possible.

Adaptec 2410SA Enclosure Kit.

That's a pretty nice card - good performance ?
Adaptec does tend to be on the expensive side, though...

alexraasch wrote:
Okay, I' convinced. But if it's really safe to unplug one of the disks, then how do you explain:

1. While the system was running I unplugged one disks and the system froze.
2. While booting I unplugged one disks and plugged another back in. Now the controller was unable to reconstruct the RAID array -- it remained ``impacted.''

From the Adaptec product page:

Quote:
Hot-swap disk drive support for easy replacement

So, some questions:

1. How did you unplug the drive ?
You do realise that SATA only supports hot-swap when you unplug the power cable, since that is what has the hotswap capability built-in ?
If you try to unplug the data cable first you may indeed get screwed...

2. What options - if any - have you set in the HA BIOS for this support ?
3. Doesn't the card need a driver to take full advantage of all capabilities ? They usually do.
This will be a binary-only driver, coupled with a specific kernel version.

I have no idea if any of the above apply, but a working hotswap system should never exhibit this kind of behaviour - after all, that's what you're paying for, right?
_________________
>>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen
Back to top
View user's profile Send private message
alexraasch
Tux's lil' helper
Tux's lil' helper


Joined: 14 Nov 2003
Posts: 94
Location: Rostock, Germany

PostPosted: Wed Jul 06, 2005 4:23 pm    Post subject: Reply with quote

The hard disks are ordinary disks. They are installed in a hot-swap drive bay that came with the controller ("enclose kit"). When unplugging, you first have to pull a small release button, then you can pull the disk out. So, I don't know if power or data cable is unplugged first.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum