Re: shrink ext3 filesystem using e2fsprogs and fdisk

2012-03-28 Thread Stefan Monnier
 thanks for replies! Is it possible to slide partition using the
 tools included with e2fsprogs package as well?

The e2fsprogs tools only deal with the needs specific to
ext[234] partitions.  Sliding a partition can be done for any partition
you like with `dd'.


Stefan


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/jwvehscdefn.fsf-monnier+gmane.linux.debian.u...@gnu.org



Re: shrink ext3 filesystem using e2fsprogs and fdisk

2012-03-28 Thread Martin T
Stefan:

I'm afraid you can't use dd for this because as far as I know dd(1)
reads and writes one block at a time and in case new position for file
system overlaps with the present one, using dd you will start
overwriting the end of the file system with the readings from the
start of the file system. In addition, both parted and Gparted don't
have dd as a dependency. However, it should be doable if current and
new position don't overlap using the skip= and seek= options of
dd..or how did you think?


Jochen, Darac:

here is what Gparted did:



GParted 0.6.2

Libparted 2.3
Move /dev/sda9 to the right and shrink it from 904.37 GiB to 611.40
GiB  06:02:27( SUCCESS )

calibrate /dev/sda9  00:00:00( SUCCESS )

path: /dev/sda9
start: 56924160
end: 1953523711
size: 1896599552 (904.37 GiB)
check file system on /dev/sda9 for errors and (if possible) fix them
00:02:16( SUCCESS )

e2fsck -f -y -v /dev/sda9

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

308 inodes used (0.00%)
18 non-contiguous files (5.8%)
0 non-contiguous directories (0.0%)
# of inodes with ind/dind/tind blocks: 20/9/0
3363494 blocks used (2.57%)
0 bad blocks
1 large file

169 regular files
130 directories
0 character device files
0 block device files
0 fifos
0 links
0 symbolic links (0 fast symbolic links)
0 sockets

299 files
e2fsck 1.41.12 (17-May-2010)
shrink file system  00:01:31( SUCCESS )

resize2fs /dev/sda9 641099775K

Resizing the filesystem on /dev/sda9 to 160274943 (4k) blocks.
The filesystem on /dev/sda9 is now 160274943 blocks long.

resize2fs 1.41.12 (17-May-2010)
shrink partition from 904.37 GiB to 611.40 GiB  00:00:01( SUCCESS )

old start: 56924160
old end: 1953523711
old size: 1896599552 (904.37 GiB)
new start: 56924160
new end: 1339123711
new size: 1282199552 (611.40 GiB)
check file system on /dev/sda9 for errors and (if possible) fix them
00:02:47( SUCCESS )

e2fsck -f -y -v /dev/sda9

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

308 inodes used (0.00%)
18 non-contiguous files (5.8%)
0 non-contiguous directories (0.0%)
# of inodes with ind/dind/tind blocks: 20/9/0
3821982 blocks used (2.38%)
0 bad blocks
1 large file

169 regular files
130 directories
0 character device files
0 block device files
0 fifos
0 links
0 symbolic links (0 fast symbolic links)
0 sockets

299 files
e2fsck 1.41.12 (17-May-2010)
grow file system to fill the partition  00:01:03( SUCCESS )

resize2fs /dev/sda9

Resizing the filesystem on /dev/sda9 to 160274944 (4k) blocks.
The filesystem on /dev/sda9 is now 160274944 blocks long.

resize2fs 1.41.12 (17-May-2010)
check file system on /dev/sda9 for errors and (if possible) fix them
00:02:46( SUCCESS )

e2fsck -f -y -v /dev/sda9

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

308 inodes used (0.00%)
18 non-contiguous files (5.8%)
0 non-contiguous directories (0.0%)
# of inodes with ind/dind/tind blocks: 20/9/0
3821982 blocks used (2.38%)
0 bad blocks
1 large file

169 regular files
130 directories
0 character device files
0 block device files
0 fifos
0 links
0 symbolic links (0 fast symbolic links)
0 sockets

299 files
e2fsck 1.41.12 (17-May-2010)
grow partition from 611.40 GiB to 904.37 GiB  00:00:02( SUCCESS )

old start: 56924160
old end: 1339123711
old size: 1282199552 (611.40 GiB)
new start: 56924160
new end: 1953523711
new size: 1896599552 (904.37 GiB)
move file system to the right  05:48:52( SUCCESS )

perform read-only test  01:54:58( SUCCESS )

using internal algorithm
read 611.40 GiB
finding optimal block size

read 16.00 MiB using a block size of 2.00 MiB  00:00:00( SUCCESS )

16.00 MiB of 16.00 MiB read
0.215304 seconds
read 16.00 MiB using a block size of 4.00 MiB  00:00:00( SUCCESS )

16.00 MiB of 16.00 MiB read
0.250469 seconds
read 16.00 MiB using a block size of 8.00 MiB  00:00:01( SUCCESS )

16.00 MiB of 16.00 MiB read
0.215766 seconds
read 16.00 MiB using a block size of 16.00 MiB  00:00:00( SUCCESS )

16.00 MiB of 16.00 MiB read
0.253064 seconds
optimal block size is 2.00 MiB
read 611.34 GiB using a block size of 2.00 MiB  01:54:57( SUCCESS )

611.34 GiB of 611.34 GiB read
611.40 GiB (656486170624 B) read
perform real move  03:53:54( SUCCESS )

using internal algorithm
copy 611.40 GiB
finding optimal block size

copy 16.00 

Re: shrink ext3 filesystem using e2fsprogs and fdisk

2012-03-26 Thread Jochen Spieker
Martin T:
 
 Is it possible to make partition smaller starting from the beginning?

No.

 If yes, do I need to somehow start file system from the end of the
 partition?

AFAIK that's not possible. The solution for your problem (which involves
initial reformatting) is LVM.

J.
-- 
There is no justice in road accidents.
[Agree]   [Disagree]
 http://www.slowlydownward.com/NODATA/data_enter2.html


signature.asc
Description: Digital signature


Re: shrink ext3 filesystem using e2fsprogs and fdisk

2012-03-26 Thread Darac Marjal
On Sun, Mar 25, 2012 at 10:50:27PM +, Martin T wrote:
 I have a 500GB((131072000*4096)/1024^3) ext3 filesystem:
 
[cut]
 
 Is it possible to make partition smaller starting from the beginning?
 If yes, do I need to somehow start file system from the end of the
 partition?

Not directly. Try installing gparted (package: gparted). This will give
you a graphical interface which will allow you to resize the partition
as you're wanting. You will probably become aware that, no, taking space
off the beginning of the partition is not possible, but it IS possible
to take space off the END of the partition and then slide the
partition towards the end of the space.

The same is possible (I think) using the CLI parted, if you don't have
X. Note also that ext3 does NOT support online shrinking (you can make
it larger, but to make it smaller you MUST umount it).


-- 
Darac Marjal


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20120326142808.ga18...@darac.org.uk



Re: shrink ext3 filesystem using e2fsprogs and fdisk

2012-03-26 Thread Martin T
Jochen, Darac:

thanks for replies! Is it possible to slide partition using the
tools included with e2fsprogs package as well? Or is the GNU Parted
only option here if I want to make changes over CLI?


regards,
martin

Kuupäeval 26. märts 2012 17:28 kirjutas Darac Marjal mailingl...@darac.org.uk:
 On Sun, Mar 25, 2012 at 10:50:27PM +, Martin T wrote:
 I have a 500GB((131072000*4096)/1024^3) ext3 filesystem:

 [cut]

 Is it possible to make partition smaller starting from the beginning?
 If yes, do I need to somehow start file system from the end of the
 partition?

 Not directly. Try installing gparted (package: gparted). This will give
 you a graphical interface which will allow you to resize the partition
 as you're wanting. You will probably become aware that, no, taking space
 off the beginning of the partition is not possible, but it IS possible
 to take space off the END of the partition and then slide the
 partition towards the end of the space.

 The same is possible (I think) using the CLI parted, if you don't have
 X. Note also that ext3 does NOT support online shrinking (you can make
 it larger, but to make it smaller you MUST umount it).


 --
 Darac Marjal


 --
 To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
 with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
 Archive: http://lists.debian.org/20120326142808.ga18...@darac.org.uk



--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAJx5YvEnEV4+xCPZVLm-oH0ZUsgPBDYEK0=xpm7mhoscktm...@mail.gmail.com



shrink ext3 filesystem using e2fsprogs and fdisk

2012-03-25 Thread Martin T
I have a 500GB((131072000*4096)/1024^3) ext3 filesystem:

root@debian:~#dumpe2fs /dev/sda9 | egrep Block count|Block size
dumpe2fs 1.41.12 (17-May-2010)
Block count:  131072000
Block size:   4096
root@debian:~#

..on a 904GB((1953523711-56924160)*512)/(1024^3) partition(sda9):

root@debian:~#fdisk -cul /dev/sda

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 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: 0x00062a0f

   Device Boot  Start End  Blocks   Id  System
/dev/sda1   *2048  684031  340992   83  Linux
/dev/sda2  686078  1953523711   9764188175  Extended
/dev/sda5  68608018262015 8787968   83  Linux
/dev/sda61826406424121343 2928640   83  Linux
/dev/sda7241233925614182316009216   82  Linux swap / Solaris
/dev/sda85614387256922111  389120   83  Linux
/dev/sda956924160  1953523711   948299776   83  Linux
root@debian:~#


At the moment everything works, but if I shrink the size of the
/dev/sda9 partition from the beginning of the partition like this(sda9
is now 693GB which is more than enough to hold the 500GB file system):

root@debian:~#fdisk -cul /dev/sda

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 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: 0x00062a0f

   Device Boot  Start End  Blocks   Id  System
/dev/sda1   *2048  684031  340992   83  Linux
/dev/sda2  686078  1953523711   9764188175  Extended
/dev/sda5  68608018262015 8787968   83  Linux
/dev/sda61826406424121343 2928640   83  Linux
/dev/sda7241233925614182316009216   82  Linux swap / Solaris
/dev/sda85614387256922111  389120   83  Linux
/dev/sda9   5  1953523711   726761856   83  Linux
root@debian:~#

..then file system is broken:

root@debian:~#dumpe2fs /dev/sda9
dumpe2fs 1.41.12 (17-May-2010)
dumpe2fs: Bad magic number in super-block while trying to open /dev/sda9
Couldn't find valid filesystem superblock.
root@debian:~#

Is it possible to make partition smaller starting from the beginning?
If yes, do I need to somehow start file system from the end of the
partition?


regards,
martin


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAJx5YvHKWV_b5X_G=j4dG7F=av8tk-cwdrqetwe+iowuzpk...@mail.gmail.com