Hi, How do I do a defrag in ubuntu

Asked by Yanick

I don't know how to do a disk check in ubuntu 6.10
Do I need to?
Also, defrag...?
Do I need to?
Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Lennart Hansen
Solved:
Last query:
Last reply:
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) said :
#1

If you used ext3 as the (default) filesystem then every 30 times you boot your computer it will do a filesystem check using the command "fsck". You can boot to recovery mode (press ESC at the GRUB menu then choose recovery) and from there run fsck against your hard disk. If it is an IDE disk then it will be "/dev/hda":-

fsck /dev/hda1

For example will be the first partition on the first IDE drive.

However if there is a problem it will likey get detected at boot up so you generally dont need to worry about doing it pro-actively.

Defragging, no, not required.

Revision history for this message
Carles Oriol (carlesoriol) said :
#2

if your disk is serial ata may be:

fsck /dev/sda1

Disk ID: [s or h]d[a..z][number of partition]

Ex: 3 partition of your 2 disk serial ata would be: /dev/sdb3

Revision history for this message
Best Lennart Hansen (lahansen) said :
#3

You can find your disk information with fdisk -l

e.g.

# fdisk -l

Disk /dev/sda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot Start End Blocks Id System
/dev/sda1 1 1044 8385898+ 83 Linux
/dev/sda2 1045 7232 49705110 83 Linux
/dev/sda3 7233 7296 514080 82 Linux swap / Solaris

In this case I can "fsck" /dev/sda1 and /dev/sda2 cause they contain a Linux filesystem.

Revision history for this message
Yanick (yanbuntu) said :
#4

User confirmed that the request is solved.

Revision history for this message
Vikram Dhillon (dhillon-v10) said :
#5

You don't have to :D that's one of the most amazing things about
Ubuntu and its filesystem. There is no need to defrag unless you very
frequently use p2p and have less than 15 gigs of space left on your
computer. Other than that ext4 and ext3 automatically manage any
fragments that might be created.

--
Regards,
Vikram Dhillon

~~~
There are lots of Linux users who don't care how the kernel works, but
only want to use it. That is a tribute to how good Linux is.
-- Linus Torvalds

On Thu, Dec 31, 2009 at 10:28 AM, wyvern9
<email address hidden> wrote:
> Question #4299 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/4299
>
> Summary changed to:
> Hi, How do I do a defrag in ubuntu
>
> --
> You received this question notification because you are an answer
> contact for Ubuntu.
>