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

how to calculate correct values for resize2fs



Hello everybody,

I want to make a new 16 MB partition on the end of my /dev/sda SSD.
Currently the SSD is partitioned in one ext2 /dev/sda1.

My question is how can i make this new partition with the CLI tools. I
tried several things but they keep failing because I don't know how to
calculate with blocks , sectors and MB. Would somebody willing to learn
me some things and maybe show some examples.

I also have some parted question on how to just make a partition from
the free space on the end of the disk.

Thanks in advance,

Best regards,

Jelle

current situation ext2 /dev/sda1, wanted situation ext2 /dev/sda1 and
16MB 0xef /dev/sda2 on the end of /dev/sda
16MB
0xef

PS. I know I got some fsck -n /dev/sda1 errors here. Working on that too.

$ dumpe2fs -h /dev/sda1
dumpe2fs 1.41.6 (30-May-2009)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          3e6384e0-dcaf-4c93-972f-f54c00a7dd22
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      filetype sparse_super
Default mount options:    (none)
Filesystem state:         not clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              492032
Block count:              983973
Reserved block count:     49198
Free blocks:              119386
Free inodes:              355584
First block:              0
Block size:               4096
Fragment size:            4096
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         15872
Inode blocks per group:   496
Last mount time:          Tue Jun 23 10:52:00 2009
Last write time:          Tue Jun 23 10:52:11 2009
Mount count:              9
Maximum mount count:      30
Last checked:             Tue Jun 23 00:23:53 2009
Check interval:           0 (<none>)
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128

$ sfdisk -d /dev/sda
# partition table of /dev/sda
unit: sectors

/dev/sda1 : start=       63, size=  7871787, Id=83, bootable
/dev/sda2 : start=        0, size=        0, Id= 0
/dev/sda3 : start=        0, size=        0, Id= 0
/dev/sda4 : start=        0, size=        0, Id= 0

$ fdisk -l /dev/sda

Disk /dev/sda: 4034 MB, 4034838528 bytes
255 heads, 63 sectors/track, 490 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xfb38fb38

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         490     3935893+  83  Linux


bc <<< "16*1024"
16384
bc <<< "3935893 - 16384"
3919509
echo "3935893 - 16384" | bc
3919509

resize2fs /dev/sda1 3919509

bc <<< "4034-16"
resize2fs /dev/sda1 4018M

# result: partition is only 983973 (4K) blocks
# requested: 1028608 blocks
# will not fit exiting

# how can I convert the free space to a partition with parted?
sudo /sbin/parted --script /dev/sda \
mkpart primary 3919509 100% \
print


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