How to increase the size of /dev/sda2 in SUSE running on VMware?

1,099

Solution 1

Make sure that you have parted version 3.2, then run parted /dev/sda and use the resizepart command to resize sda2, moving the end of the partition to the end of the disk. Then run resize2fs /dev/sda2 to enlarge the filesystem to use the additional space. Reboot not required.

Solution 2

1) Boot this virtual machine from livecd.iso of any distr (example ubuntu)

2) find disk what you want resize (probably /dev/sda)

3) fdisk /dev/sda d - remove partition 2 - number partition n - create new p - type primary 2 - number 2056192 - start on same block, that started deleted partition <press enter to save default value> - max avaible size w - write changes and exit

4) after that resize you filesystem with resize2fs /dev/sda2 or other utils (depends your filesystem. resize2fs - for ext2/3/4)

Share:
1,099

Related videos on Youtube

Miguel
Author by

Miguel

Updated on September 18, 2022

Comments

  • Miguel
    Miguel over 1 year

    I'm trying to make a simple subset of a df based on a POSIXct variable, but it doesn't work...

    a2001 <- subset(anillas, anillas$data=="21-03-2001")
    

    it gives "0 obs. of 74 variables"

    are those variables different in any way I don't know?

    Tks.

    Ok, so this is part of the str(anillas)

     $ rc          : num  NA NA NA NA NA NA NA NA NA NA ...
     $ ss          : num  NA NA NA NA NA NA NA NA NA NA ...
     $ tg          : num  NA NA NA NA NA NA NA NA NA NA ...
     $ ug          : num  NA NA NA NA NA NA NA NA NA NA ...
     $ data        : POSIXct, format: "2001-03-21" "2001-03-23" ...
    
    • GSee
      GSee over 11 years
      please add the output of dput(head(anillas)) to your question. Also, please see stackoverflow.com/questions/5963269/…
    • Miguel
      Miguel over 11 years
      dput showed a very very long list so it will take me a little while to prepare a short one (based on what you suggest)(i'm just begining with R)
    • ricardo
      ricardo over 11 years
      is the problem that your date format in subset(annillas, anillas$data == "21-03-2001") is different to the date format in anillas$data? try which (anillas$data=="21-03-2001") to see if anything is returned. If not, try again with which(anillas$data=="2001-03-21"). I suspect that a2001 <- subset(anillas, anillas$data=="2001-03-21") might do what you want.
    • Miguel
      Miguel over 11 years
      in both cases I get integer(0), with the original UK date format and with the US format
  • Joshua Ulrich
    Joshua Ulrich over 11 years
    There's nothing wrong with their data and what they show isn't impossible. If the time is exactly midnight, no time is printed by default. For example: str(as.POSIXct("2012-11-21",tz="GMT")).
  • plannapus
    plannapus over 11 years
    @JoshuaUlrich fair enough, I didn't know that (never encountered the case before to be honest, and thought it would print 00:00:00). I tried to reproduce it but in my haste didn't specify tz="GMT", hence the 01:00:00.
  • Miguel
    Miguel over 11 years
    I created date1 and then subset... but a2001 still 0 obs of 74 variables
  • Miguel
    Miguel over 11 years
    Ok, finally I give up, I created a new variable with year() of package lubridateand everything worked fine. Thanks you all!!
  • pramav
    pramav almost 10 years
    Hi, I've created new partition /dev/sda3. But when used resize2fs command, it showing error "resize2fs: Bad magic number in super-block while trying to open /dev/sda3 Couldn't find valid filesystem superblock."
  • pramav
    pramav almost 10 years
    Please let me know whats going wrong here?
  • mr_tron
    mr_tron almost 10 years
    You have created new partition /dev/sda3 without filesystems. But i don`t understand why. You had to create partition with same number that deleted and same offset for first block but large.
  • mr_tron
    mr_tron almost 10 years
    Reed your update. Just mkfs.ext4 /dev/sda3
  • pramav
    pramav almost 10 years
    I'm new to Linux and dont know these partition and physical volume concepts. I just want increase size /dev/sda2.
  • pramav
    pramav almost 10 years
    You mean to say i've to delete the existing /dev/sda2 and create new one with same name? data in /dev/sda2 will be lost right?
  • mr_tron
    mr_tron almost 10 years
    I have writed simple list of commands. Just do them. (after you update: add d 3 after d 2)
  • mr_tron
    mr_tron almost 10 years
    if you recreate partition with same number and offset (thirst block) no data will be loss. But be carefull.
  • mr_tron
    mr_tron almost 10 years
  • Henry F
    Henry F almost 7 years
    You saved me a ton of time, thank you. By the way, this works for Arch Linux for any Arch users wondering.
  • Timo
    Timo almost 3 years
    I have parted version 3.3, does it work? I want to increase /dev/sda2 which is my swap.
  • Timo
    Timo almost 3 years
    I have /dev/sda1 2048 106745855 106743808 50.9G 83 Linux and /dev/sda2 106745856 117229567 10483712 5G 82 Linux swap / Solaris. Can I do your commands: parted /dev/sda, resizepart, resize2fs /dev/sda2. With df I do not see /dev/sda2, just /dev/sda1.Use in % is 36%, so much space on sda1
  • psusi
    psusi over 2 years
    @Timo, if it is sda1 you want to resize, then that is what you will need to resize, not sda2. Also you don't have any free space to expand sda1 into.