# HELP - Slow creating/Deleting large files

## harrinp1

I'm having issues creating/deleting large files on my Gentoo  system

running 2.4.26(x86).

I recently rebuilt the system after a disk problem and setup software

raid and reiserfs (not V4) on /home.

When creating large files the system becomes unreasponsive for

long periods when a file grows to greater that >450Meg.

I initially thought this might be a reiser/raid problem but after

breaking the raid and changing to xfs I am still seeing issues.

It is also taking about 90 seconds to delete a 450 Meg file.

Sorry if this is a FAQ but I couldn't find anything via search.

Tia

PaulLast edited by harrinp1 on Wed Oct 13, 2004 7:56 am; edited 1 time in total

----------

## Nate_S

Hmm that's odd that it does it with xfs, as it is supposted to be one of the fastest (second only to jfs) at deleting large files...

----------

## harrinp1

 *Nate_S wrote:*   

> Hmm that's odd that it does it with xfs, as it is supposted to be one of the fastest (second only to jfs) at deleting large files...

 

Yes it doesn't seem related to the filesystem or the raid.

I'm wondering if its releated to a kernel tunable that

I've missed.

----------

## Nate_S

are you sure dma's on?

hdparm -d /dev/whatever

also post hdparm -tT

-Nate

----------

## harrinp1

/etc/conf.d/hdparm containts:

all_args="-d 1 -A 1 -m 16 -u 1 -a 64"

# hdparm -tT /dev/hde4

/dev/hde4:

 Timing cached reads:   1372 MB in  2.00 seconds = 686.00 MB/sec

 Timing buffered disk reads:  136 MB in  3.04 seconds =  44.74 MB/sec

----------

## Nate_S

Ok, so it seems that the hd isn't the problem...

is there anything odd in your dmesg?

If nothing else works, you might try a 2.6 kernel and see if the problem persists.  

-Nate

----------

## harrinp1

Can I just install a 2.6 kernel or do I need to do any extra work?

Here is the output of dmesg:-

-------------------------------------------------------------------------------

Linux version 2.4.26-gentoo-r9 (root@calzone) (gcc version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6))

 #12 Tue Oct 12 20:11:40 BST 2004

BIOS-provided physical RAM map:

 BIOS-e820: 0000000000000000 - 000000000009d400 (usable)

 BIOS-e820: 000000000009d400 - 00000000000a0000 (reserved)

 BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)

 BIOS-e820: 0000000000100000 - 000000003fffc000 (usable)

 BIOS-e820: 000000003fffc000 - 000000003ffff000 (ACPI data)

 BIOS-e820: 000000003ffff000 - 0000000040000000 (ACPI NVS)

 BIOS-e820: 00000000fec00000 - 00000000fec01000 (reserved)

 BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)

 BIOS-e820: 00000000ffff0000 - 0000000100000000 (reserved)

Warning only 896MB will be used.

Use a HIGHMEM enabled kernel.

896MB LOWMEM available.

On node 0 totalpages: 229376

zone(0): 4096 pages.

zone(1): 225280 pages.

zone(2): 0 pages.

Kernel command line: root=/dev/md2 hda=ide-scsi vga=788

ide_setup: hda=ide-scsi

Initializing CPU#0

Detected 2002.483 MHz processor.

Console: colour dummy device 80x25

Calibrating delay loop... 3997.69 BogoMIPS

Memory: 904592k/917504k available (1676k kernel code, 12516k reserved, 127k data, 312k init, 0k highmem)

Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes)

Inode cache hash table entries: 65536 (order: 7, 524288 bytes)

Mount cache hash table entries: 512 (order: 0, 4096 bytes)

Buffer cache hash table entries: 65536 (order: 6, 262144 bytes)

Page-cache hash table entries: 262144 (order: 8, 1048576 bytes)

CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)

CPU: L2 Cache: 256K (64 bytes/line)

Intel machine check architecture supported.

Intel machine check reporting enabled on CPU#0.

CPU:     After generic, caps: 0383fbff c1c3fbff 00000000 00000000

CPU:             Common caps: 0383fbff c1c3fbff 00000000 00000000

CPU: AMD Athlon(TM) XP 2400+ stepping 01

Enabling fast FPU save and restore... done.

Enabling unmasked SIMD FPU exception support... done.

Checking 'hlt' instruction... OK.

POSIX conformance testing by UNIFIX

PCI: PCI BIOS revision 2.10 entry at 0xf17e0, last bus=1

PCI: Using configuration type 1

PCI: Probing PCI hardware

PCI: Probing PCI hardware (bus 00)

