Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Resize partitions?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Resize partitions?

FreekFreek Member
edited December 2012 in Help

I made an oopsy, quite an big one.
My /dev/root partition is just 20GB, while the /dev/sda2 partition is 480GB. You guessed it, I am only using the /dev/root partition.
Now how do I resize this partition? Here's my output of df -T

root@dump:~# df -T Filesystem Type 1K-blocks Used Available Use% Mounted on rootfs rootfs 20917296 11655936 8212784 59% / /dev/root ext4 20917296 11655936 8212784 59% / /dev devtmpfs 1013864 4 1013860 1% /dev none tmpfs 202840 200 202640 1% /run none tmpfs 5120 0 5120 0% /run/lock none tmpfs 1014180 0 1014180 0% /run/shm /dev/sda2 ext4 466609984 3607288 439658468 1% /home

As you can see it's an ext4 partition. This is on a Kimsufi/OVH mKS2G dedi running Ubuntu 12.04

Thanks in advance!

Comments

  • Where do you need the space? Right now you have it avaible at /home/

  • FreekFreek Member
    edited December 2012

    @gsrdgrdghd said: Where do you need the space? Right now you have it avaible at /home/

    I need it at /var/ (Especially at /var/lib/mysql and /var/www/)

    I was just looking into OVH's rescue mode, that might be an option. However I read that an symlink should do the trick as well in this case?

    Thanks :)

  • cd /var
    mv www /home
    ln -s /home/www www

  • @Kenshin Thanks. Can this be done while the webserver is active and thus files being accessed or do I need to shutdown nginx and mysql for the time being?

    Thanks!

  • better shutdown nginx and mysql for the time being

  • Shutdown nginx before doing that.

    If you want to minimize downtime and the dataset is large, do a rsync instead. Though move is still the ideal.

    rsync -av --progress /var/www /home
    service nginx stop
    rsync -av --delete --progress /var/www/ /home/www/
    mv /var/www /var/www.old
    ln -s /home/www /var/www
    service nginx start

  • @Kenshin Thanks!
    And to move MySQL, is that the same technique or do I need to fiddle around with AppArmour as well and change the my.cnf file as explained here? http://serverfault.com/questions/168957/changing-mysql-data-directory-in-ubuntu-server-10-04

    Thanks!

  • Isn't it possible to boot the Kimsufi in rescue mode and run GParted? (never used OVH before, so please bear with my ignorance)

  • FreekFreek Member
    edited December 2012

    @George_Fusioned said: Isn't it possible to boot the Kimsufi in rescue mode and run GParted? (never used OVH before, so please bear with my ignorance)

    I am in recovery mode now and I've made huge mistake. Can't do anything, keeps giving me nice errors such as:

    root@rescue:/# apt-get update E: List directory /var/lib/apt/lists/partial is missing. - Acquire (2: No such file or directory) E: List of files can't be created as '/var/cache/apt/' is not a directory E: List of files can't be created as '/var/cache/apt/' is not a directory E: Could not open lock file /var/lib/dpkg/lock - open (2: No such file or directory) E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

    Yes I am root, it says so right there..?

    Of course I first mounted my HDDs
    mount /dev/sda1 /mnt/
    and
    mount /dev/sda2 /mnt/var

    And this is the real kicker:
    root@rescue:/# reboot shutdown: Unable to shutdown system

  • $ mkdir /mnt/hdd
    $ mount /dev/sda1 /mnt/hdd
    $ chroot /mnt/hdd
  • @BronzeByte Thanks! I've gotten a bit further.

    After that I tried the following:

    sudo apt-get install vnc4server openbox gparted vnc4server #set a password, create initial config vnc4server -kill :1 sed -i -e 's/x-window-manager/openbox-session/g' ~/.vnc/xstartup vnc4server

    But vnc4server -kill:1 doesn't work. it keeps saying:

    Can't find file /root/.vnc/rescue.ovh.net:1.pid You'll have to kill the Xvnc4 process manually

    Of course, being me, I tried the above sequence a couple of times, messed up and I'm now already at instance 6:

    `New 'rescue.ovh.net:6 (root)' desktop is rescue.ovh.net:6

    Starting applications specified in /root/.vnc/xstartup
    Log file is /root/.vnc/rescue.ovh.net:6.log`

    But killing number 6 also doesn't work:
    root@rescue:/# vnc4server -kill :6 Killing Xvnc4 process ID 3091 Cannot find /proc/version - is /proc mounted?

    I'm close, yet so far away....
    Any help is well appreciated. Rescue mode is scary!

  • @Freek

    Debian is scary? :P
    Rescue is just PXE booted debian :)

  • At the moment it is scary :p.. Still lost :(

  • Can you forward X over ssh with that rescue system?

  • @twain said: Can you forward X over ssh with that rescue system?

    I tried setting it up but again it seems that I can't install anything again:

    root@rescue:~# apt-get install gparted W: Not using locking for read only lock file /var/lib/dpkg/lock E: Unable to write to /var/cache/apt/ E: The package lists or status file could not be parsed or opened.
    And I mounted the hdds and the folder as @BronzeByte wrote.

    I have the feeling I am making things worse. Which approach should I use best now :(?

  • Try

    rpm --rebuilddb

  • @George_Fusioned

    It's Debian, haha

  • Ahh... didn't get good sleep last night it seems :P

    @Freek can you provide the output of mount and also try dpkg --configure -a please? If / is mounted read-only run mount -o remount,rw / to remount it in rw mode.

  • FreekFreek Member
    edited December 2012

    @George_Fusioned Thanks for the reply

    Here's the output of mount:

    root@rescue:~# mount tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755) proc on /proc type proc (rw,noexec,nosuid,nodev) sysfs on /sys type sysfs (rw,noexec,nosuid,nodev) udev on /dev type tmpfs (rw,mode=0755) tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev) devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620) rootfs on / type rootfs (rw) 91.121.126.137:/home/pub/rescue.v6/ on /nfs type nfs (ro,relatime,vers=3,rsize=8192,wsize=8192,namlen=255,hard,nolock,proto=udp,port=65535,timeo=11,retrans=3,sec=sys,local_lock=all,addr=91.121.126.137) 91.121.126.137:/home/pub/pro-power/ on /power type nfs (ro,nodev,relatime,vers=3,rsize=8192,wsize=8192,namlen=255,hard,nolock,proto=udp,port=65535,timeo=11,retrans=3,sec=sys,local_lock=all,addr=91.121.126.137) fusectl on /sys/fs/fuse/connections type fusectl (rw) /dev/sda1 on /mnt type ext4 (rw) /dev/sda2 on /mnt/var type ext4 (rw)

    And here's the output of dkpg --configure -a
    root@rescue:~# dpkg --configure -a dpkg: unable to access dpkg status area: Read-only file system

    I tried mounting it with the command you gave mount -o remount,rw /
    But that didn't work either. Here's the last line of output from the command apt-get update: W: Not using locking for read only lock file /var/lib/dpkg/lock

    Thanks in advance. I appreciate you helping me out here since I'm really stuck!

  • is parted (ie not gparted) already installed in the rescue environment by any chance?

  • @tehdan said: is parted (ie not gparted) already installed in the rescue environment by any chance?

    Yes, parted is installed and I can run it :)
    I will check if I can manage to resize it using parted tomorrow... need to search for tutorials tho, never used it before.

  • twaintwain Member
    edited December 2012

    If you use parted, make sure to umount /dev/sda1 and /dev/sda2 first. Also, you'll have to first shrink /dev/sda2, leaving free space preceding, then expand /dev/sda1 with the available free space.

  • I was busy with parted when my internet connection dropped. Resulting in the command being executed being killed and thus ending up with a corrupt/broken partition.
    Yay. Well, I'll start from scratch now but this time using correct partition sizes ;)

  • @Freek

    Awh, always use screen ;-)
    And OVH does this nasty /home partition indeed...
    My friend had huge data loss by rsync'ing a backup to his /root which was only like 10Gb, backup was 30GB :S

  • Although if you manage a server, you should know what the mountpoints are.

  • @BronzeByte said: Awh, always use screen ;-)

    Totally forgot. I was so focused about the whole partition part that I made another rookie mistake

Sign In or Register to comment.