2

I've read this question Can I resize the root partition without uninstalling and reinstalling Linux (or losing data)? before I ask. But I'm not using LVM when creating the root partition, so I'm not sure whether the solution for the linked question would work for my problem.

I'm using a distribution of Debian Linux called CrunchBang, below is main information of my laptop which may help.
*@*:~$ uname -a
Linux * 3.2.0-4-686-pae #1 SMP Debian 3.2.60-1+deb7u1 i686 GNU/Linux
*@*:~$ sudo df -h
[sudo] password for *: 
Filesystem                                              Size  Used Avail Use% Mounted on
rootfs                                                  323M  259M   48M  85% /
udev                                                     10M     0   10M   0% /dev
tmpfs                                                   294M  636K  294M   1% /run
/dev/disk/by-uuid/da3f8ae3-c79f-4025-accb-1f64bf59ba84  323M  259M   48M  85% /
tmpfs                                                   5.0M     0  5.0M   0% /run/lock
tmpfs                                                   1.8G   43M  1.7G   3% /run/shm
/dev/sda9                                               442G   15G  404G   4% /home
/dev/sda8                                               368M   11M  339M   3% /tmp
/dev/sda5                                               8.3G  6.8G  1.1G  87% /usr
/dev/sda6                                               2.8G  500M  2.2G  19% /var

@:~$ sudo fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0005d608

Device Boot Start End Blocks Id System /dev/sda1 * 2048 684031 340992 83 Linux /dev/sda2 686078 976771071 488042497 5 Extended /dev/sda5 686080 18262015 8787968 83 Linux /dev/sda6 18264064 24121343 2928640 83 Linux /dev/sda7 24123392 36278271 6077440 82 Linux swap / Solaris /dev/sda8 36280320 37058559 389120 83 Linux /dev/sda9 37060608 976771071 469855232 83 Linux

@:~$ mount sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=217630,mode=755) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=300952k,mode=755) /dev/disk/by-uuid/da3f8ae3-c79f-4025-accb-1f64bf59ba84 on / type ext4 (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered) tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k) tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=1817380k) /dev/sda9 on /home type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered) /dev/sda8 on /tmp type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered) /dev/sda5 on /usr type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered) /dev/sda6 on /var type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered) binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime) fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime) gvfs-fuse-daemon on /home/min/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

@:~$ cat /etc/fstab

/etc/fstab: static file system information.

Use 'blkid' to print the universally unique identifier for a

device; this may be used with UUID= as a more robust way to name devices

that works even if disks are added and removed. See fstab(5).

<file system> <mount point> <type> <options> <dump> <pass>

/ was on /dev/sda1 during installation

UUID=da3f8ae3-c79f-4025-accb-1f64bf59ba84 / ext4 errors=remount-ro 0 1

/home was on /dev/sda9 during installation

UUID=a832e353-d0fc-4e87-81fa-d08c77f84e81 /home ext4 defaults 0 2

/tmp was on /dev/sda8 during installation

UUID=5f3e0eab-4f75-44a1-81af-c450d4ff301d /tmp ext4 defaults 0 2

/usr was on /dev/sda5 during installation

UUID=b4c895ff-cb26-4c65-bcd7-3f6cd986756e /usr ext4 defaults 0 2

/var was on /dev/sda6 during installation

UUID=8bedb184-389f-4295-9612-c28a94c81b1e /var ext4 defaults 0 2

swap was on /dev/sda7 during installation

UUID=976ec3fe-7b8e-436b-8c52-05be582f4e32 none swap sw 0 0 /dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0 #/dev/sdb4 /media/usb0 auto rw,user,noauto 0 0

@:~$ sudo vgdisplay No volume groups found @:~$ sudo lvdisplay No volume groups found

Hope someone could give me some advice or material that I can refer to, thanks~

2 Answers2

1

Your root filesystem seems to be on /dev/sda1 (although between the dump of information you give, the useful information as to which partition has UUID da3f8ae3-c79f-4025-accb-1f64bf59ba84 is not available. It could be on another disc altogether).

In your case that is quite difficult to extend as you have an extended partition directly following it. What you could do is:

  1. shrink the /home filesystem
  2. remove and recreated /dev/sda9 (/home) with the same starting block to make enough space for a new partition
  3. create the partition, create ext4 filesystem and copy everything from /dev/sda1 there
  4. update the etc/fstab located on that partition and update the UUID of / thenupdate-grub and reboot and try to select the new entry

An alternative and possible less error prone (since no resizing is involved) route would be to merge the data of sda1 and sda5 and make sda1 /boot:

  1. boot from CD
  2. mount sda5 on /tmp/sda5 and do:

    mkdir /tmp/sda5/usr
    mv /tmp/sda5/* /tmp/sda5/usr
    

    (this will of course complain about not being able to mover usr into itself)

  3. mount sda1 on /tmp/sda1 and copy everything from /tmp/sda1 to /tmp/sda5 except for /tmp/sda1/boot

  4. remove everything on /tmp/sda1 except for the boot directory and its contents
  5. remove the entry for /usr from the fstab and create one for /boot (on sda1).
  6. update the entry for / in fstab
  7. run update-grub, check the menu entry in boot.cfg and reboot

In either case do not start any of this without making a full dump of the system (using dd) so you can restore the current situation.

It might be easier to buy a new disc and create the partition layout on it (with a larger sda1), create filesystems, copy the individuals partition contents and adjust the UUID in the fstab and boot.cfg.

You should IMO also try and find the person guilty for setting this system up in this way and make sure they repent their mistake.

Anthon
  • 79,293
1

Can you extend your root partition? Yes. But you can't do it online*, you need to boot off a live CD or USB stick. Any distribution will do, debian, fedora, kali, etc.

*: technically it can be done but it can get complicated;

Of course to do this you need to find some space. Without using LVM you need to find empty space on the disk immediately after the root partition (sda1? sda8? sda9? it's not obvious from the information you're sharing since root is mounted by UUID and not by the sd* reference -- blkid can show you this mapping).

You have two options: - Either find space within the extended partition and move your root partition into a new one or; - Use a spare disk on which you can recreate a new partition scheme and move all your data into it;

There's plenty of pitfalls into doing this, so I suggest keeping a clone of the disk while you try to make it work. If it fails you can always go back to where you started.

I appreciate this is quite high level, but yours is a problem that can be solved in a variety of ways.

Pedro
  • 1,891
  • 1
  • 13
  • 23