[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Resizing partitions on a headless server



On 14/06/15 12:40 AM, csanyipal@gmail.com wrote:
Gary Dale <garydale@torfree.net> writes:

On 13/06/15 03:19 PM, csanyipal@gmail.com wrote:
Hello,

on my headless Debian GNU/Linux Jessie server I want to resize
partitions. So far I did followings:

root@b2:~# df -T
Filesystem                Type     1K-blocks    Used Available Use%
Mounted on
/dev/root                 ext3       9621848 8293064    840008  91% /
devtmpfs                  devtmpfs    127800       0    127800   0% /dev
tmpfs                     tmpfs       127880       4    127876   1%
/dev/shm
tmpfs                     tmpfs       127880   17992    109888  15% /run
tmpfs                     tmpfs         5120       0      5120   0%
/run/lock
tmpfs                     tmpfs       127880       0    127880   0%
/sys/fs/cgroup
/dev/mapper/bubba-storage ext3     470050224 8512368 437660636   2%
/home
tmpfs                     tmpfs        25576       0     25576   0%
/run/user/1001
tmpfs                     tmpfs        25576       0     25576   0% /run/user/0

root@b2:~# umount /dev/mapper/bubba-storage

root@b2:~# resize2fs -p /dev/mapper/bubba-storage 20G
resize2fs 1.42.12 (29-Aug-2014)
Please run 'e2fsck -f /dev/mapper/bubba-storage' first.

root@b2:~# e2fsck -f /dev/mapper/bubba-storage
e2fsck 1.42.12 (29-Aug-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Bubba_home: 114439/59703296 files (0.4% non-contiguous), \
4001648/119386112 blocks

At this step I think I forgot to run again:
root@b2:~# resize2fs -p /dev/mapper/bubba-storage 20G

root@b2:~# lvresize --size 2.1G /dev/mapper/bubba-storage
    Rounding size to boundary between physical extents: 2.10 GiB
      WARNING: Reducing active logical volume to 2.10 GiB
        THIS MAY DESTROY YOUR DATA (filesystem etc.)
        Do you really want to reduce storage? [y/n]: y
          Size of logical volume bubba/storage changed from 455.42 GiB
    (116588 extents) to 2.10 GiB (538 extents).
      Logical volume storage successfully resized

Furthermore, I was wrong when I determined the --size to 2.1G in the
command abowe, because I wanted to write 20.1G instead.

root@b2:~# resize2fs -p /dev/mapper/bubba-storage
resize2fs 1.42.12 (29-Aug-2014)
resize2fs: New size smaller than minimum (2153070)

root@b2:~# mount /dev/mapper/bubba-storage

After these steps I rebooted the server but can't login on it with ssh
but only with serial cable.

Now, when I login on the serial console as non root user, I get
messages:

b2 login: csanyipal
Password:
EXT3-fs error (device dm-0): ext3_get_inode_loc: unable to read inode
block - inode=30752769, block=61505538
Last login: Sat Jun 13 14:06:27 CEST 2015 from 192.168.10.90 on pts/0
Linux b2 3.2.62-1 #1 Mon Aug 25 04:22:40 UTC 2014 ppc

The programs included with the Debian GNU/Linux system are free
software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
No mail.
EXT3-fs error (device dm-0): ext3_get_inode_loc: unable to read inode
block - inode=30752769, block=61505538
EXT3-fs error (device dm-0): ext3_get_inode_loc: unable to read inode
block - inode=30752769, block=61505538
EXT3-fs error (device dm-0): ext3_get_inode_loc: unable to read inode
block - inode=30752769, block=61505538
No directory, logging in with HOEXT3-fs error (device dm-0):
ext3_get_inode_loc: unable to read inode block - inode=30752769,
block=61505538
ME=/

Now what can I do to correct the partitions?

Boot from something like system rescue CD and try to fix the
damage. With any luck resize2fs didn't do anything. Hopefully you can
put the partitions back the way they were.
My headless powerpc box can't boot from CD because it hasn't CD
device. It only has USB drive. Furthermore, it can't boot with an usual
system rescue image installed on USB stick, because it uses uImage. I
tried systemrescuecd ( http://www.sysresccd.org ), gparted live to boot
with, but without success.

I think I have the possibility to use serial console only. There I can
run parted but don't know how to fix with it the problem I made.

Otherwise, there is always testdisk or your backups.
I just installed testdisk and try followings:
Select a media:
Disk /dev/sda - 500 GB / 465 GiB - WDC WD5000AACS-00G8B1
  Disk /dev/mapper/bubba-storage - 2256 MB / 2152 MiB - WDC \
   WD5000AACS-00G8B1
  Disk /dev/dm-0 - 2256 MB / 2152 MiB - WDC WD5000AACS-00G8B1

[Proceed ]
Please select the partition table type, press Enter when done.
[Humax  ] Humax partition table
Hint: Humax partition table type has been detected.

Disk /dev/sda - 500 GB / 465 GiB - WDC WD5000AACS-00G8B1
      CHS 60801 255 63 - sector size=512

[ Analyse  ]
Disk /dev/sda - 500 GB / 465 GiB - CHS 60801 255 63
Current partition structure:
      Partition                Start   End    Size in sectors

  1 P Partition                5450241 2219977215 2214526975
  2 P Partition                1961272 2401037622 2399076351
  3 P Partition                5971968 2203721726 2197749759

[Quick Search]
   Partition                     63   19551102   19551040 [Bubba root]
Segmentation fault

So, I can't use testdisk here.

Rather than finding reasons for not using standard tools, find ways to make them work. Parted is complex, which is why people generally use it with a gui (e.g. gparted). However fdisk/gdisk are easy to use from a command line.


Reply to: