Linux Lite Forums

Hardware - Support => Hard Drives and SSDs => Topic started by: then00b on September 05, 2016, 12:43:44 PM

Title: Defrag
Post by: then00b on September 05, 2016, 12:43:44 PM
How can I defrag on this OS?
Title: Re: Defrag
Post by: Wirezfree on September 05, 2016, 02:16:07 PM
There are varying opinions on the need to defrag Linux in normal desktop day to day usage, and only required for heavy duty servers/databases etc...

But to Check & Defrag your root /
Code: [Select]
sudo e4defrag -c /
sudo e4defrag -v /

To check & defrag /home
Code: [Select]
sudo e4defrag -c /home
sudo e4defrag -v /home


More details on e4defrag (http://manpages.ubuntu.com/manpages/trusty/man8/e4defrag.8.html)
Title: Re: Defrag
Post by: richtea on September 05, 2016, 02:20:25 PM
Got an SSD?
Forget it for your own good.
Title: Re: Defrag
Post by: Wirezfree on September 05, 2016, 03:05:47 PM
@richtea

You raise a good point, however:
1. Read/Write issues with the current(new) generation of technology removes this issue.
   SSD are widely used now in data centres without issues where read/writes are many, many magnitudes greater than home users

2. Also the regular disks/spinners read/write sequentially, hence the need to keep everything aligned by defraging
   SSD's work completely different, they have controllers that work with the random data placement, so defraging is less of an issue.
 
Title: Re: Defrag
Post by: then00b on September 06, 2016, 07:14:33 AM
There are varying opinions on the need to defrag Linux in normal desktop day to day usage, and only required for heavy duty servers/databases etc...

But to Check & Defrag your root /
Code: [Select]
sudo e4defrag -c /
sudo e4defrag -v /

To check & defrag /home
Code: [Select]
sudo e4defrag -c /home
sudo e4defrag -v /home


More details on e4defrag (http://manpages.ubuntu.com/manpages/trusty/man8/e4defrag.8.html)

Hey man! Thanks! The reason I want to defrag it coz my laptop is getting slower, I don't have a lot of files. So, I'm hoping it could solve the problem. :)
Title: Re: Defrag
Post by: richtea on September 06, 2016, 08:30:46 AM
There is just one correct answer to:

How can I defrag on this OS?

Namely: "But why?"

Now we know:

I want to defrag it coz my laptop is getting slower, I don't have a lot of files. So, I'm hoping it could solve the problem. :)

Not a lot of files, so why fragmentation in particular should be the cause of a slowdown? It is more like trying to take a pot shot at the issue.

On Linux, generally, defragging is an exercise in futility. There are just two scenarios when it might have an effect:

1. Massive databases that are continuously amended.
2. HD packed to the gills with stuff.

Having used Linux OSs for some 15 years now, I have never, ever had to defrag. Frankly, I do not think there is much dissenting opinion on that.
Title: Re: Defrag
Post by: Jerry on September 06, 2016, 09:08:57 AM
Agree with richtea, no point in defragging in linux, but if it gives you peace of mind then go for it.

Sent from my Nexus 6 using Tapatalk

Title: Re: Defrag
Post by: firenice03 on September 06, 2016, 10:03:00 AM
Just my plugged nickle and to maybe add help to then00b....  ;)

Defragging was the go to for Windows for PC slowness, usually; clear temps, cache, disk clean up and defrag...

You can also use "Lite Tweaks" to clean up/maintain the system similarly to disk clean up.. Anything marked safe is a no brainer; those marked caution are more so for specific fixes for problems so be mindful when selecting.

For slowness, maybe adding a bit more info; when are you noticing the slow down.. browsing, working with "XX" application or in general = boot up etc..
Along with system specs or the output of
Code: [Select]
inxi -F

Title: Re: Defrag
Post by: then00b on September 06, 2016, 11:15:01 AM
Just my plugged nickle and to maybe add help to then00b....  ;)

Defragging was the go to for Windows for PC slowness, usually; clear temps, cache, disk clean up and defrag...

You can also use "Lite Tweaks" to clean up/maintain the system similarly to disk clean up.. Anything marked safe is a no brainer; those marked caution are more so for specific fixes for problems so be mindful when selecting.

For slowness, maybe adding a bit more info; when are you noticing the slow down.. browsing, working with "XX" application or in general = boot up etc..
Along with system specs or the output of
Code: [Select]
inxi -F

I've tried defrag already. Still the same, still lag.
Here's the specs:
System:    Host: linuxlite-Aspire-5560 Kernel: 4.4.0-36-generic x86_64 (64 bit)
           Desktop: Xfce 4.12.3 Distro: Ubuntu 16.04 xenial
Machine:   System: Acer (portable) product: Aspire 5560 v: 0.1
           Mobo: Acer model: Aspire 5560 v: A11
           Bios: Phoenix v: V1.15 date: 12/05/2011
CPU:       Quad core AMD A6-3420M APU with Radeon HD Graphics (-MCP-) cache: 4096 KB
           clock speeds: max: 1500 MHz 1: 1200 MHz 2: 1200 MHz 3: 1400 MHz
           4: 900 MHz
Graphics:  Card: Advanced Micro Devices [AMD/ATI] BeaverCreek [Radeon HD 6520G]
           Display Server: X.Org 1.18.3 drivers: ati,radeon (unloaded: fbdev,vesa)
           Resolution: [email protected]
           GLX Renderer: Gallium 0.4 on AMD SUMO (DRM 2.43.0, LLVM 3.8.0)
           GLX Version: 3.0 Mesa 11.2.0
Audio:     Card-1 Advanced Micro Devices [AMD] FCH Azalia Controller
           driver: snd_hda_intel
           Card-2 Advanced Micro Devices [AMD/ATI] BeaverCreek HDMI Audio [Radeon HD 6500D and 6400G-6600G series]
           driver: snd_hda_intel
           Sound: Advanced Linux Sound Architecture v: k4.4.0-36-generic
Network:   Card-1: Broadcom NetLink BCM57785 Gigabit Ethernet PCIe driver: tg3
           IF: p4p1 state: down
           Card-2: Broadcom BCM43227 802.11b/g/n driver: wl
           IF: wlp2s0 state: up
Drives:    HDD Total Size: 500.1GB (3.7% used)
           ID-1: /dev/sda model: Hitachi_HTS54505 size: 500.1GB
Partition: ID-1: / size: 455G used: 14G (4%) fs: ext4 dev: /dev/sda1
           ID-2: swap-1 size: 3.73GB used: 0.01GB (0%) fs: swap dev: /dev/sda5
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 50.2C mobo: 43.0C gpu: 51.0
           Fan Speeds (in rpm): cpu: N/A
Info:      Processes: 207 Uptime: 4:21 Memory: 1723.5/3422.1MB
           Client: Shell (bash) inxi: 2.2.35

http://askubuntu.com/questions/515126/how-to-make-ubuntu-14-04-run-with-less-lag I've tried searching for solutions and I found this. What do you think?
Title: Re: Defrag
Post by: Jerry on September 06, 2016, 12:49:05 PM
Your specs aren't that bad. You'd be better off upgrading to a cheap SSD. Your hard drive is pretty low spec.

Sent from my Nexus 6 using Tapatalk

Title: Re: Defrag
Post by: firenice03 on September 06, 2016, 12:51:40 PM
A couple things -
Lag and Slowness are a bit general - are you having the same lag hovering over icons?
You're using LL3.0 Ubuntu base is 16.04; 14.04 fixes may or may not resolve exactly...

For the hardware you shouldn't notice any slowness in general...
If the slowness is similar to the icons as with the link provided - it maybe graphics related (updating driver) but I'm going to take a stab and say the slowness you're experiencing is related to internet browsing/connectivity??? Again this is my guess as I see its a Broadcom  ;)

I'm curious to what's slow for you..
Pinpointing exactly will yield different drivers to update/support.

Also before updating drivers; I would suggest making a Systemback backup, if updating drivers have an ill effect it will be easy to revert back.

Some info on Broadcom - https://www.linuxliteos.com/forums/network/(solved)-broadcom-wireless-issue/msg4997/#msg4997
But searching will result a lot of results.. Again if the slowness is network related  :o

I was posting the same time as Jerry... Or as he suggests....
Title: Re: Defrag
Post by: Wirezfree on September 06, 2016, 01:01:23 PM
I concur with Jerry.
I think that HD is a significant source of performance issues...
Benchmark for Hitachi HT54505 (http://hdd.userbenchmark.com/SpeedTest/1400/Hitachi-HTS54505)

I think any recent SSD is going to be a major boost.

You are only using 3.7% of 500GB, so even a cheap 120/128GB would be enough
Title: Re: Defrag
Post by: Wirezfree on September 06, 2016, 01:14:45 PM
@firenice03 raises some good points

Are you seeing laggy internet..??
What does a speed test (http://www.speedtest.net/) give you.?

With that CPU you should not have issues really
Benchmark for: AMD A6-3420M (http://www.cpubenchmark.net/cpu.php?cpu=AMD+A6-3420M+APU&id=22)

On my N3700 (http://www.cpubenchmark.net/cpu.php?cpu=Intel+Pentium+N3700+%40+1.60GHz&id=2513) I get to the desktop from cold boot in @ 10~12secs with a SSD


I think your disk is a bottleneck



Title: Re: Defrag
Post by: richtea on September 06, 2016, 02:33:29 PM
Just to check on the HD as likely culprit, go to Disks, press CTRL+S, and look over your SMART Data.
Curiosity kills the cat.
Title: Re: Defrag
Post by: Wirezfree on September 06, 2016, 03:30:14 PM
You can also do a quick test on the disk:

Use whatever your sdx is, a, b, c

For comparison,
On a good WD Hard Disk
Code: [Select]
sudo hdparm -t /dev/sdb/dev/sdb:
 Timing buffered disk reads: 332 MB in  3.00 seconds = 110.57 MB/sec

On Samsung SSD
Code: [Select]
sudo hdparm -t /dev/sda/dev/sda:
 Timing buffered disk reads: 1494 MB in  3.00 seconds = 497.68 MB/sec



Title: Re: Defrag
Post by: then00b on September 08, 2016, 09:38:55 AM
You can also do a quick test on the disk:

Use whatever your sdx is, a, b, c

For comparison,
On a good WD Hard Disk
Code: [Select]
sudo hdparm -t /dev/sdb/dev/sdb:
 Timing buffered disk reads: 332 MB in  3.00 seconds = 110.57 MB/sec

On Samsung SSD
Code: [Select]
sudo hdparm -t /dev/sda/dev/sda:
 Timing buffered disk reads: 1494 MB in  3.00 seconds = 497.68 MB/sec
This is what I got:

Timing buffered disk reads: 244 MB in  3.01 seconds =  81.03 MB/sec


Title: Re: Defrag
Post by: then00b on September 08, 2016, 09:44:49 AM
Disks:

(https://s12.postimg.org/o0vrc4n59/Screenshot_2016_09_08_21_40_10.png)

(https://s9.postimg.org/vwxlfxda7/Screenshot_2016_09_08_21_41_00.png)
Title: Re: Defrag
Post by: Wirezfree on September 08, 2016, 09:45:04 AM
It's O.K, but 5 to 6X slower than an SSD
Title: Re: Defrag
Post by: then00b on September 08, 2016, 09:47:00 AM
It's O.K, but 5 to 6X slower than an SSD

I've installed a virtual machine do you think it's possible to run it with this specs? I'm planning to install windows in it.
Title: Re: Defrag
Post by: then00b on September 08, 2016, 09:50:22 AM
A couple things -
Lag and Slowness are a bit general - are you having the same lag hovering over icons?
You're using LL3.0 Ubuntu base is 16.04; 14.04 fixes may or may not resolve exactly...

For the hardware you shouldn't notice any slowness in general...
If the slowness is similar to the icons as with the link provided - it maybe graphics related (updating driver) but I'm going to take a stab and say the slowness you're experiencing is related to internet browsing/connectivity??? Again this is my guess as I see its a Broadcom  ;)

I'm curious to what's slow for you..
Pinpointing exactly will yield different drivers to update/support.

Also before updating drivers; I would suggest making a Systemback backup, if updating drivers have an ill effect it will be easy to revert back.

Some info on Broadcom - https://www.linuxliteos.com/forums/network/(solved)-broadcom-wireless-issue/msg4997/#msg4997
But searching will result a lot of results.. Again if the slowness is network related  :o

I was posting the same time as Jerry... Or as he suggests....

Hmm.. I wish I can explain it more accurately. It's not slow like a speed of a car, it's more laggy for example minimizing a browser it tends to leave some kind of trail some sort of a shadow.
Title: Re: Defrag
Post by: firenice03 on September 08, 2016, 03:30:50 PM
To me... That sounds more related to the graphics driver... Shadowed/delayed/ghosted images, more so as if the the video is refreshing slower..

If you wanted to update the video driver, I would make a systemback backup as the first thing.. If the updated driver doesn't work you can easily revert back.

Give the manual a read https://www.linuxliteos.com/manual/hardware.html#graphics
Then you could check in the Install Drivers (type from menu) to see if any better drivers are available.. (listed in the manual)
As well as searching the forums for ATI or AMD or Radeon for hits..
Title: Re: Defrag
Post by: then00b on September 09, 2016, 05:09:22 AM
To me... That sounds more related to the graphics driver... Shadowed/delayed/ghosted images, more so as if the the video is refreshing slower..

If you wanted to update the video driver, I would make a systemback backup as the first thing.. If the updated driver doesn't work you can easily revert back.

Give the manual a read https://www.linuxliteos.com/manual/hardware.html#graphics (https://www.linuxliteos.com/manual/hardware.html#graphics)
Then you could check in the Install Drivers (type from menu) to see if any better drivers are available.. (listed in the manual)
As well as searching the forums for ATI or AMD or Radeon for hits..



This is what I got on additional drivers:

(https://s9.postimg.org/f5twz5wu7/Screenshot_2016_09_09_17_04_03.png)

sudo lshw -C display result:

Code: [Select]
*-display               
       description: VGA compatible controller
       product: BeaverCreek [Radeon HD 6520G]
       vendor: Advanced Micro Devices, Inc. [AMD/ATI]
       physical id: 1
       bus info: pci@0000:00:01.0
       version: 00
       width: 32 bits
       clock: 33MHz
       capabilities: pm pciexpress msi vga_controller bus_master cap_list rom
       configuration: driver=radeon latency=0
       resources: irq:27 memory:e0000000-efffffff ioport:2000(size=256) memory:f0200000-f023ffff
Title: Re: Defrag
Post by: firenice03 on September 09, 2016, 09:32:32 AM
An additional thought...
Have you configured/added any additional graphical themes/functionality - Compiz etc..??
- If so, perhaps setting back to a LL default config to confirm if issue persists..


Here are a couple threads regarding AMD and LL that may enlighten..

https://www.linuxliteos.com/forums/start-up-and-shutdown/shutdown-problems-andor-sluggish-system-w-amd-graphics/msg20292/#msg20292

https://www.linuxliteos.com/forums/video-cards/amd-drivers-which-to-use/msg24811/#msg24811
Title: Re: Defrag
Post by: then00b on September 10, 2016, 07:45:05 AM
An additional thought...
Have you configured/added any additional graphical themes/functionality - Compiz etc..??
- If so, perhaps setting back to a LL default config to confirm if issue persists..


Here are a couple threads regarding AMD and LL that may enlighten..

https://www.linuxliteos.com/forums/start-up-and-shutdown/shutdown-problems-andor-sluggish-system-w-amd-graphics/msg20292/#msg20292

https://www.linuxliteos.com/forums/video-cards/amd-drivers-which-to-use/msg24811/#msg24811

I need help! Please! I've tried this: http://ajreissig.com/eliminate-screen-tearing-amd-graphics/

I did it accordingly. But, after the last part. I reboot it and it supposed to boot normally but now its all black screen. Please help!
Title: Re: Defrag
Post by: firenice03 on September 10, 2016, 09:19:40 AM
Try after it has boots to the blank screen...

Press CTRL + ALT + F1
You should come up to a tty1 screen prompting for login... Do so.. You will be at a command prompt...

From there try the commands suggested to revert:

After reboot, you will find screen tearing has been eliminate. If you wish to revert the changes, open the terminal and add the following:

Code: [Select]
sudo rm /etc/X11/xorg.conf.d/20-amd.conf
Code: [Select]
sudo reboot
Title: Re: Defrag
Post by: gold_finger on September 10, 2016, 09:25:20 AM
*********************************************************************************************************************************
EDIT:
  firenice03 responded before I finished and posted this.  Try that solution first -- it's easier than my instructions below, but is doing exactly the same thing.
*********************************************************************************************************************************

I don't know a lot about fixing graphic card issues, (so can't be much help with that), but I can help you reverse what you did according to that link.

Hopefully you still have the live install dvd/usb that you used to install LL.  If not, make another.

Boot computer with your live dvd/usb.

Open a terminal and enter this command to list the partitions on your hard drive.
Code: [Select]
sudo parted -l (Command ends in a lowercase letter "L", not the number "1".)

Find your LL root partition and make note of which partition it is (eg. /dev/sda1, /dev/sda5, etc.).  Assuming you did a standard installation that results in one root partition and one swap partition, just look for the partition that shows "ext4" under the "File system" column of the output.  If you have a root/home/swap setup, you'll see two with "ext4".  The smaller of the two partitions will be the root partition in that case (unless you have a very strange setup).

Substitute your correct partition in place of my example of /dev/sdXY in the command below.  (X is the drive letter -- eg. a,b,c -- Y is the partition number -- 1,2,3.  Command will mount the root partition to the live environment so you can get to the file you made from that tutorial.
Code: [Select]
sudo mount /dev/sdXY /mnt
Now we'll just delete the file you made in tutorial so it doesn't get used on further boots.  Enter this command to do that.
Code: [Select]
sudo rm /mnt/etc/X11/xorg.conf.d/20-amd.conf
Now unmount the partition with this command.
Code: [Select]
sudo umount /mnt
Shutdown, remove live dvd/usb, boot back up and should be back to way it was before that change.
Title: Re: Defrag
Post by: then00b on September 10, 2016, 09:35:59 AM
Try after it has boots to the blank screen...

Press CTRL + ALT + F1
You should come up to a tty1 screen prompting for login... Do so.. You will be at a command prompt...

From there try the commands suggested to revert:

After reboot, you will find screen tearing has been eliminate. If you wish to revert the changes, open the terminal and add the following:

Code: [Select]
sudo rm /etc/X11/xorg.conf.d/20-amd.conf
Code: [Select]
sudo reboot

I put my username and password correctly but it still incorrect. What to do?
Title: Re: Defrag
Post by: firenice03 on September 10, 2016, 09:43:11 AM
Quote
I put my username and password correctly but it still incorrect. What to do?

Incorrect password?
Type password into login, confirm correct - - perhaps a numlock issue

******************************
A second thought I had... And not to step on gold_fingers fingers lol...

If you can get to the tty and you did make a systemback backup..
The following command will initiate the systemback command line interface...

Code: [Select]
sudo systemback-cli
Choose the restore point and follow prompts...
Title: Re: Defrag
Post by: then00b on September 10, 2016, 09:55:50 AM
It didn't work, still incorrect. No command prompt as well. I didn't back it up, :(.
Title: Re: Defrag
Post by: firenice03 on September 10, 2016, 10:13:47 AM
If can't access the tty - try gold_fingers suggestion ...
Title: Re: Defrag
Post by: then00b on September 10, 2016, 10:28:30 AM
If can't access the tty - try gold_fingers suggestion ...


Is there a way to save my files on a usb on this situation? I'm planning to reinstall the OS.
Title: Re: Defrag
Post by: then00b on September 10, 2016, 11:16:29 AM
*********************************************************************************************************************************
EDIT:
  firenice03 responded before I finished and posted this.  Try that solution first -- it's easier than my instructions below, but is doing exactly the same thing.
*********************************************************************************************************************************

I don't know a lot about fixing graphic card issues, (so can't be much help with that), but I can help you reverse what you did according to that link.

Hopefully you still have the live install dvd/usb that you used to install LL.  If not, make another.

Boot computer with your live dvd/usb.

Open a terminal and enter this command to list the partitions on your hard drive.
Code: [Select]
sudo parted -l (Command ends in a lowercase letter "L", not the number "1".)

Find your LL root partition and make note of which partition it is (eg. /dev/sda1, /dev/sda5, etc.).  Assuming you did a standard installation that results in one root partition and one swap partition, just look for the partition that shows "ext4" under the "File system" column of the output.  If you have a root/home/swap setup, you'll see two with "ext4".  The smaller of the two partitions will be the root partition in that case (unless you have a very strange setup).

Substitute your correct partition in place of my example of /dev/sdXY in the command below.  (X is the drive letter -- eg. a,b,c -- Y is the partition number -- 1,2,3.  Command will mount the root partition to the live environment so you can get to the file you made from that tutorial.
Code: [Select]
sudo mount /dev/sdXY /mnt
Now we'll just delete the file you made in tutorial so it doesn't get used on further boots.  Enter this command to do that.
Code: [Select]
sudo rm /mnt/etc/X11/xorg.conf.d/20-amd.conf
Now unmount the partition with this command.
Code: [Select]
sudo umount /mnt
Shutdown, remove live dvd/usb, boot back up and should be back to way it was before that change.

(https://s13.postimg.org/du76fl28n/IMG_20160910_230300919.jpg)

I'm quite confused on the second step, can you do it for me please. The drive letter part.
Title: Re: Defrag
Post by: firenice03 on September 10, 2016, 11:24:15 AM
sudo mount /dev/sdXY /mnt

sda1 is the primary ext4 (root)
sda2 is the extended
sda5 is swap
sdb1 is the cruizer

so
Code: [Select]
sudo mount /dev/sda1 /mnt*note the space after the 1 and /mnt
Title: Re: Defrag
Post by: then00b on September 10, 2016, 11:28:24 AM
sudo mount /dev/sdXY /mnt

sda1 is the primary ext4 (root)
sda2 is the extended
sda5 is swap
sdb1 is the cruizer

so
Code: [Select]
sudo mount /dev/sda1 /mnt*note the space after the 1 and /mnt

Thank you sir! :) It worked! Thank you for your great effort! Thank you everyone!
Title: Re: Defrag
Post by: firenice03 on September 10, 2016, 12:07:58 PM
Glad you back in business  ;D
Title: Re: Defrag
Post by: Wirezfree on September 10, 2016, 12:38:33 PM
+1 firenice03 & goldfinger

What a great community we have here, not forgetting a great distro(Jerry) around which it is built....