PCI: Using IRQ router VIA [1106/3147] at 00:11.0

Linux NET4.0 for Linux 2.4

Based upon Swansea University Computer Society NET3.039

Initializing RT netlink socket

Starting kswapd

Journalled Block Device driver loaded

devfs: v1.12c (20020818) Richard Gooch (rgooch@atnf.csiro.au)

devfs: boot_options: 0x1

vesafb: framebuffer at 0xe8000000, mapped to 0xf8800000, size 1875k

vesafb: mode is 800x600x16, linelength=1600, pages=7

vesafb: protected mode interface info at c000:5b8f

vesafb: scrolling: redraw

vesafb: directcolor: size=0:5:6:5, shift=0:11:5:0

Console: switching to colour frame buffer device 100x37

fb0: VESA VGA frame buffer device

pty: 256 Unix98 ptys configured

Serial driver version 5.05c (2001-07-0 :Cool:  with MANY_PORTS SHARE_IRQ SERIAL_PCI enabled

ttyS00 at 0x03f8 (irq = 4) is a 16550A

floppy0: no floppy controllers found

8139too Fast Ethernet driver 0.9.26

PCI: Found IRQ 3 for device 00:0f.0

eth0: RealTek RTL8139 at 0xf89d6000, 00:40:f4:3c:93:ce, IRQ 3

eth0:  Identified 8139 chip type 'RTL-8139C'

Linux agpgart interface v0.99 (c) Jeff Hartmann

agpgart: Maximum main memory to use for agp memory: 816M

agpgart: Detected Via Apollo Pro KT266 chipset

agpgart: AGP aperture is 128M @ 0xf0000000

[drm] Initialized tdfx 1.0.0 20010216 on minor 0

[drm] AGP 0.99 Aperture @ 0xf0000000 128MB

[drm] Initialized radeon 1.7.0 20020828 on minor 1

[drm] AGP 0.99 Aperture @ 0xf0000000 128MB

[drm] Initialized i810 1.2.1 20020211 on minor 2

Uniform Multi-Platform E-IDE driver Revision: 7.00beta4-2.4

ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx

PDC20276: IDE controller at PCI slot 00:06.0

PCI: Found IRQ 7 for device 00:06.0

PCI: Sharing IRQ 7 with 00:09.0

PDC20276: chipset revision 1

PDC20276: not 100% native mode: will probe irqs later

    ide2: BM-DMA at 0xb000-0xb007, BIOS settings: hde:pio, hdf:pio

    ide3: BM-DMA at 0xb008-0xb00f, BIOS settings: hdg:pio, hdh:pio

hda: SONY DVD RW DRU-500A, ATAPI CD/DVD-ROM drive

hde: Maxtor 6Y080L0, ATA DISK drive

blk: queue c0145e58, I/O limit 4095Mb (mask 0xffffffff)

hdg: Maxtor 6Y080L0, ATA DISK drive

blk: queue c01462b4, I/O limit 4095Mb (mask 0xffffffff)

ide0 at 0x1f0-0x1f7,0x3f6 on irq 14

ide2 at 0xd400-0xd407,0xd002 on irq 7

ide3 at 0xb800-0xb807,0xb402 on irq 7

hde: attached ide-disk driver.

hde: host protected area => 1

hde: 160086528 sectors (81964 MB) w/2048KiB Cache, CHS=158816/16/63, UDMA(133)

hdg: attached ide-disk driver.

hdg: host protected area => 1

hdg: 160086528 sectors (81964 MB) w/2048KiB Cache, CHS=158816/16/63, UDMA(133)

hda: attached ide-scsi driver.

Partition check:

 /dev/ide/host2/bus0/target0/lun0: p1 p2 p3 p4

 /dev/ide/host2/bus1/target0/lun0: p1 p2 p3 p4

SCSI subsystem driver Revision: 1.00

scsi0 : SCSI host adapter emulation for IDE ATAPI devices

  Vendor: SONY      Model: DVD RW DRU-500A   Rev: 2.0h

  Type:   CD-ROM                             ANSI SCSI revision: 02

Attached scsi CD-ROM sr0 at scsi0, channel 0, id 0, lun 0

sr0: scsi3-mmc drive: 18x/18x writer cd/rw xa/form2 cdda tray

sr0: mmc-3 profile capable, current profile: 1Ah

Uniform CD-ROM driver Revision: 3.12

md: raid0 personality registered as nr 2

md: raid1 personality registered as nr 3

md: md driver 0.90.0 MAX_MD_DEVS=256, MD_SB_DISKS=27

md: Autodetecting RAID arrays.

 [events: 00000025]

 [events: 00000025]

 [events: 00000023]

 [events: 00000025]

 [events: 00000025]

 [events: 00000023]

md: autorun ...

md: considering ide/host2/bus1/target0/lun0/part4 ...

md:  adding ide/host2/bus1/target0/lun0/part4 ...

md:  adding ide/host2/bus0/target0/lun0/part4 ...

md: created md3

md: bind<ide/host2/bus0/target0/lun0/part4,1>

md: bind<ide/host2/bus1/target0/lun0/part4,2>

md: running: <ide/host2/bus1/target0/lun0/part4><ide/host2/bus0/target0/lun0/part4>

md: ide/host2/bus1/target0/lun0/part4's event counter: 00000023

md: ide/host2/bus0/target0/lun0/part4's event counter: 00000023

md: RAID level 1 does not need chunksize! Continuing anyway.

md3: max total readahead window set to 124k

md3: 1 data-disks, max readahead per data-disk: 124k

raid1: device ide/host2/bus1/target0/lun0/part4 operational as mirror 1

raid1: device ide/host2/bus0/target0/lun0/part4 operational as mirror 0

raid1: raid set md3 active with 2 out of 2 mirrors

md: updating md3 RAID superblock on device

md: ide/host2/bus1/target0/lun0/part4 [events: 00000024]<6>(write) ide/host2/bus1/target0/lun0/part4's sb offset: 42243200

md: ide/host2/bus0/target0/lun0/part4 [events: 00000024]<6>(write) ide/host2/bus0/target0/lun0/part4's sb offset: 42243200

md: considering ide/host2/bus1/target0/lun0/part3 ...

md:  adding ide/host2/bus1/target0/lun0/part3 ...

md: created md2

md: bind<ide/host2/bus0/target0/lun0/part3,1>

md: bind<ide/host2/bus1/target0/lun0/part3,2>

md: running: <ide/host2/bus1/target0/lun0/part3><ide/host2/bus0/target0/lun0/part3>

md: ide/host2/bus1/target0/lun0/part3's event counter: 00000025

md: ide/host2/bus0/target0/lun0/part3's event counter: 00000025

md: RAID level 1 does not need chunksize! Continuing anyway.

md2: max total readahead window set to 124k

md2: 1 data-disks, max readahead per data-disk: 124k

raid1: device ide/host2/bus1/target0/lun0/part3 operational as mirror 1

raid1: device ide/host2/bus0/target0/lun0/part3 operational as mirror 0

raid1: raid set md2 active with 2 out of 2 mirrors

md: updating md2 RAID superblock on device

md: ide/host2/bus1/target0/lun0/part3 [events: 00000026]<6>(write) ide/host2/bus1/target0/lun0/part3's sb offset: 36701184

md: ide/host2/bus0/target0/lun0/part3 [events: 00000026]<6>(write) ide/host2/bus0/target0/lun0/part3's sb offset: 36701184

md: considering ide/host2/bus1/target0/lun0/part1 ...

md:  adding ide/host2/bus1/target0/lun0/part1 ...

md:  adding ide/host2/bus0/target0/lun0/part1 ...

md: created md0

md: bind<ide/host2/bus0/target0/lun0/part1,1>

md: bind<ide/host2/bus1/target0/lun0/part1,2>

md: running: <ide/host2/bus1/target0/lun0/part1><ide/host2/bus0/target0/lun0/part1>

md: ide/host2/bus1/target0/lun0/part1's event counter: 00000025

md: ide/host2/bus0/target0/lun0/part1's event counter: 00000025

md: RAID level 1 does not need chunksize! Continuing anyway.

md0: max total readahead window set to 124k

md0: 1 data-disks, max readahead per data-disk: 124k

raid1: device ide/host2/bus1/target0/lun0/part1 operational as mirror 1

raid1: device ide/host2/bus0/target0/lun0/part1 operational as mirror 0

raid1: raid set md0 active with 2 out of 2 mirrors

md: updating md0 RAID superblock on device

md: ide/host2/bus1/target0/lun0/part1 [events: 00000026]<6>(write) ide/host2/bus1/target0/lun0/part1's sb offset: 98176

md: ide/host2/bus0/target0/lun0/part1 [events: 00000026]<6>(write) ide/host2/bus0/target0/lun0/part1's sb offset: 98176

md: ... autorun DONE.

Initializing Cryptographic API

NET4: Linux TCP/IP 1.0 for NET4.0

IP Protocols: ICMP, UDP, TCP, IGMP

IP: routing cache hash table of 8192 buckets, 64Kbytes

TCP: Hash tables configured (established 262144 bind 65536)

NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.

md: swapper(pid 1) used obsolete MD ioctl, upgrade your software to use new ictls.

reiserfs: found format "3.6" with standard journal

reiserfs: checking transaction log (device md(9,2)) ...

for (md(9,2))

md(9,2):Using r5 hash to sort names

VFS: Mounted root (reiserfs filesystem) readonly.

Mounted devfs on /dev

Freeing unused kernel memory: 312k freed

Adding Swap: 1000432k swap-space (priority 1)

Adding Swap: 1000432k swap-space (priority 1)

md: fsck.reiserfs(pid 206) used obsolete MD ioctl, upgrade your software to use new ictls.

reiserfs: found format "3.6" with standard journal

reiserfs: checking transaction log (device ide2(33,4)) ...

for (ide2(33,4))

ide2(33,4):Using r5 hash to sort names

----------

## harrinp1

During some more testing it seems to show

that its not the file size that causes the problem

but seems to be the amount of data written.

If I start appending a 10meg file together

it gets up to 450meg before slowing.

If I start from 450Meg then it gets up to 900meg before

slowing to a crawl again.

If I leave it a couple of minutes before deleting the resulting

file then it deletes quickly.

Regards

Paul

----------

## harrinp1

Here is the output from a small test script that just uses cat to keep appending to a file:-

Thu Oct 14 14:26:00 BST 2004

             total       used       free     shared    buffers     cached

Mem:          1009        396        613          0         60        160

Swap:         1953          0       1953

-rw-r--r--  1 paul users 26M Oct 14 14:26 out

-------------------------------------

{snip}

-------------------------------------

Thu Oct 14 14:26:03 BST 2004

             total       used       free     shared    buffers     cached

Mem:          1009        731        277          0         61        495

Swap:         1953          0       1953

-rw-r--r--  1 paul users 362M Oct 14 14:26 out

-------------------------------------

Thu Oct 14 14:26:03 BST 2004

             total       used       free     shared    buffers     cached

Mem:          1009        757        251          0         61        521

Swap:         1953          0       1953

-rw-r--r--  1 paul users 388M Oct 14 14:26 out

-------------------------------------

Thu Oct 14 14:26:03 BST 2004

             total       used       free     shared    buffers     cached

Mem:          1009        783        225          0         61        547

Swap:         1953          0       1953

-rw-r--r--  1 paul users 413M Oct 14 14:26 out

-------------------------------------

Thu Oct 14 14:26:03 BST 2004

             total       used       free     shared    buffers     cached

Mem:          1009        809        200          0         61        572

Swap:         1953          0       1953

-rw-r--r--  1 paul users 439M Oct 14 14:26 out

-------------------------------------

Thu Oct 14 14:26:04 BST 2004

             total       used       free     shared    buffers     cached

Mem:          1009        835        174          0         61        598

Swap:         1953          0       1953

-rw-r--r--  1 paul users 465M Oct 14 14:26 out

-------------------------------------

Thu Oct 14 14:26:04 BST 2004

             total       used       free     shared    buffers     cached

Mem:          1009        861        148          0         61        624

Swap:         1953          0       1953

-rw-r--r--  1 paul users 491M Oct 14 14:26 out

-------------------------------------

** Just hangs here **

As you can see memory usage seems to shoot up,

is this normal?

----------

## sanyacid

I have exacly the same problem. With kernel 2.6.* and reiserfs (not 4). On this "home pc", duron 1GHz, 80GB hdd.

Never had this problem when I was on kernel 2.4.*...

----------

## harrinp1

Thanks, at least I won't try 2.6 then.  Is your set up mirrored?

----------

## Nate_S

Ok, two things I notice...

It sounds like the slowness after writing a certian amount may be that it is cached in ram until you pass a certian point, and that it is the disk transfers that are slow.  

ide2: BM-DMA at 0xb000-0xb007, BIOS settings: hde:pio, hdf:pio

ide3: BM-DMA at 0xb008-0xb00f, BIOS settings: hdg:pio, hdh:pio 

these lines in your dmesg make me think that your hard drives are not using UDMA mode at all, but rather pio mode.  That would explain the slow transfers.  Make sure you have the right driver for your ide chipset compiled into the kernel.  

Since you're recompiling your kernel anyways...

Warning only 896MB will be used.

Use a HIGHMEM enabled kernel.

896MB LOWMEM available. 

Your kernel is only using 896 MB of your ram.  You'll need to turn on the HIGHMEM option, or, if you have 1G of ram, switch to a kernel that has the 1G_LOWMEM patch, such as this one:

https://forums.gentoo.org/viewtopic.php?t=236511

the switch to 2.6 is really not that difficult at all, and very much wirth it.  it's much faster.  

-Nate

----------

## harrinp1

Thanks Nate, I had already found and fixed the memory issue.

I think UDMA is on as hdparm shows it as well as dmesg:

hde: 160086528 sectors (81964 MB) w/2048KiB Cache, CHS=158816/16/63, UDMA(133)

hdg: 160086528 sectors (81964 MB) w/2048KiB Cache, CHS=158816/16/63, UDMA(133)

As another user has reported a similar problem with 2.6 I don't know if this will fix it, any pointers to a guide on how best to upgrade to 2.6?

Cheers

Paul

----------

## Nate_S

I don't know where there is a guide, but it's really not that hard at all...  in some ways even easier

when you compile it, you now only need to do a make && make modules_install

I'd check that you're using the right IDE driver just in case.  I'm assuming you have an add on card or a seperate raid thing on the mobo, as your drives are hde and hdg; what chipset is that using?  And, are the disks SATA or PATA?

-Nate

----------

## harrinp1

The Mobo is an Asus A7v333 which 

has an extra onboard IDE/Raid controller which

is detected as:

Promise Technology, Inc. PDC20276

I have set the following kernel options:

CONFIG_BLK_DEV_PDC202XX_NEW=y

CONFIG_PDC202XX_FORCE=y

Regards

Paul

----------

## Nate_S

you might temporarly put one of your disks on one of the first two controllers to rule that out.   

I just thought of a way to tell if i'm right about the caching to memory thing.  You might try writing a file under 450 megs, while it's still working fine, and see how long a sync takes.  (could try time sync or something)

I'd still give the 2.6 a try.  

-Nate

----------

## harrinp1

 *Nate_S wrote:*   

> 
> 
> I'd still give the 2.6 a try.  
> 
> -Nate

 

2.6 still seems to have the same problem, only thing thats changed

is now top/iostat show the system being 100% waiting on IO.

----------

## harrinp1

Okay using a 181Meg file I get:-

$ ls -lh out

-rw-r--r--  1 paul users 181M Oct 15 21:52 out

$ cat out > out2 ; time sync

real 1m50.922s

user 0m0.000s

sys  0m0.002s

----------

## Nate_S

yep, that's pretty slow.  

Here's my resutls of a similar test

ls -lh /var/video/1249*

-rw-r--r--  1 root root 285M Oct 14 16:30 /var/video/1249_20041014160000_20041014163000.nuv

cat 1249_20041014160000_20041014163000.nuv > test; time sync

real    0m0.232s

user    0m0.000s

sys     0m0.008s

I'd try putting the disk on the primary ide controller (where your optical is now) and see if the problem persists.  

-Nate

sync; time rm test; time sync

real    0m0.066s

user    0m0.000s

sys     0m0.064s

real    0m0.002s

user    0m0.000s

sys     0m0.002s

This is on XFS

----------

## harrinp1

Things seem to be running a lot smoother now I am

using the standard IDE ports.  Few issues with my mirror

when moving over but now all fixed.

Thanks for the help.

Paul

----------

## Nate_S

Glad it's working.  

I remember reading something relating to my motherboard's highpoint hpt374 controller that you need to let it initilize in it's bios during boot for it to work right (I had it disabled so that it booted faster)  It's still detected and everything without, but it doesnt' work quite right.  You might check if yours is the same.  

If not that, I think the problem is definitly related to your ide chip, I'd try dome different kernels, and google for the chip to see if anyone else has had the same thing with it.  

-Nate

----------

## harrinp1

The bios doesn't allow you to disable the raid, so I think it was

scanning/inializing them.  I even tried a hacked bios with disbaled

raid support.

I did try google but haven't found an anser yet, I can live with

the drives on the main ide controller, I'll just lose the dvd burner.

Thanks for all of your help, now all I need to do is get to grips

with the 2.6 kernel - should I move to udev and should I stick

with the old kernel headers?!

Cheers

Paul

----------

## Nate_S

You can stick with the old headers; it won't really hurt anything, but moving to the 2.6 headers would allow stuff to be more optimized for 2.6, and it doesn't really hurt anything.  

I would highly recommend UDEV.  

Do you have 4 hard drives?  why not just set it up as a master/slave? I'd assume you wouldn't use the dvd burner that often, so it shouldn't affect performace most of the time.  

-Nate

----------

