3

I am running kubuntu 11.04. I installed it in a dual-boot scenario on a single drive, with Windows XP installed first. The XP installation is fubar so I now would like to use the space in kubuntu.

I formatted the old partition in gparted and upon trying to access it in a file manager I got the following error:

An error occurred while accessing 'space', the system responded: org.freedesktop.UDisks.Error.Inhibited: Daemon is inhibited

I am assuming this error is linked to the fact that the partition doesn't have a mount point, but I may well be wrong. I'd just like to have the filesystem set up so that a folder of my specification is using that drive exclusively (e.g. /home/user/files). From what I understand about mount points, I should be able to do that. I am hoping my changing of this drive won't have anything to do with booting or be system-critical. Is this possible? My drive layout looks like this:

/dev/sda1    ext3    90.76 GiB    this is where the xp installation was located
/dev/sda2    ext3    19.53 GiB    lunix
/dev/sda3    swap    1.49 GiB
unallocated           2.49 MiB

Any help in this would be greatly appreciated, as I am running pretty low on drive space!

Thanks

eggonlegs
  • 154

3 Answers3

3

Just mount them on the folder you want, that won't affect booting or anything dangerous.

First make sure your destination folder ("mount point") exists. You may have to create the folder /path/to/mount/point.

Then mount the drive there using the mount command in a terminal (as root):

mount /dev/sda1 /path/to/mount/point

You may have to change permissions on the folder before you can use it as a normal user:

chown -R your_user_name /path/to/mount/point

When you are satisfied with the setup, edit /etc/fstab to make the system mount the partition automatically. Add the following line:

/dev/sda1    /path/to/mount/point    ext3    defaults,noatime    0    0

Refer to man mount for more information and options.

phunehehe
  • 20,240
2

Assuming your Linux partition is directly in front of the Windows XP partition, you can just resize it to encompass both partitions and then run resize2fs on it to have it grow to the larger size of the partition. It's hard to tell if this is the case without seeing the output of fdisk -l /dev/sda. The numbers associated with sda (i.e. sda1) do not necessarily imply the physical order of the partitions, but usually do.

More likely, it appears the case is that the Windows XP partition is first on the disk. In this case, it is a little trickier as you will need to copy the data to the first partition. You will want to format the destination partition with whatever options you like before attempting to copy anything. If both partitions are Ext2/3/4, I'd recommend using dump/restore as the best option to ensure everything is copied correctly. You can also try using rsync with the -aAHX options. I recommend against trying to just use cp. You should copy the data from single user mode with the source partition mounted read-only. Some bootloaders like what comes with Ubuntu call it recovery mode. The mount command will tell you if the filesystem is read-only with a ro flag on the line for the filesystem. If it's not, you can try using mount -o ro,remount / to remount as read-only. Assuming /dev/sda2 is your source filesystem mounted read-only on path / and /dev/sda1 is the destination partition, the way to use dump and restore would be as follows:

mkfs -t ext3 /dev/sda1
mount /dev/sda1 /mnt
cd /mnt
dump -0af - /dev/sda2 | restore -rf -

Once you are done, you can try switching to it with chroot and reinstalling GRUB.

mount -t bind /dev /mnt/dev
mount -t bind /proc /mnt/proc
mount -t bind /sys /mnt/sys
chroot /mnt /bin/sh
/usr/sbin/grub-install /dev/sda

Once GRUB is using the new partition, you can reboot, verify you are really using the new partition, and then remove the old root partition. Then just expand the new root partition and run resize2fs against it:

resize2fs /dev/sda1

Voilà! You should have a root partition using the full space now.

penguin359
  • 12,077
  • Off topic comment: "viola" means "(he) raped". You'd better write it "voila", or even better "voilà" ! ;-) – jlliagre May 25 '11 at 06:26
  • heh viola (sic.) is also just a pun that's been around since the beginning of time :P – eggonlegs May 25 '11 at 07:35
  • @jlliagre Fixed. That's how I first wrote it, but then I trusted the automatic spell checker to fix my incorrect spelling when all I was missing was the diacritic. – penguin359 May 25 '11 at 07:39
  • Thanks for this. It is a great answer but at this moment I really would rather not play with resizing of partitions. I am sure this would be a safe way to do it but I have lost too many filesystems by playing with partitioning in the past. I would probably have attempted this but I am in exam period at school so it is critical that my system is burning on all cylinders. I will give this method a try after exams, as I would actually prefer to have just the one data partition. Cheers – eggonlegs May 25 '11 at 08:00
1

First of all, it is not a good idea to partition a drive on which your currently running system is located. Do not do that in the future, as it may lead to problems. I suppose you saw the warnings about backing up your data gparted is showing...

There are at least two reasons, why you couldn't mount the partition.

  1. Gparted has only set the partition type to ext3, but not actually created the filesystem.

  2. Even if the filesystem has been created, the disk state was not synced. This operation is done by system at boot up and shutdown, but can also be performed at other time using the sync command. Again, if you can not be sure doing this is safe in your case, do not use it - just reboot the system.

Once you have your partition set up, you will see it as other drives like external storage in file managers or at your desktop. Depending on the system configuration, you may or may not need root privileges to mount it. But of course, adding it to /etc/fstab is the best solution.

  • Yeah I realise it wasn't a good idea, but I had to do something, as I needed the computer urgently! :) – eggonlegs Aug 02 '11 at 12:01
  • Also I don't think it was either of those reasons. It wouldn't let me create a file system, and rebooting didn't help anything! Strange – eggonlegs Aug 02 '11 at 12:02