Third party cookies may be stored when visiting this site. Please see the cookie information.

Removing Windows from a dual boot Windows and Linux computer

I have now removed Windows completely from my home PC/Server. It has been a long, long time since I have booted into Windows as this machine runs Linux 24/7. Windows was left installed in case of applications not running on my laptop which is Vista/Linux (where Vista has a lot of software compatibility problems), I have until now just left Windows installed but unused. Due to running low on my disk drive I have now reclaimed the partition used for Windows and my machine is now 100% Linux only.

Here is details of how to reclaim the disk space. I did reclaimed the space from the command line as I logged into the computer remotely.

Warning! - Read these instructions carefully and make sure you know what you are doing before running any commands. Always make backups before commands that will make these kind of changes to the disk drive

Identify the disk being used by Windows

The first step is to identify what disk (or disks) are being used by Windows. This will normally be the first partition of the first hard drive and on many systems will be /dev/sda1, but don't take that for granted - check first.

Assuming the Windows filesystem is mounted by default then you can normally find it by using the mount command:

$ mount


/dev/sda1 on /media/Windows type ntfs (rw)

The above line shows the partition used on my system by Windows.

This can be identified as it has been mounted in a Windows directory name. This relies on the Linux installer correctly identifying the partition when Linux was installed - so it's not foolproof.

To confirm this is definately the case then I changed to the directory and looked around the sub directories to verify this was in fact the Windows partition that was to be removed.

If the partition is not mounted then you will need to use a partition editor to try and identify the partition by type (normally ntfs or vfat / fat32), and then mount the partition into a temporary directory to confirm that is the one in question.

The directory then needs to be unmounted as it's not a good idea to try editing a mounted partition.

sudo umount /dev/sda1

Reformat the partition as a Linux filesystem

Make sure you are 100% sure about the device name at this point. After issuing these commands there is no going back!

The next stage is to reformat the partition with a suitable filesystem. You could always use the existing ntfs or vfat partition types, but if this is to be a purely Linux machine then it is better to switch to a filesystem that is designed for Linux and that supports the Linux file permission model

Note all the remaining commands are listed against sdaX. On my system this is sda1, but you should not blindly copy and paste these commands.

My system uses ext3 so I decided to use an ext3 filesystem for this partition. I could have used ext4 or reiserfs or any number of alternatives (see Linux Man Page: fs - Filesystems).

The appropriate mkfs command can be used to create the filesystem:

sudo mkfs.ext3 /dev/sdaX

Creating the mount point

At this point the drive has the correct filesystem but we now need to place it somewhere useful. The great think about Linux / Unix is that any filesystem can be mounted at (almost) any position in the filesystem tree. Once it is mounted it is (almost) invisible that the director resides on a different disk. This is much better than using a new drive letter which is the normal way that partitions are handled under Windows.

In my case I have a drive /data/photos with the photos under the appropriate year (eg. /data/photos/2004 or /data/photos/2009). I wanted to move the 2004 and 2005 directories to this new drive. In this case I mounted the new drive as /data/photos/archives to move these folders into. To prevent this breaking anything that uses the old directory names I created links using the old directory names (see later). As I used links this could in fact have been mounted anywhere, but this is the location I chose.

The directory was created using:

mkdir /data/photos/archive

I then edited the /etc/fstab file commenting out the old entry for the Windows filesystem by prefixing the following line with a #.

UUID=08E4A3CDE451BD9E /media/windows ntfs defaults,umask=007,gid=46 0


Note that this doesn't use the friendly /dev/sda1 reference, instead using the UUID of the disk drive. When I create my new entry I will use /dev/sda1 instead as that is easier to read and we already know the device name.

The new entry I created at the bottom of the file as:

/dev/sda1 /data/photos/archive ext3 defaults,relatime 0 0

The filesystem can be mounted using the mount command with the appropriate options, but now it is in the fstab file it can be mounted using

sudo mount -a

which will mount any filesystems listed in the /etc/fstab file and assuming the entry is correct including the new filesystem.

You can verify that it is mounted by using the mount command:



/dev/sda1 on /data/photos/archive type ext3 (rw,relatime)

or by looking at the contents of the directory where there is now a lost+found directory (used for data recovery in certain circumstances). The lost+found directory is an indication that this is now on a separate disk.

Moving the directories into the new filesystem and creating symbolic links to their old directory names

Next the directories can be moved to the archive folder:

cd /data/photos

mv 2004 archive

mv 2005 archive

A symbolic link can be used to make it appear that these directories are still at their old location. Whenever an action is performed on the link then it will be routed to the appropriate file.

ln -s /data/photos/archive/2004 /data/photos/2004

ln -s /data/photos/archive/2005 /data/photos/2005

The photos can now be accessed under their old directory names of /data/photos/2004 etc.

Note that these need to be symbolic links as they are on different filesystems.

Updating the grub bootloader

The final (optional stage) is to now update the grub bootloader so that it doesn't disply the old drive and possibly to reduce the delay in selecting the operating system.

Some systems may still use the older LiLO loader, but only grub is explained in this example.

Edit the file /boot/grub/mmenu.lst

Comment out or delete any lines relating to the Windows partition. For example:

# This entry automatically added by the Debian installer for a non-linux OS

# on /dev/sda1

#title          Windows NT/2000/XP (loader)

#root           (hd0,0)



#chainloader    +1

If Windows is the default then you will need to select an alternative default by editing the default line:

# Set the default entry to the entry number NUM. Numbering starts from 0, and

# the entry number 0 is the default if the command is not used.


# You can specify 'saved' instead of a number. In this case, the default entry

# is the entry saved with the command 'savedefault'.

# WARNING: If you are using dmraid do not use 'savedefault' or your

# array will desync and will not let you boot your system.

default         0

Note that the number for the default entry is the number of the entry counting from 1 upwards.

It is also a good idea to reduce the time taken to default to the appropriate entry:

# Set the default entry to the entry number NUM. Numbering starts from 0, and

# the entry number 0 is the default if the command is not used.


# You can specify 'saved' instead of a number. In this case, the default entry

# is the entry saved with the command 'savedefault'.

# WARNING: If you are using dmraid do not use 'savedefault' or your

# array will desync and will not let you boot your system.

default         0


The configuration is now complete and it is possible to use the new filesystem. There is no need to reboot the computer as everything has been handled dynamically, but I would suggest a reboot to make sure that the drive is correctly configured to mount automatically in future.

One step closer to freedom with a free open source computer.

Related Information

» PenguinTutor Facebook page