# Objective
Monitor dirty files memory,
Change to more suitable values. 

What it does: change from default 10 and 50%.

My understanding:
If `(vm.dirty_background_ratio/100) * memory size > largest file size`, then it 
should be ok.[reference needed]

Note: `memory size` may be *available* memory size. Closing your memory-
eating browsers may help.[reference needed]

After editing the dirty values, reboot your system. It helped me.

# Sources: 
- 
https://lonesysadmin.net/2013/12/22/better-linux-disk-caching-performance-vm-dirty_ratio/
- 
http://fooo.fr/~vjeux/github/github-recommandation/db/doc/manual/html/linux-performance-guide.html

# Helpful commands
```
# View one dirty setting
sudo sysctl -n vm.dirty_ratio               # default 10
sudo sysctl -n vm.dirty_background_ratio    # default 50

# View/monitor several settings
cat /etc/sysctl.conf | egrep "dirty|writeback" # config file's dirty, if loaded.
cat /proc/vmstat | egrep "dirty|writeback"  # print dirty
cat /proc/vmstat | egrep "nr_"              # print all nr

# View/monitor several settings : dynamic
watch grep -A 1 dirty /proc/vmstat

# Soft edit dirty ratios
sudo sysctl vm.dirty_background_ratio=50      # set variable's value
sudo sysctl vm.dirty_ratio=80                 # set variable's value

# Hard edit config file
sudoedit /etc/sysctl.conf                     # hard edit config file.
#vm.dirty_background_ratio = 50               # add without the hashtag
#vm.dirty_ratio = 80                          # add without the hashtag
#                                     # Save with nano : CTRL+X, then y
sudo sysctl -p     # reload current config file. Resets soft variables.

# Check changes
cat /etc/sysctl.conf | egrep "dirty|writeback"  #
cat /proc/vmstat | egrep "dirty|writeback"      #
```


# Proposed diagnosize for your steps
Before and after changing dirty values.

```
# 1. System is waiting
cat /proc/vmstat | egrep "dirty|writeback"

# 2. Just started copy
cat /proc/vmstat | egrep "dirty|writeback"

# 3. Copy is staled
cat /proc/vmstat | egrep "dirty|writeback"

# 4. Just cancelled copy via mouse
cat /proc/vmstat | egrep "dirty|writeback"

# 5. Waiting = nr_dirt goes down
cat /proc/vmstat | egrep "dirty|writeback"

# 6. Back to normal.
cat /etc/sysctl.conf | egrep "dirty|writeback"
```

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1208993

Title:
  Ubuntu slows down and hangs while copying file from/to USB

Status in linux package in Ubuntu:
  Confirmed

Bug description:
  Hi

  While copying many and large files to and from a USB drive, the system
  becomes incredibly slow and sometimes hangs. I watched the system
  monitor while it was running slowly but cpu was not above 50% at any
  time, the same for memory.

  I'm using the "WD my passport" HD with a USB3 port of my "ASUS K55VD"
  laptop.

  Description:  Ubuntu 13.04
  Release:      13.04

  nautilus:
    Installed: 1:3.6.3-0ubuntu16
    Candidate: 1:3.6.3-0ubuntu16
    Version table:
   *** 1:3.6.3-0ubuntu16 0
          500 http://ubuntu-archive.mirror.nucleus.be/ raring/main amd64 
Packages
          100 /var/lib/dpkg/status

  
  Steps to reproduce:
  1) Aquire many large files (like your totally legit moviecollection)
  2) Copy files to external HD
  3) Open your browser and be sad when your system becomes incredibly slow 
after a few minutes


  This is my first bugreport so if I'm missing something, please tell
  me.

  ProblemType: Bug
  DistroRelease: Ubuntu 13.04
  Package: nautilus 1:3.6.3-0ubuntu16
  ProcVersionSignature: Ubuntu 3.8.0-27.40-generic 3.8.13.4
  Uname: Linux 3.8.0-27-generic x86_64
  ApportVersion: 2.9.2-0ubuntu8.1
  Architecture: amd64
  Date: Tue Aug  6 22:56:34 2013
  EcryptfsInUse: Yes
  ExecutablePath: /usr/bin/nautilus
  GsettingsChanges:
   b'org.gnome.nautilus.window-state' b'geometry' b"'656x715+154+151'"
   b'org.gnome.nautilus.window-state' b'maximized' b'true'
  InstallationDate: Installed on 2013-05-31 (67 days ago)
  InstallationMedia: Ubuntu 13.04 "Raring Ringtail" - Release amd64 (20130424)
  MarkForUpload: True
  SourcePackage: nautilus
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1208993/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to